Skip to content

Commit f241a54

Browse files
committed
allow init to work non intercepted before redis raft is up
1 parent e17d902 commit f241a54

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/commands.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static const CommandSpec commands[] = {
7474
{"auth", CMD_SPEC_DONT_INTERCEPT },
7575
/* queued by multi, need to intercept
7676
{"ping", CMD_SPEC_DONT_INTERCEPT }, */
77-
{"ping", CMD_SPEC_READONLY },
77+
{"ping", CMD_SPEC_READONLY | CMD_SPEC_ALLOW_PREINIT },
7878
{"hello", CMD_SPEC_DONT_INTERCEPT },
7979
{"module", CMD_SPEC_DONT_INTERCEPT },
8080
{"config", CMD_SPEC_DONT_INTERCEPT },

src/redisraft.c

+4
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,10 @@ static void interceptRedisCommands(RedisModuleCommandFilterCtx *filter)
17301730
if (flags != -1 && (flags & CMD_SPEC_DONT_INTERCEPT))
17311731
return;
17321732

1733+
if (rr->state != REDIS_RAFT_UP && flags != -1 && (flags & CMD_SPEC_ALLOW_PREINIT)) {
1734+
return;
1735+
}
1736+
17331737
size_t len;
17341738
const char *str = RedisModule_StringPtrLen(cmd, &len);
17351739

src/redisraft.h

+1
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,7 @@ typedef struct {
686686
#define CMD_SPEC_BLOCKING (1 << 8) /* Blocking command */
687687
#define CMD_SPEC_MULTI (1 << 9) /* a MULTI */
688688
#define CMD_SPEC_SUBCOMMAND (1 << 10) /* a command with subcommand specs */
689+
#define CMD_SPEC_ALLOW_PREINIT (1 <<11) /* if redisraft hasn't been initialized yet, allow non intercepted */
689690

690691
/* Command filtering re-entrancy counter handling.
691692
*

0 commit comments

Comments
 (0)