mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +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;
|
return;
|
||||||
|
|
||||||
cursor = pt->Traverse(cursor, absl::bind_front(&RestoreStreamer::WriteBucket, this));
|
cursor = pt->Traverse(cursor, absl::bind_front(&RestoreStreamer::WriteBucket, this));
|
||||||
|
++last_yield;
|
||||||
|
|
||||||
if (last_yield >= 100) {
|
if (last_yield >= 100) {
|
||||||
ThisFiber::Yield();
|
ThisFiber::Yield();
|
||||||
|
@ -111,6 +112,9 @@ void RestoreStreamer::WriteBucket(PrimeTable::bucket_iterator it) {
|
||||||
DCHECK_LT(it.GetVersion(), snapshot_version_);
|
DCHECK_LT(it.GetVersion(), snapshot_version_);
|
||||||
it.SetVersion(snapshot_version_);
|
it.SetVersion(snapshot_version_);
|
||||||
|
|
||||||
|
{
|
||||||
|
FiberAtomicGuard fg; // Can't switch fibers because that could invalidate iterator
|
||||||
|
|
||||||
while (!it.is_done()) {
|
while (!it.is_done()) {
|
||||||
const auto& pv = it->second;
|
const auto& pv = it->second;
|
||||||
|
|
||||||
|
@ -127,6 +131,9 @@ void RestoreStreamer::WriteBucket(PrimeTable::bucket_iterator it) {
|
||||||
|
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NotifyWritten(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestoreStreamer::OnDbChange(DbIndex db_index, const DbSlice::ChangeReq& req) {
|
void RestoreStreamer::OnDbChange(DbIndex db_index, const DbSlice::ChangeReq& req) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue