summaryrefslogtreecommitdiff
path: root/src/server.h
diff options
context:
space:
mode:
authorMeir Shpilraien (Spielrein) <meir@redis.com>2021-12-26 09:03:37 +0200
committerGitHub <noreply@github.com>2021-12-26 09:03:37 +0200
commit365cbf46a717d660bbe9c832b6c9d7fc15982029 (patch)
treec301a721b10795620522ba5a7a2eee63aeb2992c /src/server.h
parent08ff606b0bf93e5c5e62927cc9dbd229a28ee379 (diff)
downloadredis-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/server.h')
-rw-r--r--src/server.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/server.h b/src/server.h
index 8e4d8d902..471e8c72a 100644
--- a/src/server.h
+++ b/src/server.h
@@ -3162,6 +3162,7 @@ void migrateCommand(client *c);
void askingCommand(client *c);
void readonlyCommand(client *c);
void readwriteCommand(client *c);
+int verifyDumpPayload(unsigned char *p, size_t len, uint16_t *rdbver_ptr);
void dumpCommand(client *c);
void objectCommand(client *c);
void memoryCommand(client *c);
@@ -3182,6 +3183,8 @@ void functionInfoCommand(client *c);
void functionListCommand(client *c);
void functionHelpCommand(client *c);
void functionFlushCommand(client *c);
+void functionRestoreCommand(client *c);
+void functionDumpCommand(client *c);
void timeCommand(client *c);
void bitopCommand(client *c);
void bitcountCommand(client *c);