very fast at protocol indexer with flexible filtering, xrpc queries, cursor-backed event stream, and more, built on fjall

[indexer] check a whole commit before apply_commit writes any of it

apply_commit wrote each op into the batch as it went and only added the counts in finish after the loop. an op failing later in the loop (a path that doesn't parse, a bad action, a block missing from the car or not hashing to its cid) returned before finish, and the shard commits its batch even when an apply fails, both in the drain and on the live path. so the earlier ops' records and events landed with no count. a refetch later sees those records as unchanged, so the global records counter stayed off for good. apply_commit now checks every op it will write first, hashing each block once there, and only then writes them. what can still fail after the first write is the database itself.


Author ptr.pet
Date Commit Parent 6dc4fdd3
+128 -26
4 changed files
+128 -26
4 changed files