Fix rollback

rel-0.5
Vitaliy Filippov 2021-03-25 02:35:17 +03:00
parent 06f4978085
commit 18a5fafa2a
1 changed files with 10 additions and 13 deletions

View File

@ -163,10 +163,7 @@ void blockstore_impl_t::mark_rolled_back(const obj_ver_id & ov)
auto rm_start = it; auto rm_start = it;
auto rm_end = it; auto rm_end = it;
it--; it--;
while (it->first.oid == ov.oid && while (1)
it->first.version > ov.version &&
!IS_IN_FLIGHT(it->second.state) &&
!IS_STABLE(it->second.state))
{ {
if (it->first.oid != ov.oid) if (it->first.oid != ov.oid)
break; break;
@ -176,7 +173,7 @@ void blockstore_impl_t::mark_rolled_back(const obj_ver_id & ov)
max_unstable = it->first.version; max_unstable = it->first.version;
break; break;
} }
else if (IS_STABLE(it->second.state)) else if (IS_IN_FLIGHT(it->second.state) || IS_STABLE(it->second.state))
break; break;
// Remove entry // Remove entry
rm_start = it; rm_start = it;
@ -187,14 +184,14 @@ void blockstore_impl_t::mark_rolled_back(const obj_ver_id & ov)
if (rm_start != rm_end) if (rm_start != rm_end)
{ {
erase_dirty(rm_start, rm_end, UINT64_MAX); erase_dirty(rm_start, rm_end, UINT64_MAX);
} auto unstab_it = unstable_writes.find(ov.oid);
auto unstab_it = unstable_writes.find(ov.oid); if (unstab_it != unstable_writes.end())
if (unstab_it != unstable_writes.end()) {
{ if (max_unstable == 0)
if (max_unstable == 0) unstable_writes.erase(unstab_it);
unstable_writes.erase(unstab_it); else
else unstab_it->second = max_unstable;
unstab_it->second = max_unstable; }
} }
} }
} }