Skip to content

Commit

Permalink
perf(conn): skip index matching when index map is empty (#2405)
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice authored Jul 13, 2024
1 parent 12269d7 commit e49a8e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/server/redis_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit e49a8e1

Please sign in to comment.