Redis 4.0.0-RC1 (version number 3.9.101) is the first release candidate of
Redis 4.0. It is not a production quality release but all the major features
received some testing at this point, the release in feature freeze excluding
things that are considered in the middle ground between fixes and improvements.
Happy hacking!
Redis 4.0 is not called 3.4 because it is a major release that adds a number
of important and non trivial features. Many core functionalities of Redis were
seriously reworked. In the next release candidates, with your help, we'll gain
informations about the stability level of this release and will produce a new
RC every 2-4 weeks. When the entity and frequency of bug reports will slow down
under a certain level, Redis 4.0 final will be released.
As usually, certain changes to Cluster and Sentinel may not follow the Redis
release cycle and could be incorporated into Redis 4.0 at RC stage or even
after the final version, every time the changes are considered to benefit
the user base enough to be worth incorporating them ASAP without waiting
for Redis 4.2.
So, what's new in Redis 4.0?
Major features
---
* Redis modules system. Redis now allows developers to write modules that can extend the Redis functionalities and implement new data types. The module API implements a complete abstraction layer that separates the Redis core from the module implementation, allowing the same module to be loaded by different versions of Redis without modifications. See the modules documentation here for more info: https://github.com/antirez/redis/blob/unstable/src/modules/INTRO.md
* Partial Replication (PSYNC) version 2. The replication protocol was enhanced (in a backward compatible way, so that 4.0 can still act as a slave of older instances) in order to be able to partially resynchronize slaves and masters in conditions where it was impossible in the past: after a master switch because of a failover and when a slave instance is restared. Even masters turned into slaves will usually be able to partially resynchronize with the new master, if the new master was a former slave of the old master instance. The way the replication work for chained slaves (sub-slaves) is now very different, and each slave receives the same replication stream generated by the top-level master.
* Cache eviction improvements. Redis 4.0 implements LFU (Least Frequently Used) as a new eviction algorithm, and improves the functionality, performances and precision of the existing algorithms. This blog post contains info about the changes: http://antirez.com/news/109
* Lazy freeing of keys. Redis is now able to delete keys in the background in a different thread without blocking the server. The new `UNLINK` command is the same as `DEL` but working in a non blocking way. Similarly an `ASYNC` option was added to `FLUSHALL` and `FLUSHDB` in order to let the entire dataset or a single database to be freed asynchronously.
* Mixed RDB-AOF format. If enabled the new format is used when rewriting the AOF file: the rewrite uses the more compact and faster to generate RDB format, and an AOF stream is appended to the file. This allows faster rewrites and reloads when using the AOF persistence.
* A new MEMORY command, able to perform memory analysis of different kinds: troubleshooting of memory issues (with MEMORY DOCTOR, similar to LATENCY DOCTOR), reporting of the amount of memory used by a single key, more in-depth reporting of Redis memory usage compared to what the INFO command offers.
* Redis Cluster support for NAT / Docker. There are new functionalities in order to force cluster instances to announce specific sets of IP address, client and bus ports, to the rest of the cluster, regardless of the auto detected IP. This required a bus protocol change that will force users to mass-restart all the nodes of a Redis 3.2 installation in order to upgrade to 4.0.
* Redis uses now less memory in order to store the same amount of data. The gain depends a lot on the kind of dataset stored.
Smaller features
---
* Improvements to the RDB format to support 64 bit lengths, binary sorted set scores, and more. The RDB file check utility now uses the same code base of the one used by Redis itself in order to load the RDB file in memory.
* SWAPDB command: ability to completely and immediately (no latency) replace two Redis databases.
* Improvements to `dict.c`, the Redis hash table implementation.
* Security improvements mapping POST and Host: commands to QUIT in order to prevent cross protocol scripting attacks.
* RPUSHX and LPUSHX now accept a variable number of elements.
* Reporting of additional memory used by copy on write in the INFO output.
* Serious refactoring of many core parts of Redis.
List of commits
---
antirez in commit 434e6b2:
PSYNC2: Do not accept WAIT in slave instances.
1 file changed, 5 insertions(+)
antirez in commit 71e8d15:
Modules: change type registration API to use a struct of methods.
Cluster announce ip / port configuration handling.
3 files changed, 12 insertions(+)
antirez in commit a455e4b:
Cluster: add announce ip field in messages header.
1 file changed, 3 insertions(+), 2 deletions(-)
Itamar Haber in commit 9e46bf2:
Fixes a typo
1 file changed, 1 insertion(+), 1 deletion(-)
antirez in commit 8870a7e:
03_test_release.sh: proper cleanup before testing.
1 file changed, 2 insertions(+)
antirez in commit 5bbb09e:
Cluster: check packets length before accessing far fields.
1 file changed, 10 insertions(+), 5 deletions(-)
antirez in commit 751b566:
Sentinel: improve handling of known Sentinel instances.
1 file changed, 34 insertions(+), 19 deletions(-)
antirez in commit 5bc7e01:
Use a smoother running average for avg_ttl in INFO.
1 file changed, 9 insertions(+), 5 deletions(-)
antirez in commit fe44a7c:
Cluster: mismatch sender ID log put back at DEBUG level.
1 file changed, 1 insertion(+), 1 deletion(-)
antirez in commit d6c5922:
Cluster: fix missing ntohs() call to access gossip section port.
1 file changed, 1 insertion(+), 1 deletion(-)
antirez in commit 592419b:
Better address udpate strategy when processing gossip sections.
1 file changed, 15 insertions(+), 6 deletions(-)
antirez in commit 22892ce:
Merge branch 'unstable' of github.com:/antirez/redis into unstable
antirez in commit bc15586:
Fix memory leak in masterauth config option loading.
1 file changed, 1 insertion(+)
Salvatore Sanfilippo in commit 7837c48:
Merge pull request #3023 from itamarhaber/patch-2
Itamar Haber in commit 57f8230:
Removes an extra space in protected mode message
1 file changed, 1 insertion(+), 1 deletion(-)
antirez in commit 83b862a:
Minor MIGRATE refactoring.
1 file changed, 12 insertions(+), 5 deletions(-)
antirez in commit f5a1e60:
More variadic MIGRATE fixes.
1 file changed, 9 insertions(+), 8 deletions(-)
antirez in commit 00d3a40:
Various fixes to MIGRATE with multiple keys.
1 file changed, 45 insertions(+), 12 deletions(-)
antirez in commit cfc879b:
Merge branch 'unstable' of github.com:/antirez/redis into unstable
antirez in commit b01b32b:
Test: Handle LOADING in restart_instance.
1 file changed, 12 insertions(+)
Salvatore Sanfilippo in commit 8637384:
Merge pull request #2726 from seppo0010/patch-2
antirez in commit 5432fc8:
Detect and show crashes on Sentinel/Cluster tests.
1 file changed, 18 insertions(+)
antirez in commit fc3ca8f:
Cluster: fix setting nodes slaveof pointer to NULL on node release.
1 file changed, 3 insertions(+), 14 deletions(-)
antirez in commit a411d55:
Cluster: clarify node->slave may be NULL.
1 file changed, 4 insertions(+), 1 deletion(-)
Jan-Erik Rediger in commit 15dacfe:
Fix nanosecond conversion
1 file changed, 1 insertion(+), 1 deletion(-)
antirez in commit f984cef:
Cluster: fix rebalancing to always empty nodes.
1 file changed, 24 insertions(+), 3 deletions(-)
root in commit 28e80bf:
fix linux compile bug
2 files changed, 9 insertions(+), 9 deletions(-)
antirez in commit 152e9f6:
Cluster: redis-trib move_to_slot: don't send SETSLOT to slaves.
1 file changed, 1 insertion(+)
Daniel Shih in commit e6d9705:
Fix a possible race condition of sdown detection if the connection to master/slave/sentinel decames disconnected just after the last PONG and before the next PING.
1 file changed, 2 insertions(+)
antirez in commit c6e5088:
Cluster: fix redis-trib reference of variable in warning.