mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 02:15:45 +02:00
fix(RestoreStreamer): Fix a few glitches (#2452)
This commit is contained in:
parent
07a6dc0712
commit
7debe3c685
1 changed files with 19 additions and 12 deletions
|
@ -76,6 +76,7 @@ void RestoreStreamer::Start(io::Sink* dest) {
|
|||
return;
|
||||
|
||||
cursor = pt->Traverse(cursor, absl::bind_front(&RestoreStreamer::WriteBucket, this));
|
||||
++last_yield;
|
||||
|
||||
if (last_yield >= 100) {
|
||||
ThisFiber::Yield();
|
||||
|
@ -111,6 +112,9 @@ void RestoreStreamer::WriteBucket(PrimeTable::bucket_iterator it) {
|
|||
DCHECK_LT(it.GetVersion(), snapshot_version_);
|
||||
it.SetVersion(snapshot_version_);
|
||||
|
||||
{
|
||||
FiberAtomicGuard fg; // Can't switch fibers because that could invalidate iterator
|
||||
|
||||
while (!it.is_done()) {
|
||||
const auto& pv = it->second;
|
||||
|
||||
|
@ -129,6 +133,9 @@ void RestoreStreamer::WriteBucket(PrimeTable::bucket_iterator it) {
|
|||
}
|
||||
}
|
||||
|
||||
NotifyWritten(true);
|
||||
}
|
||||
|
||||
void RestoreStreamer::OnDbChange(DbIndex db_index, const DbSlice::ChangeReq& req) {
|
||||
DCHECK_EQ(db_index, 0) << "Restore migration only allowed in cluster mode in db0";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue