Fix lexographical comparison of binlog filenames by grodowski · Pull Request #1604 · github/gh-ost

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.