Skip to content

Commit 5ff2db2

Browse files
test(v3): complete reader owners before committing a prune backlog (#104)
The native 64-owner backlog regression failed at its first bulk ACTIVE-owner commit, before any explicit prune assertion, because the shared deferred ownership guard rejected the final state. Source inspection supports the 60-second reader deadline as the most likely explanation; the runtime log does not identify which guard predicate failed. Complete each of the 65 admitted readers immediately in the same transaction, preserving the terminal transaction fence and deferred validation. After its first successful commit, assert 65 FINISHED owners, no ACTIVE owners or REQUEST/READER anchors, and an issuance high-water advance of 65. Preserve the same-transaction prune=0 and later prune=64 then1, with retained-row counts1 then0 and all existing tests. Production SQL, deadlines, ownership guards, implementation fingerprints and the focused24-test workflow remain unchanged. Nightly formatting, scoped source checks, candidate whitespace and bidirectional patch checks pass; native execution of this new fixture remains pending.
1 parent e502ccf commit 5ff2db2

1 file changed

Lines changed: 34 additions & 7 deletions

File tree

‎src/api/router/snapshot_reader_retention_tests.rs‎

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,45 @@ async fn terminal_owner_survives_its_deferred_completion_and_prunes_in_a_later_t
189189
#[tokio::test]
190190
async fn reader_pruning_respects_the_64_owner_budget_with_a_committed_backlog() {
191191
let fixture = Fixture::new_with_pg_config(true).await;
192+
let initial = q_count(
193+
&fixture,
194+
"SELECT high_water FROM {q}.mst2_metadata_reader_issuance",
195+
)
196+
.await;
192197
let txn = transaction(&fixture).await;
193-
let mut tickets = Vec::new();
198+
// Complete each owner before admitting the next. Their terminal transaction
199+
// fence retains the entire backlog until its deferred checks have committed.
194200
for _ in 0..65 {
195-
tickets.push(admission(&txn, &fixture).await);
196-
}
197-
txn.commit().await.unwrap();
198-
let txn = transaction(&fixture).await;
199-
for ticket in &tickets {
200-
finish(&txn, ticket).await;
201+
let ticket = admission(&txn, &fixture).await;
202+
finish(&txn, &ticket).await;
201203
}
202204
assert_eq!(prune(&txn, 64).await, 0);
203205
txn.commit().await.unwrap();
206+
assert_eq!(
207+
q_count(
208+
&fixture,
209+
"SELECT count(*) FROM {q}.mst2_metadata_reader_operation WHERE state='FINISHED'"
210+
)
211+
.await,
212+
65
213+
);
214+
assert_eq!(
215+
q_count(
216+
&fixture,
217+
"SELECT count(*) FROM {q}.mst2_metadata_reader_operation WHERE state='ACTIVE'"
218+
)
219+
.await,
220+
0
221+
);
222+
assert_eq!(q_count(&fixture,"SELECT count(*) FROM {q}.mst2_metadata_root_anchor WHERE anchor_kind IN ('REQUEST','READER')").await,0);
223+
assert_eq!(
224+
q_count(
225+
&fixture,
226+
"SELECT high_water FROM {q}.mst2_metadata_reader_issuance"
227+
)
228+
.await,
229+
initial + 65
230+
);
204231
let txn = transaction(&fixture).await;
205232
assert_eq!(prune(&txn, 64).await, 64);
206233
txn.commit().await.unwrap();

0 commit comments

Comments
 (0)