Repository navigation
fix(runtime): diagnose rejected owner lease renewals - #972
mergify[bot] merged 2 commits into
Conversation
Review —
|
|
Addressed the review in
Formatting and diff checks passed. No local Rust compilation was started; the updated head requires fresh CI, including online core-services. The previous head's green checks are not evidence for this revision. This remains diagnostic work for #906, not a claim that its original QA incident has been reproduced or fixed. Verification provenance: fixes and source inspection by the submitting Codex agent; no independent second-agent review is claimed. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed 3ff8eeac8f6c14e096632689dc43697ee6834cc6 against 1b200734e8fa5c573dbe1e401b9014c130d9c108, including all six changed files, both runtime renewal callers, the canonical exact-session authority reader/classifier, cancellation-safe connection ownership, activation response mapping, and the existing PR discussion. No material correctness or design findings remain on this revision.
The design stays with the existing owner, DatabaseRunStateStore::renew_owner_lease. The additional enum represents diagnostic outcomes and connection disposition; it does not create another ownership state machine. The existing database-clock classifier remains authoritative for interpreting the later snapshot, while the original UPDATE result remains false even if the snapshot is current. There is no new writer, retry loop, detached worker, compatibility path, or production dependency.
The earlier review's concerns are addressed:
- Heartbeat and activation pass the exact monotonic deadline also used by their outer timeout_at. Diagnostic waiting is capped at min(250 ms, remaining / 4), with I/O skipped when that share is below 1 ms. The known refusal still follows the existing Superseded/409 or heartbeat-fencing path.
- Completed diagnostic SQL errors and skipped reads release the checkout. A timed-out exchange is discarded; ordinary cancellation retains the existing cancellation-safe guard.
- The public renewal regression now captures the actual emitted snapshot_reason for independently invalidated owner, generation, status, cancellation, lease and session predicates, while checking a fresh run's first renewal succeeds.
- Virtual-time coverage exercises the short/near-spent budget and failure labels. The single-slot real-database regression verifies connection ID reuse after SQL error and replacement after timeout.
Performance and complexity: successful renewal adds no query; refusal adds at most one bounded read on the existing checkout, with no extra pool acquisition. This is a bounded diagnostic cost, not a throughput or tail-latency improvement claim. The frozen 185 ms test value exercises the small-lease failure window; production behavior derives its budget from the caller deadline rather than a scenario-specific branch. The new tests cover distinct observable behavior.
Inspected completed CI logs for merge commit db69ee8467f5796f5c8f5f1434f01e54ad0b5946, which contains this exact head:
- Online core-services: 443 passed, 1820 skipped; both new MatrixOne diagnostic regressions explicitly passed (0.325 s and 0.435 s).
- Offline turn-core/services/plan: 5438 passed, 459 skipped; the new virtual-time regression explicitly passed.
- Runtime: 5911 passed, 173 skipped, including activation deadline/cancellation and rejected-renewal fencing tests.
- Online core-runtime: 86 passed, 5612 skipped.
- Static checks: clippy and formatting passed.
The selected executor remains unavailable, so this review did not independently run local compilation, native tests, git diff --check, or a QA harness. Inspection of added diff lines found no trailing whitespace or conflict markers. No subagent was used, and no second-model review is claimed. The original QA incident in #906 remains unreproduced and open; a later diagnostic snapshot cannot establish why an earlier UPDATE matched zero rows.
Change accounting: implementation +111/-3 (net +108); tests and dev-dependency wiring +223/-2 (net +221); documentation +13/-0.
Merge Queue Status
This pull request spent 13 minutes 40 seconds in the queue, including 13 minutes 20 seconds running CI. Required conditions to merge
|
3ff8eea to
bb16522
Compare
Summary
When a database owner-lease renewal matches zero rows, activation currently has a stable error code but only a generic
owner_renewal_not_matcheddiagnostic. Add elapsed renewal time, configured lease duration, and a bounded best-effort post-update authority snapshot to identify the state visible after rejection.Reuse the canonical exact-session authority reader and database-clock classifier. Labels cover missing identity/session mismatch, owner/generation mismatch, inactive/cancellation state, expiry at the later snapshot, and authority that is current at that later observation. Both runtime callers pass their exact monotonic attempt deadline. The read uses at most 250 ms and one quarter of the remaining attempt; it is skipped below a 1 ms share. Completed SQL errors release the synchronized connection; only a timed-out exchange discards it. Every diagnostic outcome preserves the rejected result. Successful renewals do not issue a diagnostic query.
Related issue
Refs #906. This is a diagnostic follow-up, not a claimed fix for the unreproduced QA incident. Keep #906 open. The confirmed missing-error-code defect was already fixed by merged #909. A zero-row UPDATE alone does not establish its cause, and a later snapshot can race further changes.
Change type
User and compatibility impact
Rejected renewals may spend up to the smaller of 250 ms and one quarter of the remaining caller attempt on diagnostics. Near-exhausted attempts skip the read so an already-known refusal can return without waiting on diagnostics. Existing cancellation and authority fencing remain in force. Logs carry scoped opaque run/session identity and snapshot labels; actual owner pod values are not logged. No schema/config change.
Architecture and complexity delta
DatabaseRunStateStore::renew_owner_lease.Verification
cargo fmt --all --checkandgit diff --check: passed.snapshot_reasonfor each authority predicate.RunStateStore::renew_owner_leaseonDatabaseRunStateStore.ASTRA_TEST_DB_IT=1with live MatrixOne; retained canonical query is reused. No schema/migration change. This must pass the remote online core-services lane.Final checklist