Skip to content

Commit

Permalink
fix ut.
Browse files Browse the repository at this point in the history
Previously commit dont flush the over-written log,  and the log_entries
only look at flushed logs. As a result, the over-written log was
not included in the log_entries() result which breaks the UT.

The UT was running in master, because we dont at the over_written
entry into cache and the entry_at() call will inline flush this entry.
After adding it to cache it served from cache without flushing.

Signed-off-by: Xiaoxi Chen <[email protected]>
  • Loading branch information
xiaoxichen committed Nov 11, 2024
1 parent 4737b66 commit eaaa5dc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/replication/log_store/home_raft_log_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ void HomeRaftLogStore::write_at(ulong index, nuraft::ptr< nuraft::log_entry >& e
std::unique_lock lk(m_mutex);
m_log_entry_cache[position_in_cache] = std::make_pair(index, entry);
}

// flushing the log before returning to ensure new(over-written) log is persisted to disk.
end_of_append_batch(index, 1);
}

void HomeRaftLogStore::end_of_append_batch(ulong start, ulong cnt) {
Expand Down

0 comments on commit eaaa5dc

Please sign in to comment.