Hi, @antirez

After 4.0.6 we store the replication information correctly and persist the script cache as well, PSYNC2 is completed and safe I think.

Recently I am thinking about remove the replication script cache(repl_scriptcache_dict and repl_scriptcache_fifo), because we already persist scripts in RDB file, so no matter PSYNC after a restart or FULLRESYNC a new slave connect, slaves can hold all the same scripts in master.

But what I worry about is that the old version redis is not compatible, because they rely on the replication script cache to transfer EVALSHA to EVAL after FULLRESYNC and AOF REWRITE.

Last week I see that you turn the RDB version to 9, I think it's the time to implement a improvement which can propagate lua scripts simply and save memory.

  1. Firstly, I think both RDB and AOF should contain the lua scripts, even after BGSAVE or BGREWRITEAOF.

  2. Secondly, remove the replication script cache, because we can guarantee that all the scripts are already in the context of all the attached slaves and the current AOF file if enabled.

  3. At last, we can propagate the script in EVAL command by a more explicit way, split the EVAL command to SCRIPT LOAD and EVALSHA if needed. That can make redis execute EVALSHA after failover even the sha1 code is generated by read only EVAL.

See more details in PR #4966.

Comment From: oranagra

no longer relevant, script propagation was deprecated in #9812