Skip to content

Conversation

@grodowski
Copy link
Contributor

Closes #1603, please see the issue contents for context.

… correctly order files like binlog.999999 < binlog.1000000.

Would cause the stream to ignore all incoming events and render the gh-ost process stuck:
https://github.com/github/gh-ost/blob/48b34bcbfde730b2548d598dee98e9c1f0d2fcce/go/binlog/gomysql_reader.go#L85-L88

Possibly remediated by 005043d too, which drops the SmallerThanOrEqual check from GoMySqlReader.handleRowsEvent
Copilot AI review requested due to automatic review settings November 6, 2025 11:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the SmallerThan method in FileBinlogCoordinates to use numeric file number comparison instead of lexicographic string comparison, fixing a bug where binlog file comparisons would fail when file numbers transitioned from 6 digits to 7 digits (e.g., "mysql-bin.999999" vs "mysql-bin.1000000").

  • Replaced string comparison with FileNumberDistance method for accurate numeric comparison
  • Removed unused FileSmallerThan method
  • Added test coverage for edge cases including zero-padded transitions and same-file position comparisons

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
go/mysql/binlog_file.go Refactored SmallerThan to use numeric file comparison via FileNumberDistance; removed unused FileSmallerThan method
go/mysql/binlog_file_test.go Added tests for binlog file number transitions and same-file position comparisons

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@meiji163
Copy link
Contributor

meiji163 commented Nov 6, 2025

Thanks for submitting this fix!

@meiji163 meiji163 merged commit bba7359 into github:master Nov 6, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migration stuck before cutover due to binlog streamer error

2 participants