summaryrefslogtreecommitdiff
path: root/src/aof.c
diff options
context:
space:
mode:
authoryoav-steinberg <yoav@monfort.co.il>2022-01-02 09:39:01 +0200
committerGitHub <noreply@github.com>2022-01-02 09:39:01 +0200
commit1bf6d6f11eb08d98ba3de688d18d805a2d8696d5 (patch)
treee808f1f65487fbeae9eeb281b1d33a1fd8baaf63 /src/aof.c
parent888e92eb5797c1a6ce4c7b89c5814dbe13a8d8e3 (diff)
downloadredis-1bf6d6f11eb08d98ba3de688d18d805a2d8696d5.tar.gz
Generate RDB with Functions only via redis-cli --functions-rdb (#9968)
This is needed in order to ease the deployment of functions for ephemeral cases, where user needs to spin up a server with functions pre-loaded. #### Details: * Added `--functions-rdb` option to _redis-cli_. * Functions only rdb via `REPLCONF rdb-filter-only functions`. This is a placeholder for a space separated inclusion filter for the RDB. In the future can be `REPLCONF rdb-filter-only "functions db:3 key-patten:user*"` and a complementing `rdb-filter-exclude` `REPLCONF` can also be added. * Handle "slave requirements" specification to RDB saving code so we can use the same RDB when different slaves express the same requirements (like functions-only) and not share the RDB when their requirements differ. This is currently just a flags `int`, but can be extended to a more complex structure with various filter fields. * make sure to support filters only in diskless replication mode (not to override the persistence file), we do that by forcing diskless (even if disabled by config) other changes: * some refactoring in rdb.c (extract portion of a big function to a sub-function) * rdb_key_save_delay used in AOFRW too * sendChildInfo takes the number of updated keys (incremental, rather than absolute) Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'src/aof.c')
-rw-r--r--src/aof.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/aof.c b/src/aof.c
index 1647dd009..764b5e0cf 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -1509,6 +1509,10 @@ int rewriteAppendOnlyFileRio(rio *aof) {
updated_time = now;
}
}
+
+ /* Delay before next key if required (for testing) */
+ if (server.rdb_key_save_delay)
+ debugDelay(server.rdb_key_save_delay);
}
dictReleaseIterator(di);
di = NULL;
@@ -1552,7 +1556,7 @@ int rewriteAppendOnlyFile(char *filename) {
if (server.aof_use_rdb_preamble) {
int error;
- if (rdbSaveRio(&aof,&error,RDBFLAGS_AOF_PREAMBLE,NULL) == C_ERR) {
+ if (rdbSaveRio(SLAVE_REQ_NONE,&aof,&error,RDBFLAGS_AOF_PREAMBLE,NULL) == C_ERR) {
errno = error;
goto werr;
}