Skip to content

Commit

Permalink
Minor revision.
Browse files Browse the repository at this point in the history
- Updated minor comments.

Signed-off-by: Kyle Kim <[email protected]>
  • Loading branch information
kyle-yh-kim committed Jul 26, 2024
1 parent ad22128 commit 0454ed4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/cluster_slot_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ static uint64_t getSlotStat(int slot, slotStatType stat_type) {
case CPU_USEC: slot_stat = server.cluster->slot_stats[slot].cpu_usec; break;
case NETWORK_BYTES_IN: slot_stat = server.cluster->slot_stats[slot].network_bytes_in; break;
case NETWORK_BYTES_OUT: slot_stat = server.cluster->slot_stats[slot].network_bytes_out; break;
default: /* SLOT_STAT_COUNT, INVALID */
serverPanic("Invalid slot stat type %d was found.", stat_type);
case SLOT_STAT_COUNT:
case INVALID: serverPanic("Invalid slot stat type %d was found.", stat_type);
}
return slot_stat;
}
Expand Down
4 changes: 4 additions & 0 deletions src/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,13 @@ int calculateKeySlot(sds key) {
int getKeySlot(sds key) {
/* This is performance optimization that uses pre-set slot id from the current command,
* in order to avoid calculation of the key hash.
*
* This optimization is only used when current_client flag `CLIENT_EXECUTING_COMMAND` is set.
* It only gets set during the execution of command under `call` method. Other flows requesting
* the key slot would fallback to calculateKeySlot.
*
* Modules and scripts executed on the primary may get replicated as multi-execs that operate on multiple slots,
* so we must always recompute the slot for commands coming from the primary.
*/
if (server.current_client && server.current_client->slot >= 0 && server.current_client->flag.executing_command &&
!server.current_client->flag.primary) {
Expand Down
1 change: 0 additions & 1 deletion src/multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
*/

#include "server.h"
#include "cluster_slot_stats.h"

/* ================================ MULTI/EXEC ============================== */

Expand Down

0 comments on commit 0454ed4

Please sign in to comment.