Skip to content

feat: [OCISDEV-1392] retry failed blob commit after postprocessing - #733

Merged
mklos-kw merged 5 commits into
mainfrom
feat/ocisdev-1392
Sep 17, 2026
Merged

mklos-kw merged 5 commits into
mainfrom
feat/ocisdev-1392

Conversation

@mklos-kw

Copy link
Copy Markdown
Member

retry failed blob commit after postprocessing so large uploads don't get stuck in processing

@mklos-kw
mklos-kw requested a review from a team as a code owner September 11, 2026 12:12
@mklos-kw
mklos-kw marked this pull request as draft September 11, 2026 12:12
@kw-security

kw-security commented Sep 11, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

gauravsoni119
gauravsoni119 previously approved these changes Sep 14, 2026
@gauravsoni119
gauravsoni119 requested a review from a team September 14, 2026 08:48
}
backoff *= 2
}
if err = session.Finalize(ctx); err == nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be better to log the error right after the function returns it but not in a L#309
Should we use log-level error instead of warning?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the log next to the error. Warn stays - retries are normal; the final failure logs Error in the caller.

@2403905

2403905 commented Sep 14, 2026

Copy link
Copy Markdown

@mklos-kw Should we have a backport to 8.2 stable?

@mklos-kw
mklos-kw marked this pull request as ready for review September 16, 2026 06:22
@mklos-kw

Copy link
Copy Markdown
Member Author

@mklos-kw Should we have a backport to 8.2 stable?

Good idea

2403905
2403905 previously approved these changes Sep 16, 2026

@jvillafanez jvillafanez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just minor details, nothing critical.

if backoff > maxCommitRetryBackoff {
backoff = maxCommitRetryBackoff
}
log.Warn().Err(err).Int("attempt", attempt+1).Dur("backoff", backoff).Msg("blob commit failed, retrying after backoff")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor details here:

  • I'm not sure if the message will be a bit confusing. The attempt = 1 might refer to either the failed blob commit, but also to the retry attempt, so it might be confusing what you're counting there. Maybe "fails" or "failures" is clearer, or "retryNumber".
  • We'll need some reference to the blob to be included in the log. If there are several failures from multiple uploads, knowing which message refers to which log entry will be annoying. I assume that the session has some information we can use to identify the uploads.
  • The last attempt doesn't seem to be logged if it fails. Taking into account we have a maximum retry limit, I'd expect the same number of log messages if we reach the maximum retry count.

Comment on lines +319 to +320
case <-time.After(backoff):
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd include a "do nothing" code comment just to ensure this is intentional and there isn't any missing code.

spaceTypeIndex *spaceidindex.Index

// commitLimiter caps concurrent async blob commits at NumConsumers.
commitLimiter chan struct{}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a semaphore seems more standard. https://pkg.go.dev/golang.org/x/sync/semaphore

if backoff > maxCommitRetryBackoff {
backoff = maxCommitRetryBackoff
}
backoff = min(backoff, maxCommitRetryBackoff)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, the backoff could overflow, and the code could misbehave. I'd include a comment to say that is a risk we're taking and that the resulting behavior is acceptable.

@mklos-kw

Copy link
Copy Markdown
Member Author

Just minor details, nothing critical.

Thank you, pushed fixes

@mklos-kw
mklos-kw merged commit ba14a94 into main Sep 17, 2026
16 checks passed
@mklos-kw
mklos-kw deleted the feat/ocisdev-1392 branch September 17, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants