Skip to content

Commit

Permalink
Revert "Optimize-slaveof (#2027)" (#2030)
Browse files Browse the repository at this point in the history
This reverts commit f7df2fc.
  • Loading branch information
AlexStocks authored Sep 25, 2023
1 parent f7df2fc commit f7e566a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/pika_admin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void SlaveofCmd::DoInitial() {
return;
}

// self is master of A , want to slaveof B
// self is master of A , want to slavof B
if ((g_pika_server->role() & PIKA_ROLE_MASTER) != 0) {
res_.SetRes(CmdRes::kErrOther, "already master of others, invalid usage");
return;
Expand All @@ -122,7 +122,7 @@ void SlaveofCmd::DoInitial() {
}

if ((master_ip_ == "127.0.0.1" || master_ip_ == g_pika_server->host()) && master_port_ == g_pika_server->port()) {
res_.SetRes(CmdRes::kErrOther, "The ip and port of the connection are themselves");
res_.SetRes(CmdRes::kErrOther, "you fucked up");
return;
}

Expand All @@ -148,7 +148,6 @@ void SlaveofCmd::Do(std::shared_ptr<Slot> slot) {
if (is_none_) {
res_.SetRes(CmdRes::kOk);
g_pika_conf->SetSlaveof(std::string());
g_pika_conf->ConfigRewrite();
return;
}

Expand All @@ -162,7 +161,6 @@ void SlaveofCmd::Do(std::shared_ptr<Slot> slot) {
res_.SetRes(CmdRes::kOk);
g_pika_conf->SetSlaveof(master_ip_ + ":" + std::to_string(master_port_));
g_pika_conf->SetMasterRunID("");
g_pika_conf->ConfigRewrite();
g_pika_server->SetFirstMetaSync(true);
} else {
res_.SetRes(CmdRes::kErrOther, "Server is not in correct state for slaveof");
Expand Down

0 comments on commit f7e566a

Please sign in to comment.