Skip to content

harness: the MSSQL CDC capture wait ends on the instance's change row, not on the database max LSN advancing - #1246

Open
panchenkoai wants to merge 1 commit into
mainfrom
harness/mssql-cdc-capture-wait
Open

panchenkoai wants to merge 1 commit into
mainfrom
harness/mssql-cdc-capture-wait

Conversation

@panchenkoai

Copy link
Copy Markdown
Collaborator

Why

Nightly Gate run 45603119161 (job 139166893594, oracle-scenarios) failed no_silent_null_cdc[mssql]: NO_OUTPUT over 10 source->override pairs, only on the cdc-removed leg (1 of 1 change rows not delivered, insert:2003). The stage took 206 s against 146 s the night before, and two later re-runs at the same sha were green.

_wait_mssql_captured released as soon as the database-wide sys.fn_cdc_get_max_lsn() moved past a value read before the write. A DDL on a tracked table advances that max LSN with no change-table row, so the wait released before the capture job had harvested the last insert. rivet then read its upper bound (fn_cdc_get_max_lsn() at open, src/source/mssql/cdc.rs) before the row was covered and drained nothing with exit 0. wait_until returned False on timeout and every caller ignored it, so a wait that never succeeded read the same as one that did (the +60 s in the CI log is consistent with two silent 30 s timeouts).

What

  • dev/release_oracle/cdc.py: _wait_mssql_captured(url, instance, op, row_id) polls cdc.<instance>_CT for the LAST write's change row and returns False with a stderr line when it never lands. _mssql_max_lsn is gone. _mssql_landed is the one place that reads the change table.
  • Callers in cdc.py (changes, crashdelta, _lc_insert), perf.py and upgrade_cdc_load.py pass the last write and return the wait's result.
  • dev/release_oracle/property_no_silent_null_cdc.py: exec_all waits for the last row each leg writes (from expected(leg, n), the single source of truth) and raises when it never lands, so an undrained leg is an error and not a graded run.
  • Sync points removed: the per-call before value read at 6 sites. Guards added: none that need a list kept in step; the two new self-test blocks grade the wait itself.

Evidence

Live, devbox stand-mssql2022-cdc-1, scratch database (3 rounds of DDL then insert): the old condition returned in every round while the change table lacked the inserted row.

old wait (max advanced past before) would return: 1; inserted row id 101 in change table: 0
row-level wait returned after 9509 ms, landed=1
old wait (max advanced past before) would return: 1; inserted row id 102 in change table: 0
row-level wait returned after 10090 ms, landed=1
old wait (max advanced past before) would return: 1; inserted row id 103 in change table: 0
row-level wait returned after 10131 ms, landed=1

RED against the mutant each guard exists to catch (restored from a snapshot copy, cmp clean, no mutant text left):

Guard Mutant Result
cdc.py self_test, fake server advances max LSN at once, row lands at poll 5 _mssql_landed returns on max LSN not NULL AssertionError: the wait returned before the row was in the change table
property_no_silent_null_cdc self_test exec_all ignores the wait's False AssertionError: a change row that never lands is a refusal, not a graded run
property_no_silent_null_cdc self_test exec_all waits for the first expected row AssertionError: a leg waits for the change row of its last write: [('dbo_t', 'insert', 2003), ('dbo_t', 'delete', 1)]

GREEN:

  • python -m dev.release_oracle.cdc --self-test: self-test ok: ... the capture wait ends on the row, not on the max LSN
  • python -m dev.release_oracle --self-test: rc=0
  • skip_census --self-test: ok
  • dev.seeded --self-test: self-test ok: seeded recall ...
  • Cyrillic and closing-keyword greps on the diff: 0. No src/ change, so no ## Invariants and no new env reads.

Ratchets raised: none.

Not run here: make pr-ready --fast was started on the Mac at load average 74 and had not finished its offline-suite step (the diff touches only dev/ Python); the pre-push hook passed. CI carries the offline suite, mutants and the full gate cell.

For the gate: run no_silent_null_cdc for mssql repeatedly and expect no NO_OUTPUT line; the stage time should return to about 146 s.

…, not on the database max LSN advancing

A DDL on a tracked table advances sys.fn_cdc_get_max_lsn() with no change-table row, so
the wait released before the capture job had harvested the last insert and rivet opened
its window on a max LSN that did not yet cover it (no_silent_null_cdc[mssql], cdc-removed
leg, 1 of 1 change rows not delivered). The wait now polls cdc.<instance>_CT for the last
write's row, returns False with a stderr line when it never lands, and the callers that
grade a run raise instead of grading an undrained one.

This branch has not been deployed

No deployments
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