Repository navigation
checksum: honor yield timeout in distributed checker - #1022
Merged
Merged
Conversation
Signed-off-by: aouxwoux <[email protected]>
aouxwoux
force-pushed
the
distributed-checksum-yield-timeout
branch
from
June 30, 2026 11:50
c96e6ff to
cf0a50c
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the checksum subsystem so CheckerConfig.YieldTimeout is honored by DistributedChecker (used by move / applier-backed checksums), enabling periodic yield/resume to release long-lived REPEATABLE READ snapshots and reduce InnoDB history list growth during long checksum passes.
Changes:
- Plumbs
CheckerConfig.YieldTimeoutintoDistributedChecker. - Adds yield-timeout bounding + yield/resume loop to distributed checksum passes (mirroring
SingleChecker’s behavior). - Adds a regression test to ensure the config path no longer drops
YieldTimeout.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/checksum/distributed.go | Adds yield-timeout context bounding to distributed checksum passes and a yield/resume loop based on low-watermark. |
| pkg/checksum/distributed_test.go | Adds a regression test verifying YieldTimeout is propagated into DistributedChecker. |
| pkg/checksum/checksum.go | Passes YieldTimeout through when constructing a DistributedChecker. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+64
to
+84
| func TestDistributedCheckerHonorsYieldTimeoutConfig(t *testing.T) { | ||
| db, err := sql.Open("mysql", testutils.DSN()) | ||
| require.NoError(t, err) | ||
| defer utils.CloseAndLog(db) | ||
|
|
||
| config := NewCheckerDefaultConfig() | ||
| config.Applier = &noopDistributedApplier{} | ||
| config.YieldTimeout = 137 * time.Millisecond | ||
|
|
||
| checker, err := NewChecker( | ||
| []*sql.DB{db}, | ||
| table.NewMockChunker("yield_config", 1), | ||
| []change.Source{&noopChangeSource{}}, | ||
| config, | ||
| ) | ||
| require.NoError(t, err) | ||
|
|
||
| distributedChecker, ok := checker.(*DistributedChecker) | ||
| require.True(t, ok) | ||
| require.Equal(t, config.YieldTimeout, distributedChecker.yieldTimeout) | ||
| } |
morgo
approved these changes
Jun 30, 2026
Collaborator
|
Awesome, thank you! |
morgo
added a commit
that referenced
this pull request
Jun 30, 2026
…lure The yield/resume path (added for the distributed checker in #1022, and pre-existing in the single checker) detected a yield with `!chunker.IsRead()`. That misses the case where the yield timeout fires on the *final* chunk: once all chunks are dispatched IsRead() is already true, so the deadline-induced context error from the in-flight query (and, for the single checker, the trx-pool rollback) was not recognized as a yield. It fell through to the error path and surfaced as a spurious "checksum failed: ... context deadline exceeded". This is fatal for the DistributedChecker because its Run() returns on the first runChecksumWithYield error. The SingleChecker happens to mask it via its retry loop (Run() continues up to maxRetries), so it only wasted a retry — but the detection was wrong in both. Fix both: also treat a deadline-induced in-flight error (err1, or closeErr for the single checker) as a yield when the yield context expired and the parent context is still healthy. Add TestDistributedCheckerYieldTimeout, the distributed analog of TestYieldTimeout: it drives real yield/resume cycles and asserts the run passes and yieldsPerformed > 0. This exercises the resume path (which TestDistributedCheckerHonorsYieldTimeoutConfig did not) and gives the distributed yieldsPerformed counter a reader. Before this fix the new test failed ~2/3 of runs; after it, 8/8. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
Closes #993.
Summary
CheckerConfig.YieldTimeoutthrough toDistributedCheckerSingleCheckerYieldTimeoutTests
go test ./pkg/checksum -run '^TestDistributedCheckerHonorsYieldTimeoutConfig$' -count=1go test ./pkg/checksum -run '^$' -count=1go test ./... -run '^$' -count=1I also tried
go test ./pkg/checksum -run 'TestYieldTimeout|TestDistributedChecksum' -count=1, but this local machine has no MySQL service at127.0.0.1:3306, so the existing integration tests fail immediately with connection refused before exercising the checksum logic.