Skip to content

Commit 9c01e3a

Browse files
authored
chore: unlink deletes hashes asynchronously (#5773)
Signed-off-by: Roman Gershman <[email protected]>
1 parent 624fa3b commit 9c01e3a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/server/db_slice.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,11 @@ inline void TouchValuesHistogramIfNeeded(const PrimeValue& pv, base::Histogram*
329329
}
330330
}
331331

332+
inline bool MayDeleteAsynchronously(const PrimeValue& pv) {
333+
unsigned obj_type = pv.ObjType();
334+
return (obj_type == OBJ_SET || obj_type == OBJ_HASH) && pv.Encoding() == kEncodingStrMap2;
335+
}
336+
332337
} // namespace
333338

334339
#define ADD(x) (x) += o.x
@@ -1772,8 +1777,7 @@ void DbSlice::PerformDeletionAtomic(const Iterator& del_it, const ExpIterator& e
17721777
}
17731778
AccountObjectMemory(del_it.key(), pv.ObjType(), -value_heap_size, table); // Value
17741779

1775-
if (del_it->first.IsAsyncDelete() && pv.ObjType() == OBJ_SET &&
1776-
pv.Encoding() == kEncodingStrMap2) {
1780+
if (del_it->first.IsAsyncDelete() && MayDeleteAsynchronously(pv)) {
17771781
DenseSet* ds = (DenseSet*)pv.RObjPtr();
17781782
pv.SetRObjPtr(nullptr);
17791783
const size_t kClearStepSize = 512;

0 commit comments

Comments
 (0)