From 946e3f989fbe9bf92fc70f7459691debffe727e2 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Tue, 4 May 2021 00:22:34 +0000 Subject: [PATCH 1/2] Use a deterministic iteration order for committing in the special key space --- fdbclient/SpecialKeySpace.actor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fdbclient/SpecialKeySpace.actor.cpp b/fdbclient/SpecialKeySpace.actor.cpp index 9eb8e3aacb..545755c44b 100644 --- a/fdbclient/SpecialKeySpace.actor.cpp +++ b/fdbclient/SpecialKeySpace.actor.cpp @@ -572,16 +572,16 @@ ACTOR Future commitActor(SpecialKeySpace* sks, ReadYourWritesTransaction* state RangeMap>, KeyRangeRef>::Ranges ranges = ryw->getSpecialKeySpaceWriteMap().containedRanges(specialKeys); state RangeMap>, KeyRangeRef>::iterator iter = ranges.begin(); - state std::set writeModulePtrs; + state std::vector writeModulePtrs; while (iter != ranges.end()) { std::pair> entry = iter->value(); if (entry.first) { auto modulePtr = sks->getRWImpls().rangeContaining(iter->begin())->value(); - writeModulePtrs.insert(modulePtr); + writeModulePtrs.push_back(modulePtr); } ++iter; } - state std::set::const_iterator it; + state std::vector::const_iterator it; for (it = writeModulePtrs.begin(); it != writeModulePtrs.end(); ++it) { Optional msg = wait((*it)->commit(ryw)); if (msg.present()) { From ed464d3514867f248ccf35e34e1b416f2b33c9e2 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Tue, 4 May 2021 15:24:31 +0000 Subject: [PATCH 2/2] Deduplicate --- fdbclient/SpecialKeySpace.actor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fdbclient/SpecialKeySpace.actor.cpp b/fdbclient/SpecialKeySpace.actor.cpp index 545755c44b..5d24fa4c98 100644 --- a/fdbclient/SpecialKeySpace.actor.cpp +++ b/fdbclient/SpecialKeySpace.actor.cpp @@ -573,11 +573,15 @@ ACTOR Future commitActor(SpecialKeySpace* sks, ReadYourWritesTransaction* ryw->getSpecialKeySpaceWriteMap().containedRanges(specialKeys); state RangeMap>, KeyRangeRef>::iterator iter = ranges.begin(); state std::vector writeModulePtrs; + std::unordered_set deduplicate; while (iter != ranges.end()) { std::pair> entry = iter->value(); if (entry.first) { auto modulePtr = sks->getRWImpls().rangeContaining(iter->begin())->value(); - writeModulePtrs.push_back(modulePtr); + auto [_, inserted] = deduplicate.insert(modulePtr); + if (inserted) { + writeModulePtrs.push_back(modulePtr); + } } ++iter; }