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

Charge blob cache usage against the global memory limit #10206

Closed
wants to merge 2 commits into from
Closed
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
Prev Previous commit
Init dummy_blobs_handle_ = nullptr
gangliao committed Jun 20, 2022
commit ff8e5ca9917058e398e550837656a4c8f0c1d3e0
7 changes: 4 additions & 3 deletions cache/cache_reservation_manager.cc
Original file line number Diff line number Diff line change
@@ -44,7 +44,8 @@ CacheReservationManagerImpl<R>::CacheReservationManagerImpl(
: delayed_decrease_(delayed_decrease),
cache_allocated_size_(0),
memory_used_(0),
blob_cache_size_(0) {
blob_cache_size_(0),
dummy_blobs_handle_(nullptr) {
assert(cache != nullptr);
cache_ = cache;
}
@@ -54,7 +55,7 @@ CacheReservationManagerImpl<R>::~CacheReservationManagerImpl() {
for (auto* handle : dummy_handles_) {
cache_->Release(handle, true);
}
if (dummy_blobs_handle_) {
if (dummy_blobs_handle_ != nullptr) {
cache_->Release(dummy_blobs_handle_, true);
}
}
@@ -96,7 +97,7 @@ Status CacheReservationManagerImpl<R>::UpdateBlobCacheReservation(
if (blob_cache != cache_) {
std::size_t new_memory_used = blob_cache->GetUsage();
if (new_memory_used != blob_cache_size_.load(std::memory_order_relaxed)) {
if (!dummy_blobs_handle_) {
if (dummy_blobs_handle_ != nullptr) {
cache_->Release(dummy_blobs_handle_, true);
}
s = cache_->Insert(GetNextCacheKey(), nullptr, new_memory_used,
2 changes: 2 additions & 0 deletions memtable/write_buffer_manager.cc
Original file line number Diff line number Diff line change
@@ -206,6 +206,8 @@ void WriteBufferManager::ReserveMemWithBlobCache(
std::lock_guard<std::mutex> lock(cache_res_mgr_mu_);
Status s = cache_res_mgr_->UpdateBlobCacheReservation(blob_cache);
s.PermitUncheckedError();
#else
(void)blob_cache;
#endif // ROCKSDB_LITE
}