M1: doc-level free list, sessions, and a spec runner that no longer overstates #1
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user