Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
fixed bug for cleanup() override
Browse files Browse the repository at this point in the history
  • Loading branch information
bright-starry-sky committed Jun 22, 2021
1 parent 39456ad commit 4677c6f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/kvstore/Listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,11 @@ std::pair<int64_t, int64_t> Listener::commitSnapshot(const std::vector<std::stri
void Listener::resetListener() {
std::lock_guard<std::mutex> g(raftLock_);
reset();
leaderCommitId_ = proposedTerm_ = lastLogTerm_ = term_ = lastApplyLogId_ = 0;
lastApplyTime_ = 0;
persist(0, 0, 0);
VLOG(3) << folly::sformat("The listener has been reset : leaderCommitId={},"
"proposedTerm={}, lastLogTerm={}, term={},"
"lastApplyLogId={}",
leaderCommitId_, proposedTerm_, lastLogTerm_,
term_, lastApplyLogId_);
}

bool Listener::pursueLeaderDone() {
Expand Down
1 change: 1 addition & 0 deletions src/kvstore/Listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class Listener : public raftex::RaftPart {
}

void cleanup() override {
CHECK(!raftLock_.try_lock());
leaderCommitId_ = 0;
lastApplyLogId_ = 0;
persist(0, 0, lastApplyLogId_);
Expand Down
3 changes: 0 additions & 3 deletions src/kvstore/plugins/elasticsearch/ESListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ class ESListener : public Listener {

LogID lastApplyLogId() override;

void cleanup() override {
}

private:
bool writeAppliedId(LogID lastId, TermID lastTerm, LogID lastApplyLogId);

Expand Down

0 comments on commit 4677c6f

Please sign in to comment.