Verify expected update counts when automatic DML batches flush - #979
Conversation
Add AUTO_BATCH_DML_UPDATE_COUNT and AUTO_BATCH_DML_UPDATE_COUNT_VERIFICATION. Freeze per-entry policy at enqueue and compare actual BatchUpdate counts before a successful journal receipt. Verification defaults off. Fixes #401 Co-authored-by: apstndb <apstndb@users.noreply.github.com>
|
Additive merge of New HEAD: Published implementation tip
|
Code Metrics Report📊 View detailed coverage report (available for 7 days)
Details | | main (6b9600a) | #979 (fa3f3a9) | +/- |
|---------------------|----------------|----------------|-------|
+ | Coverage | 86.5% | 86.5% | +0.0% |
| Files | 113 | 113 | 0 |
| Lines | 10678 | 10715 | +37 |
+ | Covered | 9242 | 9279 | +37 |
+ | Code to Test Ratio | 1:2.2 | 1:2.3 | +0.0 |
| Code | 23860 | 23964 | +104 |
+ | Test | 54538 | 55774 | +1236 |
- | Test Execution Time | 1m42s | 1m59s | +17s |Code coverage of files in pull request scope (91.1% → 91.4%, patch 100.0%)
Reported by octocov |
|
Independent coordinator confirmation on exact HEAD Additive merge of origin/main. Worker reports verification default FALSE, expected count default 1, policy frozen per queue entry; original RPC/partial failure and SAVEPOINT recovery preserved; no TRANSACTION_TIMEOUT/owner-deadline edits; local {"repo":"apstndb/spanner-mycli","pr":979,"head":"368745d355b8d61a115988385abdadb8141e3bf4","base":"6b9600acf40d1eb8b18eeab845b3141dc68a9305","validation":["hosted test/lint/race/readme-sync/govulncheck/cross-compile success on exact HEAD","worker local make check exit 0","worker local make check-race exit 0","MERGEABLE CLEAN","no unresolved review threads"],"deviations":[],"blockers":[]} |
|
Reviewed feature HEAD
Keep the additions focused; no new production abstraction is needed merely for tests. Final integration order is #978 then this PR. Continue the review fixes now; defer a new final main merge until #978 merges. If a merge is already committed/pushed, preserve it and report it: a wait instruction never authorizes resetting, rebasing or force-pushing published history. Run |
|
Withdrawing the ready JSON for |
Add Codex acceptance tests for automatic DML expected-count verification: a successful prefix plus embedded non-OK Status must keep the original statement error, and SET / SET LOCAL / RESET ALL must freeze per-entry policy through later default changes and transaction-end LOCAL restore. Co-authored-by: apstndb <apstndb@users.noreply.github.com>
Co-authored-by: apstndb <apstndb@users.noreply.github.com>
#978 added RESET <name>. Drive the automatic DML policy freeze scenario through that statement instead of the registry API. Co-authored-by: apstndb <apstndb@users.noreply.github.com>
|
Codex acceptance-test gaps from comment 5665017247 are covered additively. New HEAD:
Published
|
|
Independent review of exact HEAD The partial-batch tests now return a successful prefix plus a non-OK embedded response Status and verify original error precedence, queue/journal cleanup, no failed-attempt commit, and valid-marker recovery. The SET/SET LOCAL/RESET scenario verifies captured per-entry policy and later LOCAL restoration. I independently ran those tests normally and with the race detector. A separate independent negative probe also confirmed that RESET ALL disabling future verification does not let an already-queued, previously enabled mismatch succeed. Independent focused tests, full Docker |
Summary
Adds
AUTO_BATCH_DML_UPDATE_COUNT(INT64, default 1) andAUTO_BATCH_DML_UPDATE_COUNT_VERIFICATION(BOOL, default FALSE) for existing automatic DML batching.Verification is opt-in so current arbitrary UPDATE/DELETE statements keep succeeding. Each queue entry freezes its expected-count policy at enqueue. A successful BatchUpdate compares each enabled actual count before a journal receipt;
[1,1]vs[0,2]fails at statement 1. RPC and partial BatchUpdate errors keep their original cause. Mismatch uses the existing SAVEPOINT failure/recovery path. Replay still checks journaled actual counts after verification is turned off.Manual, THEN RETURN, unbuffered, and partitioned DML are unchanged. No TRANSACTION_TIMEOUT / #482 owner-deadline edits.
Fixes #401
Test plan
make checkbefore pushmake check-racefor flush/owner lifecycletransaction_manager_auto_dml.goat or above 80%