Use from_timestamp for WAL retention (#240)

This commit is contained in:
antonio2368 2021-09-24 12:14:54 +02:00 committed by GitHub
parent 9f855676cb
commit b94e50bf1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -274,13 +274,13 @@ std::optional<RecoveryInfo> RecoverData(const std::filesystem::path &snapshot_di
LOG_FATAL(
"There are missing prefix WAL files and data can't be "
"recovered without them!");
} else if (first_wal.to_timestamp >= *snapshot_timestamp) {
} else if (first_wal.from_timestamp >= *snapshot_timestamp) {
// We recovered from a snapshot and we must have at least one WAL file
// whose all deltas were created before the snapshot in order to
// that has at least one delta that was created before the snapshot in order to
// verify that nothing is missing from the beginning of the WAL chain.
LOG_FATAL(
"You must have at least one WAL file that contains "
"deltas that were created before the snapshot file!");
"You must have at least one WAL file that contains at least one "
"delta that was created before the snapshot file!");
}
}
}

View File

@ -946,7 +946,7 @@ void CreateSnapshot(Transaction *transaction, const std::filesystem::path &snaps
std::optional<uint64_t> pos = 0;
for (uint64_t i = 0; i < wal_files.size(); ++i) {
const auto &[seq_num, from_timestamp, to_timestamp, wal_path] = wal_files[i];
if (to_timestamp <= snapshot_start_timestamp) {
if (from_timestamp <= snapshot_start_timestamp) {
pos = i;
} else {
break;