cleanup: Remove unused PerformDeletion() overloads (#2418)

This commit is contained in:
Shahar Mike 2024-01-15 13:15:35 +02:00 committed by GitHub
parent 078db5caae
commit f4c1e33d48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,70 +60,6 @@ void AccountObjectMemory(string_view key, unsigned type, int64_t size, DbTable*
}
}
void PerformDeletion(PrimeIterator del_it, ExpireIterator exp_it, EngineShard* shard,
DbTable* table) {
if (!exp_it.is_done()) {
table->expire.Erase(exp_it);
}
if (del_it->second.HasFlag()) {
if (table->mcflag.Erase(del_it->first) == 0) {
LOG(ERROR) << "Internal error, inconsistent state, mcflag should be present but not found "
<< del_it->first.ToString();
}
}
DbTableStats& stats = table->stats;
const PrimeValue& pv = del_it->second;
if (pv.IsExternal()) {
auto [offset, size] = pv.GetExternalSlice();
stats.tiered_entries--;
stats.tiered_size -= size;
TieredStorage* tiered = shard->tiered_storage();
tiered->Free(offset, size);
}
if (pv.HasIoPending()) {
TieredStorage* tiered = shard->tiered_storage();
tiered->CancelIo(table->index, del_it);
}
stats.inline_keys -= del_it->first.IsInline();
{
string tmp;
string_view key = del_it->first.GetSlice(&tmp);
AccountObjectMemory(key, del_it->first.ObjType(), -del_it->first.MallocUsed(), table); // Key
AccountObjectMemory(key, del_it->second.ObjType(), -del_it->second.MallocUsed(),
table); // Value
}
if (pv.ObjType() == OBJ_HASH && pv.Encoding() == kEncodingListPack) {
--stats.listpack_blob_cnt;
} else if (pv.ObjType() == OBJ_ZSET && pv.Encoding() == OBJ_ENCODING_LISTPACK) {
--stats.listpack_blob_cnt;
}
if (ClusterConfig::IsEnabled()) {
string tmp;
string_view key = del_it->first.GetSlice(&tmp);
SlotId sid = ClusterConfig::KeySlot(key);
table->slots_stats[sid].key_count -= 1;
}
table->prime.Erase(del_it);
}
inline void PerformDeletion(PrimeIterator del_it, EngineShard* shard, DbTable* table) {
ExpireIterator exp_it;
if (del_it->second.HasExpire()) {
exp_it = table->expire.Find(del_it->first);
DCHECK(!exp_it.is_done());
}
PerformDeletion(del_it, exp_it, shard, table);
};
class PrimeEvictionPolicy {
public:
static constexpr bool can_evict = true; // we implement eviction functionality.