fix(RestoreStreamer): Fix a few glitches (#2452)

This commit is contained in:
Shahar Mike 2024-01-22 10:37:16 +02:00 committed by GitHub
parent 07a6dc0712
commit 7debe3c685
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
@ -127,6 +131,9 @@ void RestoreStreamer::WriteBucket(PrimeTable::bucket_iterator it) {
++it;
}
}
NotifyWritten(true);
}
void RestoreStreamer::OnDbChange(DbIndex db_index, const DbSlice::ChangeReq& req) {