Retry attempt InstantDDL up to --default-retries#1667
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the instant DDL retry behavior to use the configurable --default-retries value (via MigrationContext.MaxRetries()) instead of a hard-coded retry limit, to better tolerate lock wait timeouts in high-concurrency environments.
Changes:
- Pass
MigrationContext.MaxRetries()into the instant DDL lock-wait retry helper. - Update
retryOnLockWaitTimeoutto accept a configurablemaxRetriesand iterate usingint64.
Show a summary per file
| File | Description |
|---|---|
| go/logic/applier.go | Make instant DDL lock-wait retries configurable via MaxRetries() and adjust retry helper signature/loop accordingly. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
go/logic/applier.go:323
maxRetriesnow comes fromMigrationContext.MaxRetries()(default 60 and user-configurable to arbitrarily large values). With the current linear backoff (i * 5s) this can make an instant DDL attempt block the migration start for hours by default, and for large--default-retriesvalues it can overflowtime.Duration(overflow occurs oncei> ~1.8e9), potentially producing negative/short sleeps and a tight retry loop. Consider cappingmaxRetriesfor this helper and/or capping the sleep interval (or switching to a bounded exponential backoff) and defensively handling very large values.
func retryOnLockWaitTimeout(operation func() error, maxRetries int64, logger base.Logger) error {
var err error
for i := int64(0); i < maxRetries; i++ {
if i != 0 {
logger.Infof("Retrying after lock wait timeout (attempt %d/%d)", i+1, maxRetries)
RetrySleepFn(time.Duration(i) * 5 * time.Second)
}
- Files reviewed: 2/2 changed files
- Comments generated: 1
thesnowrose
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following on #1651, increase the max instant DDL attempts from 5 to
MaxRetries, which is configurable with--default-retries. In high-concurrency environments, we may need more retries due to metadata lock wait timeout.script/cibuildreturns with no formatting errors, build errors or unit test errors.