Skip to content

[ENH] Limit maximum number of collection for single GC #4229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion rust/garbage_collector/src/garbage_collector_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ impl Handler<GarbageCollectMessage> for GarbageCollector {
tracing::info!("Getting collections to gc");
let collections_to_gc = self
.sysdb_client
.get_collections_to_gc()
.get_collections_to_gc(
Some(self.relative_cutoff_time.as_secs()),
Some(self.max_collections_to_gc.into()),
)
.await
.expect("Failed to get collections to gc");
tracing::info!("Got {} collections to gc", collections_to_gc.len());
Expand Down
6 changes: 3 additions & 3 deletions rust/garbage_collector/src/garbage_collector_orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ mod tests {
.unwrap();

// Get collection info for GC from sysdb
let collections_to_gc = sysdb.get_collections_to_gc().await.unwrap();
let collections_to_gc = sysdb.get_collections_to_gc(None, None).await.unwrap();
let collection_info = collections_to_gc
.iter()
.find(|c| c.id == collection_id)
Expand Down Expand Up @@ -994,7 +994,7 @@ mod tests {
.unwrap();

// Get collection info for GC from sysdb
let collections_to_gc = sysdb.get_collections_to_gc().await.unwrap();
let collections_to_gc = sysdb.get_collections_to_gc(None, None).await.unwrap();
let collection_info = collections_to_gc
.iter()
.find(|c| c.id == collection_id)
Expand Down Expand Up @@ -1152,7 +1152,7 @@ mod tests {
.unwrap();

// Get collection info for GC from sysdb
let collections_to_gc = sysdb.get_collections_to_gc().await.unwrap();
let collections_to_gc = sysdb.get_collections_to_gc(None, None).await.unwrap();
let collection_info = collections_to_gc
.iter()
.find(|c| c.id == collection_id)
Expand Down
12 changes: 8 additions & 4 deletions rust/sysdb/src/sysdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,12 @@ impl SysDb {

pub async fn get_collections_to_gc(
&mut self,
cutoff_time_secs: Option<u64>,
limit: Option<u64>,
) -> Result<Vec<CollectionToGcInfo>, GetCollectionsToGcError> {
match self {
SysDb::Grpc(grpc) => grpc.get_collections_to_gc().await,
SysDb::Sqlite(_) => todo!(),
SysDb::Grpc(grpc) => grpc.get_collections_to_gc(cutoff_time_secs, limit).await,
SysDb::Sqlite(_) => unimplemented!("Garbage collection does not work for local chroma"),
SysDb::Test(_) => todo!(),
}
}
Expand Down Expand Up @@ -892,12 +894,14 @@ impl GrpcSysDb {

pub async fn get_collections_to_gc(
&mut self,
cutoff_time_secs: Option<u64>,
limit: Option<u64>,
) -> Result<Vec<CollectionToGcInfo>, GetCollectionsToGcError> {
let res = self
.client
.list_collections_to_gc(chroma_proto::ListCollectionsToGcRequest {
cutoff_time_secs: None,
limit: None,
cutoff_time_secs,
limit,
})
.await;

Expand Down
2 changes: 1 addition & 1 deletion rust/worker/src/execution/orchestration/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ impl CompactOrchestrator {
) {
self.state = ExecutionState::MaterializeApplyCommitFlush;

// NOTE: We allow writers no be uninitialized for the case when the materialized logs are empty
// NOTE: We allow writers to be uninitialized for the case when the materialized logs are empty
let record_reader = self
.get_segment_writers()
.ok()
Expand Down
Loading