mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
fix(cluster): crash in cluster migration (#4495)
fix crash in cluster migration Signed-off-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
parent
451da72c41
commit
d6adedb066
4 changed files with 87 additions and 4 deletions
|
@ -231,7 +231,7 @@ void RestoreStreamer::Run() {
|
|||
ThisFiber::Yield();
|
||||
last_yield = 0;
|
||||
}
|
||||
} while (cursor);
|
||||
} while (cursor && !fiber_cancelled_);
|
||||
|
||||
VLOG(1) << "RestoreStreamer finished loop of " << my_slots_.ToSlotRanges().ToString()
|
||||
<< ", shard " << db_slice_->shard_id() << ". Buckets looped " << stats_.buckets_loop;
|
||||
|
@ -302,7 +302,7 @@ bool RestoreStreamer::WriteBucket(PrimeTable::bucket_iterator it) {
|
|||
|
||||
it.SetVersion(snapshot_version_);
|
||||
string key_buffer; // we can reuse it
|
||||
for (; !it.is_done(); ++it) {
|
||||
for (it.AdvanceIfNotOccupied(); !it.is_done(); ++it) {
|
||||
const auto& pv = it->second;
|
||||
string_view key = it->first.GetSlice(&key_buffer);
|
||||
if (ShouldWrite(key)) {
|
||||
|
|
|
@ -291,11 +291,10 @@ unsigned SliceSnapshot::SerializeBucket(DbIndex db_index, PrimeTable::bucket_ite
|
|||
it.SetVersion(snapshot_version_);
|
||||
unsigned result = 0;
|
||||
|
||||
while (!it.is_done()) {
|
||||
for (it.AdvanceIfNotOccupied(); !it.is_done(); ++it) {
|
||||
++result;
|
||||
// might preempt due to big value serialization.
|
||||
SerializeEntry(db_index, it->first, it->second);
|
||||
++it;
|
||||
}
|
||||
serialize_bucket_running_ = false;
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue