mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
fix: prohibit read commands during takeover (#4267)
This commit is contained in:
parent
330d007d56
commit
51e16b2ceb
1 changed files with 5 additions and 1 deletions
|
@ -1056,7 +1056,11 @@ std::optional<ErrorReply> Service::VerifyCommandState(const CommandId* cid, CmdA
|
|||
allowed_by_state = false;
|
||||
break;
|
||||
case GlobalState::TAKEN_OVER:
|
||||
allowed_by_state = !cid->IsWriteOnly();
|
||||
// Only PING, admin commands, and all commands via admin connections are allowed
|
||||
// we prohibit even read commands, because read commands running in pipeline can take a while
|
||||
// to send all data to a client which leads to fail in takeover
|
||||
allowed_by_state = dfly_cntx.conn()->IsPrivileged() || (cid->opt_mask() & CO::ADMIN) ||
|
||||
cid->name() == "PING";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue