(&mut self)
| 148 | } |
| 149 | |
| 150 | fn evict_entries(&mut self) { |
| 151 | while self.memory_used > self.memory_limit { |
| 152 | if let Some(removed) = self.lru_queue.pop() { |
| 153 | let mut ctx = DFHeapSizeCtx::default(); |
| 154 | self.memory_used -= removed.0.heap_size(&mut ctx); |
| 155 | self.memory_used -= removed.1.heap_size(&mut ctx); |
| 156 | } else { |
| 157 | // cache is empty while memory_used > memory_limit, cannot happen |
| 158 | log::error!( |
| 159 | "File statistics cache memory accounting bug: memory_used={} but cache is empty. \ |
| 160 | Please report this to the Apache DataFusion developers.", |
| 161 | self.memory_used |
| 162 | ); |
| 163 | debug_assert!( |
| 164 | false, |
| 165 | "memory_used={} but cache is empty", |
| 166 | self.memory_used |
| 167 | ); |
| 168 | self.memory_used = 0; |
| 169 | return; |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | } |
| 174 | impl CacheAccessor<TableScopedPath, CachedFileMetadata> for DefaultFileStatisticsCache { |
| 175 | fn get(&self, key: &TableScopedPath) -> Option<CachedFileMetadata> { |
no test coverage detected