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

1 Commits

Author SHA1 Message Date
Changwei Ye
b51c05200d Store v2: fix compaction skipping stable overwrites and BIG_INTENT type
All checks were successful
Test / test_enospc_imm (push) Successful in 23s
Test / test_old_enospc (push) Successful in 22s
Test / test_enospc_imm_xor (push) Successful in 29s
Test / test_old_enospc_xor (push) Successful in 24s
Test / test_old_enospc_imm (push) Successful in 22s
Test / test_old_enospc_imm_xor (push) Successful in 29s
Test / test_scrub (push) Successful in 32s
Test / test_scrub_zero_osd_2 (push) Successful in 28s
Test / test_scrub_xor (push) Successful in 28s
Test / test_scrub_pg_size_3 (push) Successful in 28s
Test / test_scrub_ec (push) Successful in 28s
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 33s
Test / test_old_scrub (push) Successful in 35s
Test / test_old_scrub_zero_osd_2 (push) Successful in 35s
Test / test_old_scrub_pg_size_3 (push) Successful in 30s
Test / test_old_scrub_xor (push) Successful in 36s
Test / test_old_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 31s
Test / test_old_scrub_ec (push) Successful in 34s
Test / test_old_partwr_csum (push) Successful in 26s
Test / test_heal_old_csum_32k_dj (push) Successful in 2m31s
Test / test_heal_old_csum_32k_dmj (push) Successful in 2m44s
Test / test_heal_old_csum_32k (push) Successful in 2m33s
Test / test_heal_old_csum_4k_dmj (push) Successful in 2m32s
Test / test_nfs_unaligned_append (push) Successful in 21s
Test / test_nfs (push) Successful in 26s
Test / test_write_encrypted (push) Successful in 35s
Test / test_nfs_long_readdir (push) Successful in 1m11s
Test / test_write_encrypted_ec (push) Successful in 37s
Test / test_heal_old_csum_4k_dj (push) Successful in 2m27s
Test / test_heal_old_csum_4k (push) Successful in 2m31s
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.
2026-09-24 17:06:20 +08:00