Don't remove from cache if it wasn't added during rollback

This commit is contained in:
Antonio Andelic 2022-08-30 08:14:53 +00:00
parent 2416ddfae7
commit 21cdb9a500
2 changed files with 13 additions and 9 deletions

View File

@ -463,20 +463,24 @@ void KeeperStorage::UncommittedState::rollback(int64_t rollback_zxid)
delta_it->operation); delta_it->operation);
auto & path_deltas = deltas_for_path.at(delta_it->path); auto & path_deltas = deltas_for_path.at(delta_it->path);
assert(path_deltas.back() == &*delta_it); if (path_deltas.back() == &*delta_it)
{
path_deltas.pop_back(); path_deltas.pop_back();
if (path_deltas.empty()) if (path_deltas.empty())
deltas_for_path.erase(delta_it->path); deltas_for_path.erase(delta_it->path);
} }
}
else if (auto * add_auth = std::get_if<AddAuthDelta>(&delta_it->operation)) else if (auto * add_auth = std::get_if<AddAuthDelta>(&delta_it->operation))
{ {
auto & uncommitted_auth = session_and_auth[add_auth->session_id]; auto & uncommitted_auth = session_and_auth[add_auth->session_id];
assert(uncommitted_auth.back() == &add_auth->auth_id); if (uncommitted_auth.back() == &add_auth->auth_id)
{
uncommitted_auth.pop_back(); uncommitted_auth.pop_back();
if (uncommitted_auth.empty()) if (uncommitted_auth.empty())
session_and_auth.erase(add_auth->session_id); session_and_auth.erase(add_auth->session_id);
} }
} }
}
if (delta_it == deltas.rend()) if (delta_it == deltas.rend())
deltas.clear(); deltas.clear();