mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 02:15:45 +02:00
chore: add db_slice lock to protect segments from preemptions (#3406)
DastTable::Traverse is error prone when the callback passed preempts because the segment might change. This is problematic and we need atomicity while traversing segments with preemption. The fix is to add Traverse in DbSlice and protect the traversal via ThreadLocalMutex. * add ConditionFlag to DbSlice * add Traverse in DbSlice and protect it with the ConditionFlag * remove condition flag from snapshot * remove condition flag from streamer --------- Signed-off-by: kostas <kostas@dragonflydb.io>
This commit is contained in:
parent
f536f8afbd
commit
aa02070e3d
13 changed files with 65 additions and 71 deletions
|
@ -317,7 +317,7 @@ bool EngineShard::DoDefrag() {
|
|||
uint64_t attempts = 0;
|
||||
|
||||
do {
|
||||
cur = prime_table->Traverse(cur, [&](PrimeIterator it) {
|
||||
cur = slice.Traverse(prime_table, cur, [&](PrimeIterator it) {
|
||||
// for each value check whether we should move it because it
|
||||
// seats on underutilized page of memory, and if so, do it.
|
||||
bool did = it->second.DefragIfNeeded(threshold);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue