Fix snapshot recovery max TX logic
Reviewers: msantl Reviewed By: msantl Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1982
This commit is contained in:
parent
2f066b3a83
commit
872b043bed
@ -291,7 +291,9 @@ bool RecoverSnapshot(const fs::path &snapshot_file, database::GraphDb *db,
|
||||
// that does not interfere with that found in previous snapshots and WAL.
|
||||
tx::TransactionId max_id = recovery_data->snapshooter_tx_id;
|
||||
auto &snap = recovery_data->snapshooter_tx_snapshot;
|
||||
if (!snap.empty()) max_id = *std::max_element(snap.begin(), snap.end());
|
||||
if (!snap.empty()) {
|
||||
max_id = std::max(max_id, *std::max_element(snap.begin(), snap.end()));
|
||||
}
|
||||
dba->db().tx_engine().EnsureNextIdGreater(max_id);
|
||||
dba->Commit();
|
||||
return true;
|
||||
|
@ -249,7 +249,9 @@ bool RecoverSnapshot(const fs::path &snapshot_file, database::GraphDb *db,
|
||||
// that does not interfere with that found in previous snapshots and WAL.
|
||||
tx::TransactionId max_id = recovery_data->snapshooter_tx_id;
|
||||
auto &snap = recovery_data->snapshooter_tx_snapshot;
|
||||
if (!snap.empty()) max_id = *std::max_element(snap.begin(), snap.end());
|
||||
if (!snap.empty()) {
|
||||
max_id = std::max(max_id, *std::max_element(snap.begin(), snap.end()));
|
||||
}
|
||||
dba.db().tx_engine().EnsureNextIdGreater(max_id);
|
||||
dba.Commit();
|
||||
return true;
|
||||
|
@ -137,7 +137,9 @@ bool RecoverSnapshot(const fs::path &snapshot_file, database::GraphDb *db,
|
||||
// that does not interfere with that found in previous snapshots.
|
||||
tx::TransactionId max_id = recovery_data->snapshooter_tx_id;
|
||||
auto &snap = recovery_data->snapshooter_tx_snapshot;
|
||||
if (!snap.empty()) max_id = *std::max_element(snap.begin(), snap.end());
|
||||
if (!snap.empty()) {
|
||||
max_id = std::max(max_id, *std::max_element(snap.begin(), snap.end()));
|
||||
}
|
||||
dba.db()->tx_engine().EnsureNextIdGreater(max_id);
|
||||
dba.Commit();
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user