You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by tw...@apache.org on 2024/07/13 08:47:06 UTC

(kvrocks) branch unstable updated: perf(conn): skip index matching when index map is empty (#2405)

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 e49a8e1c perf(conn): skip index matching when index map is empty (#2405)
e49a8e1c is described below

commit e49a8e1c6f574d854ed37dc3247a4f2e68920444
Author: Twice <tw...@gmail.com>
AuthorDate: Sat Jul 13 17:47:01 2024 +0900

    perf(conn): skip index matching when index map is empty (#2405)
---
 src/server/redis_connection.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/server/redis_connection.cc b/src/server/redis_connection.cc
index 0457c71d..b8985f60 100644
--- a/src/server/redis_connection.cc
+++ b/src/server/redis_connection.cc
@@ -544,7 +544,8 @@ void Connection::ExecuteCommands(std::deque<CommandTokens> *to_process_cmds) {
 
     // TODO: transaction support for index recording
     std::vector<GlobalIndexer::RecordResult> index_records;
-    if (IsHashOrJsonCommand(cmd_name) && (attributes->flags & redis::kCmdWrite) && !config->cluster_enabled) {
+    if (!srv_->index_mgr.index_map.empty() && IsHashOrJsonCommand(cmd_name) && (attributes->flags & redis::kCmdWrite) &&
+        !config->cluster_enabled) {
       attributes->ForEachKeyRange(
           [&, this](const std::vector<std::string> &args, const CommandKeyRange &key_range) {
             key_range.ForEachKey(