diff options
author | guybe7 <guy.benoish@redislabs.com> | 2022-09-28 13:15:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-28 14:15:07 +0300 |
commit | 3330ea1864e8a4fe3dcbb69101a2d1afd5e8401f (patch) | |
tree | b21c1de9e2673bce4994146ff9f0b0ec92dddf73 /tests/modules | |
parent | c0725abfbbf7ba1eb2b02573a64dce04dc3f7e3a (diff) | |
download | redis-3330ea1864e8a4fe3dcbb69101a2d1afd5e8401f.tar.gz |
RM_CreateCommand should not set CMD_KEY_VARIABLE_FLAGS automatically (#11320)
The original idea behind auto-setting the default (first,last,step) spec was to use
the most "open" flags when the user didn't provide any key-spec flags information.
While the above idea is a good approach, it really makes no sense to set
CMD_KEY_VARIABLE_FLAGS if the user didn't provide the getkeys-api flag:
in this case there's not way to retrieve these variable flags, so what's the point?
Internally in redis there was code to ignore this already, so this fix doesn't change
redis's behavior, it only affects the output of COMMAND command.
Diffstat (limited to 'tests/modules')
-rw-r--r-- | tests/modules/keyspecs.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/modules/keyspecs.c b/tests/modules/keyspecs.c index d2ae9fd6c..0a70de814 100644 --- a/tests/modules/keyspecs.c +++ b/tests/modules/keyspecs.c @@ -7,6 +7,15 @@ int kspec_impl(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { UNUSED(argv); UNUSED(argc); + + /* Handle getkeys-api introspection (for "kspec.nonewithgetkeys") */ + if (RedisModule_IsKeysPositionRequest(ctx)) { + for (int i = 1; i < argc; i += 2) + RedisModule_KeyAtPosWithFlags(ctx, i, REDISMODULE_CMD_KEY_RO | REDISMODULE_CMD_KEY_ACCESS); + + return REDISMODULE_OK; + } + RedisModule_ReplyWithSimpleString(ctx, "OK"); return REDISMODULE_OK; } |