Repository navigation
Conversation
…tion run After a daily run, backfill or repair, count every copy of the keys the run wrote over a window wider than the MERGE window, one statement per written month. A repeated key, or a check that cannot run, fails the run. The full-history scan stays a manual step after a migration or the first full load.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a merge-key duplicate check that runs after every daily ingestion, backfill and repair, scoped to the keys that run wrote.
This settles how often the duplicate check runs. Every ingestion checks its own range, and the full-history scan (
verifyMergeKeyUniqueness) is only needed by hand after a migration or the first full-history load.What changes
The comment on
twinWindowForinwindow.tsexplains why the window reaches past the MERGE window and how far. No schema change: it uses existing columns on the base tables and does not need the all-history views.Cost
Estimated, to be confirmed with a dry run once RawLogs exists. The project's estimate for RawLogs is 719.4M rows for the full history of all four chains. Without Fuse, now out of scope, that is 584M rows, and that is a ceiling. Spread over about six years (~8M rows a month), at ~100 bytes read per row:
MAX_BYTES_BILLED_PER_JOBraised for that one run.Transactions is assumed to hold at most half as many rows as RawLogs.
Two schema options would cut this further, and both are cheapest before RawLogs is created: storing
tx_hashas 32 bytes instead of a hex string (~36% less read on every query), and an 8-byte merge-key fingerprint column (full-history scan of RawLogs from ~58 GB to ~9 GB). Neither is included here.Validation
npm run verify:localinpipeline-v5: lint, typecheck, build check, 555 unit and 21 known-failure tests pass.test/unit/range-duplicate-check.test.tsseeds an April copy of a key the run writes in June. It fails the run for daily, backfill and repair. The tests go red when the check is unwired, when the window is narrowed to the MERGE window, and when the month split is removed.Start review at
verifyWrittenRangeUniquenessand the run-scoped branch ofduplicateReportinsrc/bq.ts, thentwinWindowForandmonthSlicesinsrc/window.ts. Most of the line count is the test file.Refs #40.