diff options
author | Meir Shpilraien (Spielrein) <meir@redis.com> | 2021-12-26 09:03:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-26 09:03:37 +0200 |
commit | 365cbf46a717d660bbe9c832b6c9d7fc15982029 (patch) | |
tree | c301a721b10795620522ba5a7a2eee63aeb2992c /src/rdb.h | |
parent | 08ff606b0bf93e5c5e62927cc9dbd229a28ee379 (diff) | |
download | redis-365cbf46a717d660bbe9c832b6c9d7fc15982029.tar.gz |
Add FUNCTION DUMP and RESTORE. (#9938)
Follow the conclusions to support Functions in redis cluster (#9899)
Added 2 new FUNCTION sub-commands:
1. `FUNCTION DUMP` - dump a binary payload representation of all the functions.
2. `FUNCTION RESTORE <PAYLOAD> [FLUSH|APPEND|REPLACE]` - give the binary payload extracted
using `FUNCTION DUMP`, restore all the functions on the given payload. Restore policy can be given to
control how to handle existing functions (default is APPEND):
* FLUSH: delete all existing functions.
* APPEND: appends the restored functions to the existing functions. On collision, abort.
* REPLACE: appends the restored functions to the existing functions. On collision,
replace the old function with the new function.
Modify `redis-cli --cluster add-node` to use `FUNCTION DUMP` to get existing functions from
one of the nodes in the cluster, and `FUNCTION RESTORE` to load the same set of functions
to the new node. `redis-cli` will execute this step before sending the `CLUSTER MEET` command
to the new node. If `FUNCTION DUMP` returns an error, assume the current Redis version do not
support functions and skip `FUNCTION RESTORE`. If `FUNCTION RESTORE` fails, abort and do not send
the `CLUSTER MEET` command. If the new node already contains functions (before the `FUNCTION RESTORE`
is sent), abort and do not add the node to the cluster. Test was added to verify
`redis-cli --cluster add-node` works as expected.
Diffstat (limited to 'src/rdb.h')
-rw-r--r-- | src/rdb.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -169,7 +169,9 @@ int rdbSaveBinaryFloatValue(rio *rdb, float val); int rdbLoadBinaryFloatValue(rio *rdb, float *val); int rdbLoadRio(rio *rdb, int rdbflags, rdbSaveInfo *rsi); int rdbLoadRioWithLoadingCtx(rio *rdb, int rdbflags, rdbSaveInfo *rsi, rdbLoadingCtx *rdb_loading_ctx); +int rdbFunctionLoad(rio *rdb, int ver, functionsCtx* functions_ctx, int rdbflags, sds *err); int rdbSaveRio(rio *rdb, int *error, int rdbflags, rdbSaveInfo *rsi); +int functionsSaveRio(rio *rdb); rdbSaveInfo *rdbPopulateSaveInfo(rdbSaveInfo *rsi); #endif |