Repository navigation
lib/db: Keep metadata better in sync (ref #6335) - #6337
Conversation
This adds metadata updates to the same write batch as the underlying file change. The odds of a metadata update going missing is greatly reduced. Bonus change: actually commit the transaction in recalcMeta.
|
That's a bit wasteful, as in a batch of 1000 items (the amount we use in model) we do 1000 writes to the db on the meta key, but only the last one is actually effective (at least that's how I understand goleveldb's Maybe it's a non-issue, but if there is a noticeable performance impact, I'd just rely on #6336 cleaning up afterwards. |
|
Yes that's stupid, this is better. For large batches we may still get Checkpoint() writes without metadata, for reasonably small batches it will just be included in the same batch. We can still crash in the middle of a batch of course, but reduces the window from previous. |
|
This does in fact trigger the recalc about as often as we did previously. Would it be over engineering it to add a "pre-flush" hook to Checkpoint() so that we could say and have that only run on actual checkpoints? |
|
I like the interface :) @AudriusButkevicius Wanna give a comment on your favorite topic: database-stuff™ ;) |
|
The cost is actually fairly high, on the order of 45 minutes to an hour in some setups. It just hopefully shouldn't kick in that often, and there is also a cost to doing a thousand unnecessary writes. |
This adds metadata updates to the same write batch as the underlying
file change. The odds of a metadata update going missing is greatly
reduced.
Bonus change: actually commit the transaction in recalcMeta.
This now makes the previous recovery thing not kick in during my stress testing...