LEASE_CAPTURE_ONLY: group leases of the corpus windows' ranges only
Test and deploy / test (push) Successful in 1m6s
Test and deploy / edge (push) Successful in 2m44s
Test and deploy / deploy (push) Skipped

The lease bounds alone don't select a window: the history planner's oldest
buckets are priority 0-2 as well, so the window worker at 0..0 also took 2026
history at 0 (25k ranges in 40 groups, fetched live) while 1,739 ranges of the
2016 corpus window sat at voyager 2's leftover priorities (done when the window
was marked, planned again by the reset). With LEASE_CAPTURE_ONLY the lease, next
and the prefetcher's run-ahead take capture ranges only; the run-ahead now also
keeps to the lease bounds. Test: a group with history at 0 only isn't leased,
the history range after the window isn't handed out.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Daan MeijerandClaude Fable 5.1 committed 2026-10-26 23:26:31 +01:00
1 parent 29e0cc8f6e
commit 4af5e06400
6 files changed
+106 -19

No files matched your search

+26
View File
@@ -133,6 +133,32 @@ test.group('Group leases', (g) => {
assert.equal((await GroupLeases.next(a, n1))?.range.id, r4)
})
test('capture only: the history ranges sharing a window priority are neither leased nor handed out', async ({
assert,
}) => {
// Group e: history at priority 0 only (the planner's oldest bucket); group f: a 2016 window range (capture)
// between two history ranges at 0.
const e = await group('alt.binaries.gl.e', 1)
await range(e, 1, 0)
const f = await group('alt.binaries.gl.f', 2)
await range(f, 1, 0)
const f2 = await range(f, 101, 0, { capture: true })
await range(f, 201, 0)
const n1 = await node('gl-8')
const was = coordinatorConfig.leaseCaptureOnly
coordinatorConfig.leaseCaptureOnly = true
try {
assert.equal((await GroupLeases.lease(n1))?.group.id, f, 'the group with a capture range, not the older one')
assert.equal((await GroupLeases.next(f, n1))?.range.id, f2)
await db.from('ranges').where('id', f2).update({ status: 'done', next_id: 201 })
assert.isNull(await GroupLeases.next(f, n1), 'the history range after the window is not handed out')
assert.isNull(await GroupLeases.lease(await node('gl-9')))
} finally {
coordinatorConfig.leaseCaptureOnly = was
}
assert.equal((await GroupLeases.lease(await node('gl-10')))?.group.id, e, 'any range again without the flag')
})
test('a snapshot older than a done range makes that range be read again from its start', async ({ assert }) => {
const a = await group('alt.binaries.gl.d', 1)
const r1 = await range(a, 1, 0)