Skip to content

Commit

Permalink
fix flag of debug
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice committed Jan 25, 2025
1 parent a4f9e2f commit 9fd4fb8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/commands/cmd_function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ struct CommandFCall : Commander {
CommandKeyRange GetScriptEvalKeyRange(const std::vector<std::string> &args);

uint64_t GenerateFunctionFlags(uint64_t flags, const std::vector<std::string> &args) {
if (util::EqualICase(args[1], "load") || util::EqualICase(args[1], "delete")) {
if (args.size() >= 2 && (util::EqualICase(args[1], "load") || util::EqualICase(args[1], "delete"))) {
return flags | kCmdWrite;
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_script.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ CommandKeyRange GetScriptEvalKeyRange(const std::vector<std::string> &args) {
}

uint64_t GenerateScriptFlags(uint64_t flags, const std::vector<std::string> &args) {
if (util::EqualICase(args[1], "load") || util::EqualICase(args[1], "flush")) {
if (args.size() >= 2 && (util::EqualICase(args[1], "load") || util::EqualICase(args[1], "flush"))) {
return flags | kCmdWrite;
}

Expand Down
10 changes: 9 additions & 1 deletion src/commands/cmd_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,14 @@ class CommandDebug : public Commander {
return Status::OK();
}

static uint64_t FlagGen(uint64_t flags, const std::vector<std::string> &args) {
if (args.size() >= 2 && (util::EqualICase(args[1], "protocol") || util::EqualICase(args[1], "dbsize-limit"))) {
return flags & ~kCmdExclusive;
}

return flags;
}

private:
std::string subcommand_;
std::string protocol_type_;
Expand Down Expand Up @@ -1348,7 +1356,7 @@ REDIS_REGISTER_COMMANDS(Server, MakeCmdAttr<CommandAuth>("auth", 2, "read-only o
MakeCmdAttr<CommandQuit>("quit", 1, "read-only", NO_KEY),
MakeCmdAttr<CommandScan>("scan", -2, "read-only", NO_KEY),
MakeCmdAttr<CommandRandomKey>("randomkey", 1, "read-only", NO_KEY),
MakeCmdAttr<CommandDebug>("debug", -2, "read-only exclusive", NO_KEY),
MakeCmdAttr<CommandDebug>("debug", -2, "read-only exclusive", NO_KEY, CommandDebug::FlagGen),
MakeCmdAttr<CommandCommand>("command", -1, "read-only", NO_KEY),
MakeCmdAttr<CommandEcho>("echo", 2, "read-only", NO_KEY),
MakeCmdAttr<CommandTime>("time", 1, "read-only ok-loading", NO_KEY),
Expand Down

0 comments on commit 9fd4fb8

Please sign in to comment.