chore: tiering - make Modify work with cool storage (#3395)

1. Fully support tiered_experimental_cooling for all operations
2. Offset cool storage usage when computing memory pressure situations in Hearbeat.
3. Introduce realtime entry counting per db_slice and provide DCHECK to verify it vs the old approach.
   Later we will switch to realtime entry and free memory computations when computing bytes per object,
   and remove the old approach in CacheStats().
4. Show hit rate during the run of dfly_bench loadtest.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2024-07-27 14:31:29 +03:00 committed by GitHub
parent 9d16bd6f6e
commit 6b67f44e29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 95 additions and 45 deletions

View file

@ -391,7 +391,6 @@ class DbSlice {
// Returns existing keys count in the db.
size_t DbSize(DbIndex db_ind) const;
// Callback functions called upon writing to the existing key.
DbTableStats* MutableStats(DbIndex db_ind) {
return &db_arr_[db_ind]->stats;
}
@ -417,6 +416,10 @@ class DbSlice {
return table_memory_;
}
size_t entries_count() const {
return entries_count_;
}
using ChangeCallback = std::function<void(DbIndex, const ChangeReq&)>;
//! Registers the callback to be called for each change.
@ -567,6 +570,7 @@ class DbSlice {
size_t bytes_per_object_ = 0;
size_t soft_budget_limit_ = 0;
size_t table_memory_ = 0;
uint64_t entries_count_ = 0;
mutable SliceEvents events_; // we may change this even for const operations.