Skip to content

Commit

Permalink
fix: comment
Browse files Browse the repository at this point in the history
  • Loading branch information
longfar-ncy committed Oct 21, 2024
1 parent f9287eb commit dfee101
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/cmd_raft.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include "cmd_raft.h"
#include <fmt/core.h>

#include <cstdint>
#include <optional>
Expand Down Expand Up @@ -179,9 +180,10 @@ void RaftNodeCmd::DoCmdRemove(PClient* client) {

void RaftNodeCmd::DoCmdSnapshot(PClient* client) {
auto s = praft_->DoSnapshot();
if (s.ok()) {
client->SetRes(CmdRes::kOK);
if (!s.ok()) {
return client->SetRes(CmdRes::kErrOther, fmt::format("do snapshot error: {}", s.error_cstr()));
}
client->SetRes(CmdRes::kOK);
}

RaftClusterCmd::RaftClusterCmd(const std::string& name, int16_t arity)
Expand Down
1 change: 0 additions & 1 deletion src/praft/praft.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@ bool PRaft::InitializeNodeBeforeAdd(PClient* client, PClient* join_client, const
ERROR("Joined Raft cluster fail, because of invalid raft_group_id");
join_client->SetRes(CmdRes::kErrOther, "Invalid raft_group_id");
join_client->SendPacket();
// join_client->Clear();
// If the join fails, clear clusterContext and set it again by using the join command
cluster_cmd_ctx_.Clear();
return false;
Expand Down

0 comments on commit dfee101

Please sign in to comment.