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

Fix wraparound in SstFileManager #13010

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
2 changes: 1 addition & 1 deletion file/sst_file_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ void SstFileManagerImpl::OnCompactionCompletion(Compaction* c) {
size_added_by_compaction += filemeta->fd.GetFileSize();
}
}
assert(cur_compactions_reserved_size_ >= size_added_by_compaction);
cur_compactions_reserved_size_ -= size_added_by_compaction;
}

Expand Down Expand Up @@ -450,7 +451,6 @@ void SstFileManagerImpl::OnAddFileImpl(const std::string& file_path,
// File was added before, we will just update the size
total_files_size_ -= tracked_file->second;
total_files_size_ += file_size;
cur_compactions_reserved_size_ -= file_size;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this seems appropriate to me. I can't think of any reason why we'd want to decrement cur_compactions_reserved_size_ here. We would come down this path only in a non-compaction case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for spending time to help check this!

} else {
total_files_size_ += file_size;
}
Expand Down
Loading