Skip to content

Commit fa637c1

Browse files
committed
fix: prohibit read commands during takeover
1 parent 267d5ab commit fa637c1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/server/main_service.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,10 @@ std::optional<ErrorReply> Service::VerifyCommandState(const CommandId* cid, CmdA
10571057
allowed_by_state = false;
10581058
break;
10591059
case GlobalState::TAKEN_OVER:
1060-
allowed_by_state = !cid->IsWriteOnly();
1060+
// Only Admin commands are allowed
1061+
// we prohibit even read commands, because read commands running in pipeline can take a while
1062+
// to send all data to a client which leads to fail in takeover
1063+
allowed_by_state = dfly_cntx.conn()->IsPrivileged();
10611064
break;
10621065
default:
10631066
break;

0 commit comments

Comments
 (0)