revert back durability
This commit is contained in:
parent
bd1eddecd4
commit
2ac22523ea
@ -418,10 +418,11 @@ std::optional<RecoveryInfo> Recovery::RecoverData(std::string *uuid, Replication
|
|||||||
// We can also set the last timestamp to 0 if last loaded timestamp
|
// We can also set the last timestamp to 0 if last loaded timestamp
|
||||||
// is nullopt as this can only happen if the WAL file with seq = 0
|
// is nullopt as this can only happen if the WAL file with seq = 0
|
||||||
// does not contain any deltas and we didn't find any snapshots.
|
// does not contain any deltas and we didn't find any snapshots.
|
||||||
|
/*
|
||||||
if (last_loaded_timestamp) {
|
if (last_loaded_timestamp) {
|
||||||
epoch_history->emplace_back(repl_storage_state.epoch_.id(), *last_loaded_timestamp);
|
epoch_history->emplace_back(repl_storage_state.epoch_.id(), *last_loaded_timestamp);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
for (auto &wal_file : wal_files) {
|
for (auto &wal_file : wal_files) {
|
||||||
if (previous_seq_num && (wal_file.seq_num - *previous_seq_num) > 1) {
|
if (previous_seq_num && (wal_file.seq_num - *previous_seq_num) > 1) {
|
||||||
LOG_FATAL("You are missing a WAL file with the sequence number {}!", *previous_seq_num + 1);
|
LOG_FATAL("You are missing a WAL file with the sequence number {}!", *previous_seq_num + 1);
|
||||||
@ -437,6 +438,18 @@ std::optional<RecoveryInfo> Recovery::RecoverData(std::string *uuid, Replication
|
|||||||
|
|
||||||
recovery_info.last_commit_timestamp = info.last_commit_timestamp;
|
recovery_info.last_commit_timestamp = info.last_commit_timestamp;
|
||||||
|
|
||||||
|
if (wal_file.epoch_id != repl_storage_state.epoch_.id()) {
|
||||||
|
// This way we skip WALs finalized only because of role change.
|
||||||
|
// We can also set the last timestamp to 0 if last loaded timestamp
|
||||||
|
// is nullopt as this can only happen if the WAL file with seq = 0
|
||||||
|
// does not contain any deltas and we didn't find any snapshots.
|
||||||
|
if (last_loaded_timestamp) {
|
||||||
|
epoch_history->emplace_back(wal_file.epoch_id, *last_loaded_timestamp);
|
||||||
|
}
|
||||||
|
repl_storage_state.epoch_.SetEpoch(std::move(wal_file.epoch_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (recovery_info.next_timestamp != 0) {
|
if (recovery_info.next_timestamp != 0) {
|
||||||
last_loaded_timestamp.emplace(recovery_info.next_timestamp - 1);
|
last_loaded_timestamp.emplace(recovery_info.next_timestamp - 1);
|
||||||
}
|
}
|
||||||
@ -452,9 +465,14 @@ std::optional<RecoveryInfo> Recovery::RecoverData(std::string *uuid, Replication
|
|||||||
if (last_epoch_bigger_timestamp) {
|
if (last_epoch_bigger_timestamp) {
|
||||||
epoch_history->back().second = last_loaded_timestamp.value_or(0);
|
epoch_history->back().second = last_loaded_timestamp.value_or(0);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
} catch (const RecoveryFailure &e) {
|
} catch (const RecoveryFailure &e) {
|
||||||
LOG_FATAL("Couldn't recover WAL deltas from {} because of: {}", wal_file.path, e.what());
|
LOG_FATAL("Couldn't recover WAL deltas from {} because of: {}", wal_file.path, e.what());
|
||||||
}
|
}
|
||||||
|
if (recovery_info.next_timestamp != 0) {
|
||||||
|
last_loaded_timestamp.emplace(recovery_info.next_timestamp - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// The sequence number needs to be recovered even though `LoadWal` didn't
|
// The sequence number needs to be recovered even though `LoadWal` didn't
|
||||||
// load any deltas from that file.
|
// load any deltas from that file.
|
||||||
|
Loading…
Reference in New Issue
Block a user