Skip to content

Commit

Permalink
Fix issue where epochs were not written to the epoch file in ascendin…
Browse files Browse the repository at this point in the history
…g order

Resolved a regression introduced in commit b0d97c2, where the epoch file did not guarantee ascending order of epochs. This fix ensures that epochs are written in the correct order to maintain consistency and prevent potential data corruption.
  • Loading branch information
umegane committed Dec 19, 2024
1 parent ed01c09 commit 10c78b8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/limestone/datastore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ void datastore::update_min_epoch_id(bool from_switch_epoch) { // NOLINT(readabi
}
if (epoch_id_to_be_recorded_.compare_exchange_strong(old_epoch_id, to_be_epoch)) {
TRACE << "epoch_id_to_be_recorded_ updated to " << to_be_epoch;
if (to_be_epoch < epoch_id_to_be_recorded_.load()) {
break;
}
std::lock_guard<std::mutex> lock(mtx_epoch_file_);
write_epoch_to_file(static_cast<epoch_id_type>(to_be_epoch));
epoch_id_record_finished_.store(to_be_epoch);
Expand Down

0 comments on commit 10c78b8

Please sign in to comment.