mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
chore: more debug checks around tiered storage (#3277)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
765be950af
commit
ac328e1516
2 changed files with 8 additions and 0 deletions
|
@ -275,6 +275,9 @@ bool TieredStorage::TryStash(DbIndex dbid, string_view key, PrimeValue* value) {
|
|||
if (!ShouldStash(*value))
|
||||
return false;
|
||||
|
||||
// This invariant should always hold because ShouldStash tests for IoPending flag.
|
||||
CHECK(!bins_->IsPending(dbid, key));
|
||||
|
||||
// TODO: When we are low on memory we should introduce a back-pressure, to avoid OOMs
|
||||
// with a lot of underutilized disk space.
|
||||
if (op_manager_->GetStats().pending_stash_cnt >= write_depth_limit_) {
|
||||
|
|
|
@ -43,6 +43,11 @@ class SmallBins {
|
|||
// List of item key db indices and hashes
|
||||
using KeyHashDbList = std::vector<std::tuple<DbIndex, uint64_t /* hash */, DiskSegment>>;
|
||||
|
||||
// Returns true if the entry is pending inside SmallBins.
|
||||
bool IsPending(DbIndex dbid, std::string_view key) const {
|
||||
return current_bin_.count({dbid, std::string(key)}) > 0;
|
||||
}
|
||||
|
||||
// Enqueue key/value pair for stash. Returns page to be stashed if it filled up.
|
||||
std::optional<FilledBin> Stash(DbIndex dbid, std::string_view key, std::string_view value);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue