Skip to content

Commit

Permalink
Address wadeliuyi's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
heng committed Sep 3, 2019
1 parent 30494a7 commit e3aa5d3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/kvstore/LogEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ std::string encodeHost(LogType type, const HostAddr& host) {
return encoded;
}

HostAddr decodeHost(LogType type, folly::StringPiece encoded) {
HostAddr decodeHost(LogType type, const folly::StringPiece& encoded) {
HostAddr addr;
CHECK_EQ(sizeof(int64_t) + 1 + sizeof(HostAddr), encoded.size());
CHECK(encoded[sizeof(int64_t)] == type);
Expand Down
2 changes: 1 addition & 1 deletion src/kvstore/LogEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ std::vector<folly::StringPiece> decodeMultiValues(folly::StringPiece encoded);


std::string encodeHost(LogType type, const HostAddr& learner);
HostAddr decodeHost(LogType type, folly::StringPiece encoded);
HostAddr decodeHost(LogType type, const folly::StringPiece& encoded);

} // namespace kvstore
} // namespace nebula
Expand Down
6 changes: 5 additions & 1 deletion src/kvstore/raftex/RaftPart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,11 @@ void RaftPart::removePeer(const HostAddr& peer) {
if (it == hosts_.end()) {
LOG(INFO) << idStr_ << "The peer " << peer << " not exist!";
} else {
CHECK(!(*it)->isLearner()) << idStr_ << "Peer " << peer << " should not be learner!";
if ((*it)->isLearner()) {
LOG(INFO) << idStr_ << "The peer is learner, remove it directly!";
hosts_.erase(it);
return;
}
hosts_.erase(it);
updateQuorum();
LOG(INFO) << idStr_ << "Remove peer " << peer;
Expand Down

0 comments on commit e3aa5d3

Please sign in to comment.