Repository navigation
fix(cli): prove migration verify read the source, not only the manifest (#1306) - #1387
Conversation
🦋 Changeset detectedLatest commit: f62ed09 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge, with the previously reported help-text issue remaining non-blocking. Findings
|
| /// | ||
| /// It reads the store only and proves the copy read every source row the counts recorded |
There was a problem hiding this comment.
Copy help claims read-only behavior
This paragraph belongs to PgToLmdb, so the copy command's help now says “It reads the store only.” The copy actually reads Postgres and writes LMDB. Move this explanation to verify and finish the sentence, which currently ends at “recorded.” Otherwise operators get the wrong description of what the command changes.
a16d5e9 to
f62ed09
Compare
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Issue: #1306 (closed by hand with the merge sha after merge).
The gap
The migration's verify pass proved the store matched the manifest it wrote, not the source. The manifest's rows and checksum were folded from the same batches the store received, and a table counted as complete on
count < batch_size— so a source that ended a page early producedcopy exit 0, a manifest recording the short total as complete, andverify exit 0. Demonstrated in recon with a 3-row source whose first page answers 1:{"complete":true,"rows":1},Verified 9 tables, 1 rows.The fix
MigrationSource::count_rows— oneSELECT count(*)per table on the master pool the copy already uses; the tool stays read-only against the source and--verifystill needs no Postgres.source_rowsper table and moves toformat: 2; a format-1 manifest is refused with… this tool reads and writes 2(#[serde(default)]so an old file reaches that refusal rather than a serde error).verify_withasserts target rows ==entry.rows==entry.source_rows, refuses a short read with[<table>] source {n} rows, target {m} rows, and the success line now says what it proves:Verified 9 tables, {total} rows: the store matches the manifest, and the copy read every source row.Evidence
Oracle
cargo test -p nostream-cli --test migrate_cli -- short_page:running 0 testsbefore,1 passednow, with the old shape copied to a scratch tree and shown to verify clean. Three new cases (short page, old manifest, failing source count), the accepted format-1 fixtures migrated, nine command criteria inverted and restored,migrate_cli49 passed.