Flush analytics store before snapshot.

This commit is contained in:
Kishore Nallan 2024-07-22 21:29:32 +05:30
parent b0359000b1
commit cc1588ecfa
2 changed files with 4 additions and 1 deletions

View File

@ -507,7 +507,7 @@ void AnalyticsManager::run(ReplicationState* raft_server) {
std::unique_lock lk(mutex);
cv.wait_for(lk, std::chrono::seconds(QUERY_COMPACTION_INTERVAL_S), [&] { return quit.load(); });
//LOG(INFO) << "QuerySuggestions::run";
//LOG(INFO) << "AnalyticsManager::run";
if(quit) {
lk.unlock();

View File

@ -579,6 +579,9 @@ void ReplicationState::on_snapshot_save(braft::SnapshotWriter* writer, braft::Cl
}
if(analytics_store) {
// to ensure that in-memory table is sent to disk (we don't use WAL)
analytics_store->flush();
rocksdb::Checkpoint* checkpoint2 = nullptr;
status = analytics_store->create_check_point(&checkpoint2, analytics_db_snapshot_path);
std::unique_ptr<rocksdb::Checkpoint> checkpoint_guard(checkpoint2);