Store v2: fix compaction skipping stable overwrites and BIG_INTENT type #88

Merged
vitalif merged 1 commits from changwei.ye/vitastor:fix-iterate-compaction into master 2026-09-24 15:57:03 +03:00
Contributor

Description

We MUST postpone if the overwrite is STABLE (even if under pressure),
because add_compact will reject STABLE overwrites with EBUSY.

Contributor Name

Changwei Ye (Datatom, https://www.datatom.com/)

CLA

### Description We MUST postpone if the overwrite is STABLE (even if under pressure), because add_compact will reject STABLE overwrites with EBUSY. ### Contributor Name Changwei Ye (Datatom, https://www.datatom.com/) ### CLA - [x] I accept Vitastor CLA agreement: https://git.yourcmc.ru/vitalif/vitastor/src/branch/master/CLA-en.md
changwei.ye added 1 commit 2026-09-24 09:34:21 +03:00
The original compaction condition only postponed compaction when not under
pressure, and only for BIG_WRITE and DELETE types:
  if (!under_pressure && (BIG_WRITE || DELETE))
This had two bugs:
1. BIG_INTENT overwrites were not included, causing add_compact() to be
   called on BIG_INTENT entries. add_compact() unconditionally rejects
   any stable overwrite with EBUSY, leading to unnecessary retry loops.
2. When under pressure, stable overwrites (BIG_WRITE, BIG_INTENT, DELETE
   with BS_HEAP_STABLE set) were not skipped. add_compact() rejects stable
   overwrites with EBUSY regardless of pressure, so attempting to compact
   them under pressure also always fails.
Fix: change the condition to:
  if ((!under_pressure || stable) && (BIG_WRITE || BIG_INTENT || DELETE))
When under pressure with an unstable overwrite, we now fall through to
`continue`, skipping it and scanning older entries (SMALL_WRITE /
INTENT_WRITE) that can actually be compacted to reclaim space.
changwei.ye requested review from vitalif 2026-09-24 09:34:22 +03:00
changwei.ye force-pushed fix-iterate-compaction from 2757e82826 to b51c05200d 2026-09-24 12:06:50 +03:00 Compare
vitalif merged commit b51c05200d into master 2026-09-24 15:57:03 +03:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vitalif/vitastor#88
No description provided.