summaryrefslogtreecommitdiff
path: root/src/rdb.c
diff options
context:
space:
mode:
authorzhugezy <44550833+zhugezy@users.noreply.github.com>2021-12-21 14:32:42 +0800
committerGitHub <noreply@github.com>2021-12-21 08:32:42 +0200
commit1b0968df46f9f838e7daa540675b29073a00cf30 (patch)
treed0bf1e2b5c6e3566dfe8486963e7b55f4ce8431a /src/rdb.c
parentfebc3f63b2b57afe3553b22c69c3ce27b5a3e842 (diff)
downloadredis-1b0968df46f9f838e7daa540675b29073a00cf30.tar.gz
Remove EVAL script verbatim replication, propagation, and deterministic execution logic (#9812)
# Background The main goal of this PR is to remove relevant logics on Lua script verbatim replication, only keeping effects replication logic, which has been set as default since Redis 5.0. As a result, Lua in Redis 7.0 would be acting the same as Redis 6.0 with default configuration from users' point of view. There are lots of reasons to remove verbatim replication. Antirez has listed some of the benefits in Issue #5292: >1. No longer need to explain to users side effects into scripts. They can do whatever they want. >2. No need for a cache about scripts that we sent or not to the slaves. >3. No need to sort the output of certain commands inside scripts (SMEMBERS and others): this both simplifies and gains speed. >4. No need to store scripts inside the RDB file in order to startup correctly. >5. No problems about evicting keys during the script execution. When looking back at Redis 5.0, antirez and core team decided to set the config `lua-replicate-commands yes` by default instead of removing verbatim replication directly, in case some bad situations happened. 3 years later now before Redis 7.0, it's time to remove it formally. # Changes - configuration for lua-replicate-commands removed - created config file stub for backward compatibility - Replication script cache removed - this is useless under script effects replication - relevant statistics also removed - script persistence in RDB files is also removed - Propagation of SCRIPT LOAD and SCRIPT FLUSH to replica / AOF removed - Deterministic execution logic in scripts removed (i.e. don't run write commands after random ones, and sorting output of commands with random order) - the flags indicating which commands have non-deterministic results are kept as hints to clients. - `redis.replicate_commands()` & `redis.set_repl()` changed - now `redis.replicate_commands()` does nothing and return an 1 - ...and then `redis.set_repl()` can be issued before `redis.replicate_commands()` now - Relevant TCL cases adjusted - DEBUG lua-always-replicate-commands removed # Other changes - Fix a recent bug comparing CLIENT_ID_AOF to original_client->flags instead of id. (introduced in #9780) Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'src/rdb.c')
-rw-r--r--src/rdb.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/rdb.c b/src/rdb.c
index de0cd3bc5..da817eeb5 100644
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -1319,21 +1319,6 @@ int rdbSaveRio(rio *rdb, int *error, int rdbflags, rdbSaveInfo *rsi) {
di = NULL; /* So that we don't release it again on error. */
}
- /* If we are storing the replication information on disk, persist
- * the script cache as well: on successful PSYNC after a restart, we need
- * to be able to process any EVALSHA inside the replication backlog the
- * master will send us. */
- if (rsi && dictSize(evalScriptsDict())) {
- di = dictGetIterator(evalScriptsDict());
- while((de = dictNext(di)) != NULL) {
- robj *body = dictGetVal(de);
- if (rdbSaveAuxField(rdb,"lua",3,body->ptr,sdslen(body->ptr)) == -1)
- goto werr;
- }
- dictReleaseIterator(di);
- di = NULL; /* So that we don't release it again on error. */
- }
-
if (rdbSaveModulesAux(rdb, REDISMODULE_AUX_AFTER_RDB) == -1) goto werr;
/* EOF opcode */
@@ -2900,12 +2885,7 @@ int rdbLoadRioWithLoadingCtx(rio *rdb, int rdbflags, rdbSaveInfo *rsi, rdbLoadin
} else if (!strcasecmp(auxkey->ptr,"repl-offset")) {
if (rsi) rsi->repl_offset = strtoll(auxval->ptr,NULL,10);
} else if (!strcasecmp(auxkey->ptr,"lua")) {
- /* Load the script back in memory. */
- if (luaCreateFunction(NULL, auxval) == NULL) {
- rdbReportCorruptRDB(
- "Can't load Lua script from RDB file! "
- "BODY: %s", (char*)auxval->ptr);
- }
+ /* Won't load the script back in memory anymore. */
} else if (!strcasecmp(auxkey->ptr,"redis-ver")) {
serverLog(LL_NOTICE,"Loading RDB produced by version %s",
(char*)auxval->ptr);