This is an automated email from the ASF dual-hosted git repository.

twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new cc4f63d6 feat(cmd): all blocking commands should be no-script (#2666)
cc4f63d6 is described below

commit cc4f63d67afa0636eeb344b648a17a5ecd5d1c49
Author: Twice <[email protected]>
AuthorDate: Sat Nov 16 14:22:40 2024 +0800

    feat(cmd): all blocking commands should be no-script (#2666)
---
 .gitignore                 | 1 +
 src/commands/cmd_list.cc   | 7 +++----
 src/commands/cmd_server.cc | 2 +-
 src/commands/commander.h   | 8 ++++++--
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/.gitignore b/.gitignore
index c9a9027a..cd2fd010 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,3 +46,4 @@ testdb
 
 build
 cmake-build-*
+build-*
diff --git a/src/commands/cmd_list.cc b/src/commands/cmd_list.cc
index 1a9f5d03..6b97eb15 100644
--- a/src/commands/cmd_list.cc
+++ b/src/commands/cmd_list.cc
@@ -894,10 +894,9 @@ class CommandLPos : public Commander {
   PosSpec spec_;
 };
 
-REDIS_REGISTER_COMMANDS(List, MakeCmdAttr<CommandBLPop>("blpop", -3, "write 
no-script blocking", 1, -2, 1),
-                        MakeCmdAttr<CommandBRPop>("brpop", -3, "write 
no-script blocking", 1, -2, 1),
-                        MakeCmdAttr<CommandBLMPop>("blmpop", -5, "write 
no-script blocking",
-                                                   CommandBLMPop::keyRangeGen),
+REDIS_REGISTER_COMMANDS(List, MakeCmdAttr<CommandBLPop>("blpop", -3, "write 
blocking", 1, -2, 1),
+                        MakeCmdAttr<CommandBRPop>("brpop", -3, "write 
blocking", 1, -2, 1),
+                        MakeCmdAttr<CommandBLMPop>("blmpop", -5, "write 
blocking", CommandBLMPop::keyRangeGen),
                         MakeCmdAttr<CommandLIndex>("lindex", 3, "read-only", 
1, 1, 1),
                         MakeCmdAttr<CommandLInsert>("linsert", 5, "write 
slow", 1, 1, 1),
                         MakeCmdAttr<CommandLLen>("llen", 2, "read-only", 1, 1, 
1),
diff --git a/src/commands/cmd_server.cc b/src/commands/cmd_server.cc
index e2938267..ef424a14 100644
--- a/src/commands/cmd_server.cc
+++ b/src/commands/cmd_server.cc
@@ -1343,7 +1343,7 @@ REDIS_REGISTER_COMMANDS(Server, 
MakeCmdAttr<CommandAuth>("auth", 2, "read-only o
                         MakeCmdAttr<CommandSlowlog>("slowlog", -2, 
"read-only", NO_KEY),
                         MakeCmdAttr<CommandPerfLog>("perflog", -2, 
"read-only", NO_KEY),
                         MakeCmdAttr<CommandClient>("client", -2, "read-only", 
NO_KEY),
-                        MakeCmdAttr<CommandMonitor>("monitor", 1, "read-only 
no-multi", NO_KEY),
+                        MakeCmdAttr<CommandMonitor>("monitor", 1, "read-only 
no-multi no-script", NO_KEY),
                         MakeCmdAttr<CommandShutdown>("shutdown", 1, "read-only 
no-multi no-script", NO_KEY),
                         MakeCmdAttr<CommandQuit>("quit", 1, "read-only", 
NO_KEY),
                         MakeCmdAttr<CommandScan>("scan", -2, "read-only", 
NO_KEY),
diff --git a/src/commands/commander.h b/src/commands/commander.h
index ac3d3aa9..bf172a79 100644
--- a/src/commands/commander.h
+++ b/src/commands/commander.h
@@ -328,9 +328,13 @@ inline uint64_t ParseCommandFlags(const std::string 
&description, const std::str
       flags |= kCmdNoDBSizeCheck;
     else if (flag == "slow")
       flags |= kCmdSlow;
-    else if (flag == "blocking")
+    else if (flag == "blocking") {
       flags |= kCmdBlocking;
-    else {
+
+      // blocking commands should always be no-script
+      // TODO: we can relax this restriction if scripting becomes non-exclusive
+      flags |= kCmdNoScript;
+    } else {
       std::cout << fmt::format("Encountered non-existent flag '{}' in command 
{} in command attribute parsing", flag,
                                cmd_name)
                 << std::endl;

Reply via email to