Repository navigation
Stop TimeTaken when the data copy completes - #468
Merged
Merged
Conversation
Progress.TimeTaken is always now - StartTime, so it keeps increasing while Ghostferry waits for and performs the cutover.
Record when the data iterator finishes and compute Progress.TimeTaken up to that point, so the progress callback and the control server no longer count the wait for cutover and the cutover itself. Fixes #314.
driv3r
force-pushed
the
fix-time-taken-after-copy
branch
from
October 22, 2026 14:36
4868694 to
1b33faa
Compare
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.
Fixes #314.
Problem
Ferry.Progress()computedTimeTakenastime.Now() - StartTime. It kept growing through wait-for-cutover, the cutover itself, and the finaldonereport. The progress callback,/api/status, and the web UI's "Time Taken" all read this value.Before the runtime fix:
TimeTakenincreasing from approximately 0.71 to 3.17 seconds.AutomaticCutover: false,/api/statuswent from 0s to 3s over three seconds ofwait-for-cutover. With the fix it stayed at 0s because the copy itself took under a second.Runtime fix
Runrecords when the data iterator finishes, immediately before publishingwait-for-cutover.Progress()measuresTimeTakenup to that timestamp once it is set. The timestamp uses an unexportedatomic.Pointer[time.Time]because progress readers andRunexecute concurrently.DoneTimeis unchanged.Regression test and review correction
The original test commit held
ROW_COPY_COMPLETEDfor two seconds and required at least three reports. That depended on callback scheduling rather than the behavior under test.The test now holds cutover until a thread-safe queue has received three actual
cutoverprogress callbacks. Each wait has a ten-second timeout. It then checks that allcutoveranddonereports have the sameTimeTaken. There is no fixed sleep or timing-based sample-count assertion.To reproduce the review finding, I temporarily changed the integration fixture's report interval from 500ms to 5000ms:
Expected 2 to be >= 3, although the runtime duration was correctly frozen.The fixture interval was restored to 500ms; the temporary change is not included in the PR.
Verification
On local MySQL 8.0.32:
test/integration/callbacks_test.rb: four tests pass in file/position mode and four pass in GTID mode at the normal reporting interval./api/statusbefore/after smoke described above.Merged current
mainand resolved the changelog conflict while retaining both independent entries.