Skip to content

fix(mysql-cdc): a negative TIME(1) or TIME(2) with a fraction is read from the binlog as stored (upstream: blackbeam/rust_mysql_common#200) - #816

Merged
panchenkoai merged 14 commits into
mainfrom
fix/mysql-binlog-time-fraction
Nov 5, 2026
Merged

panchenkoai merged 14 commits into
mainfrom
fix/mysql-binlog-time-fraction

Conversation

@panchenkoai

@panchenkoai panchenkoai commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

What

A negative MySQL TIME(1) or TIME(2) with a fraction is read from the binlog as stored. mysql_common 0.37.3 (binlog/misc.rs:35-39) does frac -= 0x100 on a u32: a debug rivet panics, a release rivet wraps to about 625 hours. rivet reads the rows of every table in the binlog, so one such row in any table stopped every debug MySQL CDC run on that server.

The fix is a [patch.crates-io] pin of a fork (rivet-lab/rust_mysql_common, rev a660b506, based on v0.37.3) that reads the fraction byte as i32. Upstream PR: blackbeam/rust_mysql_common#200. The pin is dropped when upstream releases a fixed mysql_common. Open defect cell came with #811. deny.toml lists the fork under allow-git with a dated reason, so the cargo-deny sources check admits it.

Evidence

  • RED on main (live, Mac MySQL 8.0 CDC stand): assertion left == right failed: stream differs from the source on negative TIME(1)/TIME(2) with a fraction, panicked at mysql_common-0.37.3/src/binlog/misc.rs:38:17, Summary 2 tests run: 1 passed, 1 failed, 2878 skipped.
  • GREEN on this branch, rig oracle ON: PASS live_cdc_mbt::mysql_cdc_negative_time_fraction_matches_the_snapshot, PASS live_cdc_mbt::mysql_cdc_time_values_beside_a_negative_fraction_match_the_source, Summary 2 tests run: 2 passed, 2878 skipped.
  • Offline decode cell tests/offline/mysql_binlog_time_fraction.rs: 3 passed with the pin, 1 passed and 2 failed without it.
  • Seed mysql-binlog-negative-time-fraction: with the patch applied the live cell fails (RIVET-ORACLE-FAIL) and the neighbour cell passes.
  • Pre-push on the merge with main (e37c02f, Mac): nextest 1197 tests run: 1197 passed, 2873 skipped.

Neighbours unchanged

Positive fractions, zero fraction, TIME(3..6), and plain TIME values beside a negative fraction decode as before (cell time_values_beside_a_negative_fraction_decode_as_before and the live neighbour cell).

Existing users

No state or format change. Rows that crashed a debug run are now read; in a release run, string columns that held the wrapped text before the upgrade are not rewritten. Remedy (in changelog.d): re-run the initial: snapshot leg or a one-off mode: full export for affected TIME(1)/TIME(2) string columns.

The refusal hint "declare the column string" in src/source/cdc/value.rs is kept: it still works for TIME past a day (cell live_operator_contract.rs:3500).

Ratchets raised

  • seeded-na 487 -> 491 (four structural N/A rows for postgres, mssql, mongo, oracle from the new seed; 487 is current main).
  • matrix-gaps (tests/offline/chunking_matrix_guard.rs, docs/fuzz-matrix.yaml entry 1 -> 2, pin sum 109 -> 110): the MySQL fuzz_cdc_wire_decode row is a gap (a property test over arbitrary binlog TIME bytes against the fork decoder is open, 2026-11-04); it is not a structural na, because the fork is patched by rivet.
  • Lowered, not raised, against current main: known-red-entries 31 -> 30, no-oracle-opt-outs 32 -> 31.

Not verified

MySQL 5.7 and 8.4; release-profile behaviour of the wrap; full make seeded-recall for this seed with CONTROL; mutants; repeat x5; full live suite and make open-defects (devbox); Docker image build; cargo deny check with the git dependency (cargo-deny is not installed on the Mac, CI runs it).

See #811.

@panchenkoai
panchenkoai enabled auto-merge November 4, 2026 10:16
@panchenkoai
panchenkoai added this pull request to the merge queue Nov 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 4, 2026
@panchenkoai
panchenkoai added this pull request to the merge queue Nov 4, 2026
…-fraction

# Conflicts:
#	tests/offline/known_red_guard.rs
#	tests/offline/rig_oracle_ratchet.rs
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 4, 2026
@panchenkoai
panchenkoai enabled auto-merge November 4, 2026 15:39
@panchenkoai
panchenkoai added this pull request to the merge queue Nov 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 4, 2026
@panchenkoai
panchenkoai enabled auto-merge November 4, 2026 16:32
Andrii Panchenko added 3 commits November 4, 2026 23:00
# Conflicts:
#	docs/roast-ledger.yaml
#	tests/offline/known_red_guard.rs
#	tests/offline/rig_oracle_ratchet.rs
# Conflicts:
#	tests/offline/known_red_guard.rs
@panchenkoai
panchenkoai added this pull request to the merge queue Nov 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 5, 2026
…-fraction

# Conflicts:
#	tests/offline/known_red_guard.rs
#	tests/offline/rig_oracle_ratchet.rs
@panchenkoai
panchenkoai added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit edcb356 Nov 5, 2026
24 checks passed
@panchenkoai
panchenkoai deleted the fix/mysql-binlog-time-fraction branch November 5, 2026 04:35
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.

1 participant