Skip to content

Commit

Permalink
BugFix: fix merge helper clock usage and rehack LoadTableHandlers (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewvon authored Jul 6, 2021
1 parent d20dd13 commit c5f66de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 3 additions & 1 deletion db/merge_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@ CompactionFilter::Decision MergeHelper::FilterMerge(const Slice& user_key,
kValueTypeForSeek);
}
}
total_filter_time_ += filter_timer_.ElapsedNanosSafe();
if (stats_ != nullptr && ShouldReportDetailedTime(env_, stats_)) {
total_filter_time_ += filter_timer_.ElapsedNanosSafe();
}
return ret;
}

Expand Down
19 changes: 12 additions & 7 deletions db/version_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,11 @@ class VersionBuilder::Rep {
size_t table_cache_capacity = table_cache_->get_cache()->GetCapacity();
bool always_load = (table_cache_capacity == TableCache::kInfiniteCapacity);
size_t max_load = port::kMaxSizet;
#ifndef NDEBUG
bool debug_override = true; // to enable CompactedDB related tests and some property tests
#else
bool debug_override = false;
#endif

if (!always_load) {
// If it is initial loading and not set to always loading all the
Expand Down Expand Up @@ -976,16 +981,16 @@ class VersionBuilder::Rep {
// The issue is that number 2 creates permanent objects in the
// table cache which over time are no longer useful. The code
// adjustment below keeps #1 and disables #2.
#if 0
if (file_meta->table_reader_handle != nullptr) {
// Load table_reader
file_meta->fd.table_reader = table_cache_->GetTableReaderFromHandle(
file_meta->table_reader_handle);
if (always_load || debug_override) {
file_meta->fd.table_reader = table_cache_->GetTableReaderFromHandle(
file_meta->table_reader_handle);
} else {
table_cache_->ReleaseHandle(file_meta->table_reader_handle);
file_meta->table_reader_handle = nullptr;
} // else
}
#else
table_cache_->ReleaseHandle(file_meta->table_reader_handle);
file_meta->table_reader_handle = nullptr;
#endif

}
});
Expand Down

0 comments on commit c5f66de

Please sign in to comment.