Skip to content

Commit 915a24b

Browse files
authored
[ENH] Do not trace failed preconditions when flushing compaction. (#5155)
## Description of changes The soft-deleted compaction will return an error that's not distinguishable from other errors. It will percolate to the dispatcher and be logged like every other error. In #5064, we added a should_trace_error function on the chroma Error trait, which will silence the error at the dispatcher. This PR applies that annotation to the failed precondition. ## Test plan CI ## Migration plan N/A ## Observability plan We get paged today. We don't get paged in the future. ## Documentation Changes N/A
1 parent 089af4a commit 915a24b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

rust/sysdb/src/sysdb.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,13 +1431,25 @@ pub enum FlushCompactionError {
14311431
impl ChromaError for FlushCompactionError {
14321432
fn code(&self) -> ErrorCodes {
14331433
match self {
1434-
FlushCompactionError::FailedToFlushCompaction(_) => ErrorCodes::Internal,
1434+
FlushCompactionError::FailedToFlushCompaction(status) => {
1435+
if std::convert::Into::<chroma_error::ErrorCodes>::into(status.code())
1436+
== ErrorCodes::FailedPrecondition
1437+
{
1438+
ErrorCodes::FailedPrecondition
1439+
} else {
1440+
ErrorCodes::Internal
1441+
}
1442+
}
14351443
FlushCompactionError::SegmentFlushInfoConversionError(_) => ErrorCodes::Internal,
14361444
FlushCompactionError::FlushCompactionResponseConversionError(_) => ErrorCodes::Internal,
14371445
FlushCompactionError::CollectionNotFound => ErrorCodes::Internal,
14381446
FlushCompactionError::SegmentNotFound => ErrorCodes::Internal,
14391447
}
14401448
}
1449+
1450+
fn should_trace_error(&self) -> bool {
1451+
self.code() == ErrorCodes::Internal
1452+
}
14411453
}
14421454

14431455
#[derive(Error, Debug)]

0 commit comments

Comments
 (0)