Repository navigation
Conversation
With a progress or state callback configured and the frequency left at 0 (or set negative), the reporting loop waits on time.After(0) and posts to the callback as fast as it can.
ProgressReportFrequency and StateReportFrequency now default to 60000ms like other optional settings, and ValidateConfig rejects values below 100ms when the matching callback is configured. Fixes #214.
This branch has not been deployed
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 #214. Supersedes #215.
Problem
ProgressReportFrequencyandStateReportFrequencyhave no default and no validation. The reporting loops wait ontime.After(time.Duration(freq) * time.Millisecond), so with a callback URI set and the frequency left at 0 (or set negative) the loop fires immediately, forever. Each iteration builds a fullProgress(or serializes the whole state) and POSTs it synchronously.Smoke run with the real
ghostferry-copydbbinary on a 3-row table,ProgressCallbackset and no frequency:mainProgressReportFrequency: 500ProgressReportFrequency: -1failed to validate config: ProgressReportFrequency must be at least 100 milliseconds, got -1Fix
In
Config.ValidateConfig:0defaults to 60000 ms, matching how other optional numeric settings are defaulted (BinlogEventBatchSize,DBReadRetries, ...).#215 clamped to a 1-minute minimum inside the loops instead. That would silently override the 500 ms the integration tests use and the 1500 ms the benchmark uses. Rejecting at validation reports the misconfiguration at startup instead.
All in-repo entry points (copydb, sharding, integration ferry, test helpers) call
ValidateConfig.Repro
The first commit adds only the tests:
TestConfig/TestReportFrequenciesDefaultWhenCallbacksAreSet: before the fix the frequency stayed0.TestConfig/TestReportFrequenciesBelowMinimumAreRejected: before the fix there was no error for-1or50.Verification (local, MySQL 8.0.32)
go test ./copydb/test ./sharding/testandgo test ./test/go -run 'TestConfig|TestLogger': pass.test/integration/callbacks_test.rb: 3 tests, 0 failures.mainand this branch.