Skip to content

Commit ed2e0e6

Browse files
committed
Merge tag '6.0.4' into unstable
Redis 6.0.4. Former-commit-id: 9c31ac7
2 parents a768c26 + c512f64 commit ed2e0e6

33 files changed

Lines changed: 1169 additions & 380 deletions

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: CI
33
on: [push, pull_request]
44

55
jobs:
6+
67
test-ubuntu-latest:
78
runs-on: ubuntu-latest
89
steps:
@@ -59,3 +60,20 @@ jobs:
5960
- uses: actions/checkout@v1
6061
- name: make
6162
run: make -j2
63+
64+
biuld-32bit:
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v1
68+
- name: make
69+
run: |
70+
sudo apt-get update && sudo apt-get install libc6-dev-i386
71+
make 32bit
72+
73+
build-libc-malloc:
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@v1
77+
- name: make
78+
run: make MALLOC=libc
79+

.github/workflows/daily.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
- cron: '0 7 * * *'
66

77
jobs:
8+
89
test-jemalloc:
910
runs-on: ubuntu-latest
1011
timeout-minutes: 1200
@@ -37,6 +38,38 @@ jobs:
3738
- name: module api test
3839
run: ./runtest-moduleapi --verbose
3940

41+
test-32bit:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v1
45+
- name: make
46+
run: |
47+
sudo apt-get update && sudo apt-get install libc6-dev-i386
48+
make 32bit
49+
- name: test
50+
run: |
51+
sudo apt-get install tcl8.5
52+
./runtest --accurate --verbose
53+
- name: module api test
54+
run: |
55+
make -C tests/modules 32bit # the script below doesn't have an argument, we must build manually ahead of time
56+
./runtest-moduleapi --verbose
57+
58+
test-tls:
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v1
62+
- name: make
63+
run: |
64+
make BUILD_TLS=yes
65+
- name: test
66+
run: |
67+
sudo apt-get install tcl8.5 tcl-tls
68+
./utils/gen-test-certs.sh
69+
./runtest --accurate --verbose --tls
70+
- name: module api test
71+
run: ./runtest-moduleapi --verbose --tls
72+
4073
test-valgrind:
4174
runs-on: ubuntu-latest
4275
timeout-minutes: 14400

00-RELEASENOTES

Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,283 @@ CRITICAL: There is a critical bug affecting MOST USERS. Upgrade ASAP.
1111
SECURITY: There are security fixes in the release.
1212
--------------------------------------------------------------------------------
1313

14+
================================================================================
15+
Redis 6.0.4 Released Thu May 28 11:36:45 CEST 2020
16+
================================================================================
17+
18+
Upgrade urgency CRITICAL: this release fixes a severe replication bug.
19+
20+
Redis 6.0.4 fixes a critical replication bug caused by a new feature introduced
21+
in Redis 6. The feature, called "meaningful offset" and strongly wanted by
22+
myself (antirez) was an improvement that avoided that masters were no longer
23+
able, during a failover where they were demoted to replicas, to partially
24+
synchronize with the new master. In short the feature was able to avoid full
25+
synchronizations with RDB. How did it work? By trimming the replication backlog
26+
of the final "PING" commands the master was sending in the replication channel:
27+
this way the replication offset would no longer go "after" the one of the
28+
promoted replica, allowing the master to just continue in the same replication
29+
history, receiving only a small data difference.
30+
31+
However after the introduction of the feature we (the Redis core team) quickly
32+
understood there was something wrong: the apparently harmless feature had
33+
many bugs, and the last bug we discovered, after a joined effort of multiple
34+
people, we were not even able to fully understand after fixing it. Enough was
35+
enough, we decided that the complexity cost of this feature was too high.
36+
So Redis 6.0.4 removes the feature entirely, and fixes the data corruption that
37+
it was able to cause.
38+
39+
However there are two facts to take in mind.
40+
41+
Fact 1: Setups using chained replication, that means that certain replicas
42+
are replicating from other replicas, up to Redis 6.0.3 can experience data
43+
corruption. For chained replication we mean that:
44+
45+
+--------+ +---------+ +-------------+
46+
| master |--------->| replica |-------->| sub-replica |
47+
+--------+ +---------+ +-------------+
48+
49+
50+
People using chained replication SHOULD UPGRADE ASAP away from Redis 6.0.0,
51+
6.0.1, 6.0.2 or 6.0.3 to Redis 6.0.4.
52+
53+
To be clear, people NOT using this setup, but having just replicas attached
54+
directly to the master, SHOUDL NOT BE in danger of any problem. But we
55+
are no longer confident on 6.0.x replication implementation complexities
56+
so we suggest to upgrade to 6.0.4 to everybody using an older 6.0.3 release.
57+
We just so far didn't find any bug that affects Redis 6.0.3 that does not
58+
involve chained replication.
59+
60+
People starting with Redis 6.0.4 are fine. People with Redis 5 are fine.
61+
People upgrading from Redis 5 to Redis 6.0.4 are fine.
62+
TLDR: The problem is with users of 6.0.0, 6.0.1, 6.0.2, 6.0.3.
63+
64+
Fact 2: Upgrading from Redis 6.0.x to Redis 6.0.4, IF AND ONLY IF you
65+
use chained replication, requires some extra care:
66+
67+
1. Once you attach your new Redis 6.0.4 instance as a replica of the current
68+
Redis 6.0.x master, you should wait for the first full synchronization,
69+
then you should promote it right away, if your setup involves chained
70+
replication. Don't give it the time to do a new partial synchronization
71+
in the case the link between the master and the replica will break in
72+
the mean time.
73+
74+
2. As an additional care, you may want to set the replication ping period
75+
to a very large value (for instance 1000000) using the following command:
76+
77+
CONFIG SET repl-ping-replica-period 1000000
78+
79+
Note that if you do "1" with care, "2" is not needed.
80+
However if you do it, make sure to later restore it to its default:
81+
82+
CONFIG SET repl-ping-replica-period 10
83+
84+
So this is the main change in Redis 6. Later we'll find a different way in
85+
order to achieve what we wanted to achieve with the Meaningful Offset feature,
86+
but without the same complexity.
87+
88+
Other changes in this release:
89+
90+
* PSYNC2 tests improved.
91+
* Fix a rare active defrag edge case bug leading to stagnation
92+
* Fix Redis 6 asserting at startup in 32 bit systems.
93+
* Redis 6 32 bit is now added back to our testing environments.
94+
* Fix server crash for STRALGO command,
95+
* Implement sendfile for RDB transfer.
96+
* TLS fixes.
97+
* Make replication more resistant by disconnecting the master if we
98+
detect a protocol error. Basically we no longer accept inline protocol
99+
from the master.
100+
* Other improvements in the tests.
101+
102+
Regards,
103+
antirez
104+
105+
This is the full list of commits:
106+
107+
antirez in commit 59cd4c9f6:
108+
Test: take PSYNC2 test master timeout high during switch.
109+
1 file changed, 1 deletion(-)
110+
111+
antirez in commit 6c1bb7b19:
112+
Test: add the tracking unit as default.
113+
1 file changed, 1 insertion(+)
114+
115+
Oran Agra in commit 1aee695e5:
116+
tests: find_available_port start search from next port
117+
1 file changed, 12 insertions(+), 7 deletions(-)
118+
119+
Oran Agra in commit a2ae46352:
120+
tests: each test client work on a distinct port range
121+
5 files changed, 39 insertions(+), 27 deletions(-)
122+
123+
Oran Agra in commit 86e562d69:
124+
32bit CI needs to build modules correctly
125+
2 files changed, 7 insertions(+), 2 deletions(-)
126+
127+
Oran Agra in commit ab2984b1e:
128+
adjust revived meaningful offset tests
129+
1 file changed, 39 insertions(+), 20 deletions(-)
130+
131+
Oran Agra in commit 1ff5a222d:
132+
revive meaningful offset tests
133+
2 files changed, 213 insertions(+)
134+
135+
antirez in commit cc549b46a:
136+
Replication: showLatestBacklog() refactored out.
137+
3 files changed, 36 insertions(+), 25 deletions(-)
138+
139+
antirez in commit 377dd0515:
140+
Drop useless line from replicationCacheMaster().
141+
1 file changed, 2 deletions(-)
142+
143+
antirez in commit 3f8d113f1:
144+
Another meaningful offset test removed.
145+
1 file changed, 100 deletions(-)
146+
147+
antirez in commit d4541349d:
148+
Remove the PSYNC2 meaningful offset test.
149+
2 files changed, 113 deletions(-)
150+
151+
antirez in commit 2112a5702:
152+
Remove the meaningful offset feature.
153+
4 files changed, 10 insertions(+), 93 deletions(-)
154+
155+
antirez in commit d2eb6e0b4:
156+
Set a protocol error if master use the inline protocol.
157+
1 file changed, 17 insertions(+), 2 deletions(-)
158+
159+
Oran Agra in commit 9c1df3b76:
160+
daily CI test with tls
161+
1 file changed, 15 insertions(+)
162+
163+
Oran Agra in commit 115ed1911:
164+
avoid using sendfile if tls-replication is enabled
165+
1 file changed, 34 insertions(+), 27 deletions(-)
166+
167+
antirez in commit 11c748aac:
168+
Replication: log backlog creation event.
169+
1 file changed, 3 insertions(+)
170+
171+
antirez in commit 8f1013722:
172+
Test: PSYNC2 test can now show server logs.
173+
1 file changed, 88 insertions(+), 25 deletions(-)
174+
175+
antirez in commit 2e591fc4a:
176+
Clarify what is happening in PR #7320.
177+
1 file changed, 5 insertions(+), 1 deletion(-)
178+
179+
zhaozhao.zz in commit cbb51fb8f:
180+
PSYNC2: second_replid_offset should be real meaningful offset
181+
1 file changed, 3 insertions(+), 3 deletions(-)
182+
183+
Oran Agra in commit e0fc88b4d:
184+
add CI for 32bit build
185+
2 files changed, 34 insertions(+)
186+
187+
antirez in commit e3f864b5f:
188+
Make disconnectSlaves() synchronous in the base case.
189+
3 files changed, 20 insertions(+), 9 deletions(-)
190+
191+
ShooterIT in commit 8af1e513f:
192+
Implements sendfile for redis.
193+
2 files changed, 55 insertions(+), 2 deletions(-)
194+
195+
antirez in commit 3c21418cd:
196+
Fix #7306 less aggressively.
197+
2 files changed, 29 insertions(+), 17 deletions(-)
198+
199+
Madelyn Olson in commit e201f83ce:
200+
EAGAIN for tls during diskless load
201+
1 file changed, 4 insertions(+)
202+
203+
Qu Chen in commit 58fc456cb:
204+
Disconnect chained replicas when the replica performs PSYNC with the master always to avoid replication offset mismatch between master and chained replicas.
205+
2 files changed, 60 insertions(+), 3 deletions(-)
206+
207+
hwware in commit 3febc5c29:
208+
using moreargs variable
209+
1 file changed, 2 insertions(+), 2 deletions(-)
210+
211+
hwware in commit 8d6738559:
212+
fix server crash for STRALGO command
213+
1 file changed, 2 insertions(+), 2 deletions(-)
214+
215+
ShooterIT in commit 7a35eec54:
216+
Replace addDeferredMultiBulkLength with addReplyDeferredLen in comment
217+
1 file changed, 2 insertions(+), 2 deletions(-)
218+
219+
Yossi Gottlieb in commit f93e1417b:
220+
TLS: Improve tls-protocols clarity in redis.conf.
221+
1 file changed, 3 insertions(+), 2 deletions(-)
222+
223+
ShooterIT in commit d0c9e4454:
224+
Fix reply bytes calculation error
225+
1 file changed, 1 insertion(+), 1 deletion(-)
226+
227+
zhaozhao.zz in commit 1cde6a060:
228+
Tracking: flag CLIENT_TRACKING_BROKEN_REDIR when redir broken
229+
1 file changed, 1 insertion(+)
230+
231+
Oran Agra in commit 436be3498:
232+
fix a rare active defrag edge case bug leading to stagnation
233+
4 files changed, 146 insertions(+), 23 deletions(-)
234+
235+
Oran Agra in commit f9d2ffdc5:
236+
improve DEBUG MALLCTL to be able to write to write only fields.
237+
1 file changed, 27 insertions(+), 7 deletions(-)
238+
239+
hujie in commit d7968ee92:
240+
fix clear USER_FLAG_ALLCOMMANDS flag in acl
241+
1 file changed, 5 insertions(+), 4 deletions(-)
242+
243+
ShooterIT in commit a902e6b25:
244+
Redis Benchmark: generate random test data
245+
1 file changed, 12 insertions(+), 1 deletion(-)
246+
247+
hwware in commit 9564ed7c3:
248+
Redis-Benchmark: avoid potentical memmory leaking
249+
1 file changed, 1 insertion(+), 1 deletion(-)
250+
251+
WuYunlong in commit 2e4182743:
252+
Handle keys with hash tag when computing hash slot using tcl cluster client.
253+
1 file changed, 23 insertions(+), 2 deletions(-)
254+
255+
WuYunlong in commit eb2c8b2c6:
256+
Add a test to prove current tcl cluster client can not handle keys with hash tag.
257+
1 file changed, 7 insertions(+), 1 deletion(-)
258+
259+
ShooterIT in commit 928e6976b:
260+
Use dictSize to get the size of dict in dict.c
261+
1 file changed, 2 insertions(+), 2 deletions(-)
262+
263+
Madelyn Olson in commit cdcf5af5a:
264+
Converge hash validation for adding and removing
265+
1 file changed, 21 insertions(+), 14 deletions(-)
266+
267+
Benjamin Sergeant in commit e8b09d220:
268+
do not handle --cluster-yes for cluster fix mode
269+
1 file changed, 16 insertions(+), 7 deletions(-)
270+
271+
Benjamin Sergeant in commit 57b4fb0d8:
272+
fix typo ...
273+
1 file changed, 1 insertion(+), 1 deletion(-)
274+
275+
Benjamin Sergeant in commit 29f25e411:
276+
Redis-cli 6.0.1 `--cluster-yes` doesn't work (fix #7246)
277+
1 file changed, 5 insertions(+), 1 deletion(-)
278+
279+
Oran Agra in commit 00d8b92b8:
280+
fix valgrind test failure in replication test
281+
1 file changed, 1 insertion(+), 1 deletion(-)
282+
283+
Oran Agra in commit 5e17e6276:
284+
add regression test for the race in #7205
285+
1 file changed, 52 insertions(+)
286+
287+
antirez in commit 96e7c011e:
288+
Improve the PSYNC2 test reliability.
289+
1 file changed, 33 insertions(+), 15 deletions(-)
290+
14291
================================================================================
15292
Redis 6.0.3 Released Sat May 16 18:10:21 CEST 2020
16293
================================================================================

deps/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ ixalloc(tsdn_t *tsdn, void *ptr, size_t oldsize, size_t size, size_t extra,
216216
}
217217

218218
JEMALLOC_ALWAYS_INLINE int
219-
iget_defrag_hint(tsdn_t *tsdn, void* ptr, int *bin_util, int *run_util) {
219+
iget_defrag_hint(tsdn_t *tsdn, void* ptr) {
220220
int defrag = 0;
221221
rtree_ctx_t rtree_ctx_fallback;
222222
rtree_ctx_t *rtree_ctx = tsdn_rtree_ctx(tsdn, &rtree_ctx_fallback);
@@ -232,11 +232,22 @@ iget_defrag_hint(tsdn_t *tsdn, void* ptr, int *bin_util, int *run_util) {
232232
malloc_mutex_lock(tsdn, &bin->lock);
233233
/* don't bother moving allocations from the slab currently used for new allocations */
234234
if (slab != bin->slabcur) {
235-
const bin_info_t *bin_info = &bin_infos[binind];
236-
size_t availregs = bin_info->nregs * bin->stats.curslabs;
237-
*bin_util = ((long long)bin->stats.curregs<<16) / availregs;
238-
*run_util = ((long long)(bin_info->nregs - extent_nfree_get(slab))<<16) / bin_info->nregs;
239-
defrag = 1;
235+
int free_in_slab = extent_nfree_get(slab);
236+
if (free_in_slab) {
237+
const bin_info_t *bin_info = &bin_infos[binind];
238+
int curslabs = bin->stats.curslabs;
239+
size_t curregs = bin->stats.curregs;
240+
if (bin->slabcur) {
241+
/* remove slabcur from the overall utilization */
242+
curregs -= bin_info->nregs - extent_nfree_get(bin->slabcur);
243+
curslabs -= 1;
244+
}
245+
/* Compare the utilization ratio of the slab in question to the total average,
246+
* to avoid precision lost and division, we do that by extrapolating the usage
247+
* of the slab as if all slabs have the same usage. If this slab is less used
248+
* than the average, we'll prefer to evict the data to hopefully more used ones */
249+
defrag = (bin_info->nregs - free_in_slab) * curslabs <= curregs;
250+
}
240251
}
241252
malloc_mutex_unlock(tsdn, &bin->lock);
242253
}

0 commit comments

Comments
 (0)