mirror of
https://github.com/versity/scoutfs.git
synced 2026-02-07 19:20:44 +00:00
The refactoring of compaction to use the skip lists changed the nature of item insertion. Previously it would precisely count the number of items to insert. Now it discovers that the current output segment is full by having _append_item() return false. In this case the cursors currently point to the item that would have been inserted but failed. compact_items() caller loops around to allocate the next segment. Then it calls compact_items() again and it mistakenly advances *past* the current item that still needed to be inserted. Hiding next_item() away from the segment loop made it hard to see this mechanism. Let's drop the compact_items() function and bring item iteration and item appending into the main loop so we can more carefully advance or not as we write and allocate new segments. This stops losing items at segment boundaries. Signed-off-by: Zach Brown <zab@versity.com>