Fix data races and enable race detector in CI - #1750
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Enables Go race detection in CI and prevents shared GTID state from being mutated concurrently.
Changes:
- Runs unit tests with Go’s
-raceflag. - Clones GTID state before passing it to the binlog syncer.
Show a summary per file
| File | Description |
|---|---|
script/test |
Enables race detection for unit tests. |
go/binlog/gomysql_reader.go |
Isolates GTID state to prevent data races. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
The binlog reader updates its current coordinates while streaming, while go-mysql's BinlogSyncer retains and mutates the GTID set passed to StartSyncGTID. Clone the caller-provided coordinates for the reader and clone the GTID set again for the syncer. This prevents both components from mutating the caller's reconnect coordinates and eliminates concurrent access to the same MysqlGTIDSet.
The retry-hook test redirected os.Stdout and os.Stderr to capture status and hook output. Migrate has background status and logging goroutines, so reassigning those process-global streams races with their output. Inject a status writer into Migrator, retaining stdout as the default. The test supplies thread-safe buffers for the outputs, preserving the separate stdout and stderr assertions without mutating global state.
danieljoos
approved these changes
Aug 14, 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.
Description
This PR enables the Go data race detector when running unit tests in the CI.
Existing data race bugs are also fixed in this PR.
script/cibuildreturns with no formatting errors, build errors or unit test errors.