Skip to content

Commit 5b15bdb

Browse files
committed
Improve error handling
1 parent 7e0b042 commit 5b15bdb

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

datafusion/execution/src/cache/cache_unit.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl DefaultFileStatisticsCache {
6464
}
6565
}
6666

67-
pub struct DefaultFileStatisticsCacheState {
67+
struct DefaultFileStatisticsCacheState {
6868
lru_queue: LruQueue<Path, CachedFileMetadata>,
6969
memory_limit: usize,
7070
memory_used: usize,
@@ -152,10 +152,17 @@ impl DefaultFileStatisticsCacheState {
152152
self.memory_used -= removed.1.heap_size();
153153
} else {
154154
// cache is empty while memory_used > memory_limit, cannot happen
155+
log::error!(
156+
"File statistics cache memory accounting bug: memory_used={} but cache is empty. \
157+
Please report this to the Apache DataFusion developers.",
158+
self.memory_used
159+
);
155160
debug_assert!(
156161
false,
157-
"This is a bug! Please report it to the Apache DataFusion developers"
162+
"memory_used={} but cache is empty",
163+
self.memory_used
158164
);
165+
self.memory_used = 0;
159166
return;
160167
}
161168
}

0 commit comments

Comments
 (0)