Skip to content

Commit b3d5fbf

Browse files
authored
[BUG] Log GC offset should be one above minimum compaction offset (#4938)
## Description of changes _Summarize the changes made by this PR._ - Improvements & Bug fixes - Adjust the minimum log offset to keep. Previously it is the minimum compaction offset (i.e. the last log offset that has been compacted) across all kept collection versions, and now it is one more than this. - New functionality - N/A ## Test plan _How are these changes tested?_ - [ ] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Documentation Changes _Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the [docs section](https://github.com/chroma-core/chroma/tree/main/docs/docs.trychroma.com)?_
1 parent cad244f commit b3d5fbf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

rust/garbage_collector/src/garbage_collector_orchestrator_v2.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ impl GarbageCollectorOrchestrator {
479479
"Expected version file to contain version history".to_string(),
480480
))?
481481
.versions;
482-
let min_log_offset = version_history
482+
let min_compaction_log_offset = version_history
483483
.iter()
484484
.find(|version_info| version_info.version == min_version_to_keep)
485485
.ok_or(GarbageCollectorError::InvariantViolation(
@@ -497,8 +497,11 @@ impl GarbageCollectorOrchestrator {
497497
"Expected log offset to be unsigned".to_string(),
498498
)
499499
})?;
500-
collections_to_garbage_collect
501-
.insert(*collection_id, LogPosition::from_offset(min_log_offset));
500+
collections_to_garbage_collect.insert(
501+
*collection_id,
502+
// The minimum offset to keep is one after the minimum compaction offset
503+
LogPosition::from_offset(min_compaction_log_offset) + 1u64,
504+
);
502505
}
503506

504507
let task = wrap(

0 commit comments

Comments
 (0)