diff options
author | Oran Agra <oran@redislabs.com> | 2021-04-13 17:41:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-13 17:41:46 +0300 |
commit | b278e443761df27a6e425ec4652f33bd494ceb94 (patch) | |
tree | 8223d8ad613f5d190f2728a48a8c2face68a4c73 /src/module.c | |
parent | c07e16fadd2de67be99b627b07310f7015c1085a (diff) | |
download | redis-b278e443761df27a6e425ec4652f33bd494ceb94.tar.gz |
Revert "Fix: server will crash if rdbload or rdbsave method is not provided in module (#8670)" (#8771)
This reverts commit 808f3004f0de8c129b3067d8b2ce5002fa703e77.
Diffstat (limited to 'src/module.c')
-rw-r--r-- | src/module.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/module.c b/src/module.c index ff36a9f86..f24c0af2a 100644 --- a/src/module.c +++ b/src/module.c @@ -4374,9 +4374,9 @@ robj *moduleTypeDupOrReply(client *c, robj *fromkey, robj *tokey, robj *value) { * .defrag = myType_DefragCallback * } * - * * **rdb_load**: A callback function pointer that loads data from RDB files. (mandatory) - * * **rdb_save**: A callback function pointer that saves data to RDB files. (mandatory) - * * **aof_rewrite**: A callback function pointer that rewrites data as commands. (mandatory) + * * **rdb_load**: A callback function pointer that loads data from RDB files. + * * **rdb_save**: A callback function pointer that saves data to RDB files. + * * **aof_rewrite**: A callback function pointer that rewrites data as commands. * * **digest**: A callback function pointer that is used for `DEBUG DIGEST`. * * **free**: A callback function pointer that can free a type value. * * **aux_save**: A callback function pointer that saves out of keyspace data to RDB files. @@ -4416,8 +4416,8 @@ robj *moduleTypeDupOrReply(client *c, robj *fromkey, robj *tokey, robj *value) { * Note: the module name "AAAAAAAAA" is reserved and produces an error, it * happens to be pretty lame as well. * - * If there is already a module registering a type with the same name, the name - * or encver are invalid, or a mandatory callback is missing, NULL is returned. + * If there is already a module registering a type with the same name, + * and if the module name or encver is invalid, NULL is returned. * Otherwise the new type is registered into Redis, and a reference of * type RedisModuleType is returned: the caller of the function should store * this reference into a global variable to make future use of it in the @@ -4460,16 +4460,6 @@ moduleType *RM_CreateDataType(RedisModuleCtx *ctx, const char *name, int encver, } v3; } *tms = (struct typemethods*) typemethods_ptr; - /* Persistence functions can't be NULL */ - if (tms->rdb_load == NULL || tms->rdb_save == NULL || tms->aof_rewrite == NULL) { - return NULL; - } - - /* Function aux_load and aux_save must be either both defined or undefined. */ - if ((tms->version >= 2) && ((tms->v2.aux_load != NULL) != (tms->v2.aux_save != NULL))) { - return NULL; - } - moduleType *mt = zcalloc(sizeof(*mt)); mt->id = id; mt->module = ctx->module; |