M1: doc-level free list, sessions, and a spec runner that no longer overstates #1

Merged
dev merged 37 commits from m1-cursors into main 2026-08-09 16:15:34 +00:00
Showing only changes of commit f8a39a0965 - Show all commits

View File

@@ -1670,6 +1670,14 @@ pub const Engine = struct {
var coll_it = colls.iterator(); var coll_it = colls.iterator();
while (coll_it.next()) |ce| { while (coll_it.next()) |ce| {
const coll = ce.value_ptr.*; const coll = ce.value_ptr.*;
// Everything below this line is written by a collection's own
// writer under its own lock, and `slab_extents` is an ArrayList
// that `slab_reserve` appends to -- so reading it under only the
// shared catalog lock could walk a slice a concurrent append had
// already reallocated. Lock order is catalog then collection,
// the same order `compact` uses.
try coll.lock.lockShared(self.io);
defer coll.lock.unlockShared(self.io);
try put_bytes(gpa, out, ce.key_ptr.*); try put_bytes(gpa, out, ce.key_ptr.*);
try put_u64(gpa, out, coll.slab_tail); try put_u64(gpa, out, coll.slab_tail);
try put_u64(gpa, out, coll.slab_end); try put_u64(gpa, out, coll.slab_end);