diff options
author | yoav-steinberg <yoav@monfort.co.il> | 2022-01-02 09:39:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-02 09:39:01 +0200 |
commit | 1bf6d6f11eb08d98ba3de688d18d805a2d8696d5 (patch) | |
tree | e808f1f65487fbeae9eeb281b1d33a1fd8baaf63 /src/rdb.h | |
parent | 888e92eb5797c1a6ce4c7b89c5814dbe13a8d8e3 (diff) | |
download | redis-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/rdb.h')
-rw-r--r-- | src/rdb.h | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -148,10 +148,10 @@ int rdbLoadLenByRef(rio *rdb, int *isencoded, uint64_t *lenptr); int rdbSaveObjectType(rio *rdb, robj *o); int rdbLoadObjectType(rio *rdb); int rdbLoad(char *filename, rdbSaveInfo *rsi, int rdbflags); -int rdbSaveBackground(char *filename, rdbSaveInfo *rsi); -int rdbSaveToSlavesSockets(rdbSaveInfo *rsi); +int rdbSaveBackground(int req, char *filename, rdbSaveInfo *rsi); +int rdbSaveToSlavesSockets(int req, rdbSaveInfo *rsi); void rdbRemoveTempFile(pid_t childpid, int from_signal); -int rdbSave(char *filename, rdbSaveInfo *rsi); +int rdbSave(int req, char *filename, rdbSaveInfo *rsi); ssize_t rdbSaveObject(rio *rdb, robj *o, robj *key, int dbid); size_t rdbSavedObjectLen(robj *o, robj *key, int dbid); robj *rdbLoadObject(int type, rio *rdb, sds key, int dbid, int *error); @@ -170,8 +170,8 @@ 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); +int rdbSaveRio(int req, rio *rdb, int *error, int rdbflags, rdbSaveInfo *rsi); +ssize_t rdbSaveFunctions(rio *rdb); rdbSaveInfo *rdbPopulateSaveInfo(rdbSaveInfo *rsi); #endif |