Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop on shard_file_manager issues warning in debug mode instead of error. #128

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions mdb_shard/src/shard_file_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,11 @@ struct MDBShardFlushGuard {

impl Drop for MDBShardFlushGuard {
fn drop(&mut self) {
if self.shard.is_empty() {
return;
}

if let Some(sd) = &self.session_directory {
// Check if the flushing directory exists.
if !sd.is_dir() {
error!("Error flushing reconstruction data on shutdown: {sd:?} is not a directory or doesn't exist");
return;
if !self.shard.is_empty() {
// This is only supposed to happen on task cancellations, so we should
if cfg!(debug_assertions) {
eprintln!("[Debug] Warning: Shard dropped while data still present! This is an error outside of task cancellation.");
}

self.flush().unwrap_or_else(|e| {
error!("Error flushing reconstruction data on shutdown: {e:?}");
None
});
}
}
}
Expand Down
Loading