diff options
author | Meir Shpilraien (Spielrein) <meir@redis.com> | 2021-12-21 16:13:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-21 16:13:29 +0200 |
commit | 3bcf108416bea7ec700aeee2f79e8b31de35c060 (patch) | |
tree | cbab6095d1e431f49dc021ae45920e94d15ecd8a /src/commands/function-kill.json | |
parent | 23b61734863a5f8bc66fa44734f8c8c3cd2c365a (diff) | |
download | redis-3bcf108416bea7ec700aeee2f79e8b31de35c060.tar.gz |
Change FUNCTION CREATE, DELETE and FLUSH to be WRITE commands instead of MAY_REPLICATE. (#9953)
The issue with MAY_REPLICATE is that all automatic mechanisms to handle
write commands will not work. This require have a special treatment for:
* Not allow those commands to be executed on RO replica.
* Allow those commands to be executed on RO replica from primary connection.
* Allow those commands to be executed on the RO replica from AOF.
By setting those commands as WRITE commands we are getting all those properties from Redis.
Test was added to verify that those properties work as expected.
In addition, rearrange when and where functions are flushed. Before this PR functions were
flushed manually on `rdbLoadRio` and cleaned manually on failure. This contradicts the
assumptions that functions are data and need to be created/deleted alongside with the
data. A side effect of this, for example, `debug reload noflush` did not flush the data but
did flush the functions, `debug loadaof` flush the data but not the functions.
This PR move functions deletion into `emptyDb`. `emptyDb` (renamed to `emptyData`) will
now accept an additional flag, `NOFUNCTIONS` which specifically indicate that we do not
want to flush the functions (on all other cases, functions will be flushed). Used the new flag
on FLUSHALL and FLUSHDB only! Tests were added to `debug reload` and `debug loadaof`
to verify that functions behave the same as the data.
Notice that because now functions will be deleted along side with the data we can not allow
`CLUSTER RESET` to be called from within a function (it will cause the function to be released
while running), this PR adds `NO_SCRIPT` flag to `CLUSTER RESET` so it will not be possible
to be called from within a function. The other cluster commands are allowed from within a
function (there are use-cases that uses `GETKEYSINSLOT` to iterate over all the keys on a
given slot). Tests was added to verify `CLUSTER RESET` is denied from within a script.
Another small change on this PR is that `RDBFLAGS_ALLOW_DUP` is also applicable on functions.
When loading functions, if this flag is set, we will replace old functions with new ones on collisions.
Diffstat (limited to 'src/commands/function-kill.json')
-rw-r--r-- | src/commands/function-kill.json | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/commands/function-kill.json b/src/commands/function-kill.json index 19f962df0..43377d8b8 100644 --- a/src/commands/function-kill.json +++ b/src/commands/function-kill.json @@ -1,7 +1,7 @@ { "KILL": { - "summary": "PATCH__TBD__19__", - "complexity": "PATCH__TBD__18__", + "summary": "Kill the function currently in execution.", + "complexity": "O(1)", "group": "scripting", "since": "7.0.0", "arity": 2, |