summaryrefslogtreecommitdiff
path: root/src/module.c
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2021-04-13 17:41:46 +0300
committerGitHub <noreply@github.com>2021-04-13 17:41:46 +0300
commitb278e443761df27a6e425ec4652f33bd494ceb94 (patch)
tree8223d8ad613f5d190f2728a48a8c2face68a4c73 /src/module.c
parentc07e16fadd2de67be99b627b07310f7015c1085a (diff)
downloadredis-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.c20
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;