mirror of
https://github.com/rustmailer/bichon.git
synced 2026-08-03 07:48:34 +02:00
fix(blob): invalidate FilePool after GC to prevent stale reads
This commit is contained in:
@@ -299,6 +299,14 @@ impl Engine {
|
||||
|
||||
let result = gc::gc_account(&account_dir, self.config.gc_deleted_ratio)?;
|
||||
|
||||
// Invalidate FilePool for GC'd segments (they were rewritten via rename)
|
||||
if let Some(ref stats) = result {
|
||||
let accounts = self.accounts.read().unwrap();
|
||||
if let Some(handle) = accounts.get(account_id) {
|
||||
handle.invalidate_file_cache(stats.segment_id);
|
||||
}
|
||||
}
|
||||
|
||||
for bid in 0..crate::types::BUCKET_COUNT {
|
||||
self.cache.invalidate(account_id, bid);
|
||||
}
|
||||
|
||||
@@ -273,7 +273,6 @@ impl SegmentReader {
|
||||
/// Read a single entry at the given offset using a pre-opened File (via Mutex).
|
||||
/// This avoids the per-read File::open cost for hot segments.
|
||||
pub fn read_entry_at_file(&self, offset: u64, file: &Mutex<File>) -> Result<(Entry, u64)> {
|
||||
use std::io::{Read, Seek, SeekFrom};
|
||||
|
||||
let mut file = file.lock().unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user