diff options
-rw-r--r-- | src/module.c | 2 | ||||
-rw-r--r-- | tests/unit/moduleapi/misc.tcl | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/module.c b/src/module.c index 28d2cad55..19e60400f 100644 --- a/src/module.c +++ b/src/module.c @@ -3899,7 +3899,7 @@ int RM_SetAbsExpire(RedisModuleKey *key, mstime_t expire) { * When async is set to true, db contents will be freed by a background thread. */ void RM_ResetDataset(int restart_aof, int async) { if (restart_aof && server.aof_state != AOF_OFF) stopAppendOnly(); - flushAllDataAndResetRDB(async? EMPTYDB_ASYNC: EMPTYDB_NO_FLAGS); + flushAllDataAndResetRDB((async? EMPTYDB_ASYNC: EMPTYDB_NO_FLAGS) | EMPTYDB_NOFUNCTIONS); if (server.aof_enabled && restart_aof) restartAOFAfterSYNC(); } diff --git a/tests/unit/moduleapi/misc.tcl b/tests/unit/moduleapi/misc.tcl index caeed37b2..8aa5b9198 100644 --- a/tests/unit/moduleapi/misc.tcl +++ b/tests/unit/moduleapi/misc.tcl @@ -44,6 +44,16 @@ start_server {tags {"modules"}} { assert_equal [r test.dbsize] 0 } + test {test RedisModule_ResetDataset do not reset functions} { + r function load {#!lua name=lib + redis.register_function('test', function() return 1 end) + } + assert_equal [r function list] {{library_name lib engine LUA functions {{name test description {} flags {}}}}} + r test.flushall + assert_equal [r function list] {{library_name lib engine LUA functions {{name test description {} flags {}}}}} + r function flush + } + test {test module keyexists} { r set x foo assert_equal 1 [r test.keyexists x] |