scoutfs: preserve sticky deletion items

We limit the number of lower segments that a compaction will read.  A
sticky compaction happens when the upper segment overlaps more lower
segments.  The remaining items in the upper segment are written back to
the upper level -- they're stuck.  A future compaction will attempt to
compact the remaining items with the next set of overlapping lower
segments.

Deletion items are rightly discarded as they're compacted to the lowest
level -- at that point they have no more matching items in lower
segments to destroy and are done.

Deletion items were being dropped instead of being written back into the
upper level of a sticky compaction.  The test for discarding the
deletion items only considered the lowest level of the compaction, not
the level that the items were being written to.  We need to be careful
to preserve the deletion items in the case of compaction to the lowest
level writing sticky items back to the upper segment.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2018-06-29 14:42:06 -07:00
committed by Zach Brown
parent 5f0c87970c
commit 345721c933
+4
View File
@@ -250,8 +250,12 @@ retry:
* all the duplicate items that they find. When we're
* compacting to the last level we can remove them by retrying
* the search after we've advanced past them.
*
* If we're filling the remaining items in a sticky merge into
* the upper level then we have to preserve the deletion items.
*/
if ((curs->lower_level == curs->last_level) &&
(!curs->sticky || lower) &&
((*item_flags) & SCOUTFS_ITEM_FLAG_DELETION))
goto retry;