Skip to content

Commit e46b4a2

Browse files
authored
[ENH] Robustly handle errors on the compaction path of the log. (#4677)
## Description of changes One path is timing out in staging. Add tolerance for that and some debugging. ## Test plan Compiles - [x] 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 3b76d4d commit e46b4a2

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

rust/log/src/grpc_log.rs

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ impl GrpcLog {
554554
min_compaction_size: u64,
555555
) -> Result<Vec<CollectionInfo>, GrpcGetCollectionsWithNewDataError> {
556556
let mut combined_response = Vec::new();
557+
let mut error = None;
557558

558559
if use_alt_log {
559560
// Iterate over all alt clients and gather collections
@@ -567,14 +568,25 @@ impl GrpcLog {
567568
}
568569
for mut alt_client in all_alt_clients.drain(..) {
569570
// We error if any subrequest errors
570-
let response = alt_client
571+
match alt_client
571572
.get_all_collection_info_to_compact(
572573
chroma_proto::GetAllCollectionInfoToCompactRequest {
573574
min_compaction_size,
574575
},
575576
)
576-
.await?;
577-
combined_response.push(response.into_inner());
577+
.await
578+
{
579+
Ok(response) => {
580+
combined_response.push(response.into_inner());
581+
}
582+
Err(err) => {
583+
tracing::error!("could not get all collection info to compact: {err}");
584+
if error.is_none() {
585+
error = Some(err);
586+
}
587+
continue;
588+
}
589+
};
578590
}
579591
} else {
580592
tracing::warn!(
@@ -583,17 +595,33 @@ impl GrpcLog {
583595
return Ok(vec![]);
584596
}
585597
} else {
586-
let response = self
598+
match self
587599
.client
588600
.get_all_collection_info_to_compact(
589601
chroma_proto::GetAllCollectionInfoToCompactRequest {
590602
min_compaction_size,
591603
},
592604
)
593-
.await?;
594-
combined_response.push(response.into_inner());
605+
.await
606+
{
607+
Ok(response) => {
608+
combined_response.push(response.into_inner());
609+
}
610+
Err(err) => {
611+
tracing::error!("could not get all collection info to compact: {err}");
612+
if error.is_none() {
613+
error = Some(err);
614+
}
615+
}
616+
};
595617
};
596618

619+
if let Some(status) = error {
620+
if combined_response.is_empty() {
621+
return Err(status.into());
622+
}
623+
}
624+
597625
let mut all_collections = Vec::new();
598626
for response in combined_response {
599627
let collections = response.all_collection_info;

0 commit comments

Comments
 (0)