9527 Commits

Author SHA1 Message Date
Salvatore Sanfilippo
f0d8484f82 Merge pull request #7289 from oranagra/defrag_edge_case
fix a rare active defrag edge case bug leading to stagnation
2020-05-20 15:17:02 +02:00
Oran Agra
86b1b2e138 fix a rare active defrag edge case bug leading to stagnation
There's a rare case which leads to stagnation in the defragger, causing
it to keep scanning the keyspace and do nothing (not moving any
allocation), this happens when all the allocator slabs of a certain bin
have the same % utilization, but the slab from which new allocations are
made have a lower utilization.

this commit fixes it by removing the current slab from the overall
average utilization of the bin, and also eliminate any precision loss in
the utilization calculation and move the decision about the defrag to
reside inside jemalloc.

and also add a test that consistently reproduce this issue.
2020-05-20 16:04:42 +03:00
Yossi Gottlieb
5c82140f66 TLS: Improve tls-protocols clarity in redis.conf. 2020-05-20 15:14:23 +03:00
Oran Agra
444af0145e improve DEBUG MALLCTL to be able to write to write only fields.
also support:
  debug mallctl-str thread.tcache.flush VOID
2020-05-20 14:09:22 +03:00
Salvatore Sanfilippo
a5268a21bc Merge pull request #7276 from hujiecs/fix-clear-all-command-flag-in-acl
fix clear USER_FLAG_ALLCOMMANDS flag in acl
2020-05-19 16:19:28 +02:00
Salvatore Sanfilippo
83521eb832 Merge pull request #7196 from ShooterIT/benchmark
Redis Benchmark: make test data better
2020-05-19 16:16:38 +02:00
Salvatore Sanfilippo
39dca920f6 Merge pull request #7279 from hwware/benchmark_leak_fix
Redis-Benchmark: avoid potentical memmory leaking
2020-05-19 16:14:30 +02:00
Salvatore Sanfilippo
1281ca2947 Merge pull request #7232 from trevor211/handleHashTagWhenComputingHashSlot
Tcl client support hash tagged keys.
2020-05-19 09:23:44 +02:00
hwware
2b4f14387e Redis-Benchmark: avoid potentical memmory leaking 2020-05-18 22:10:57 -04:00
hujie
66214e3713 fix clear USER_FLAG_ALLCOMMANDS flag in acl
in ACLSetUserCommandBit, when the command bit overflows, no operation
is performed, so no need clear the USER_FLAG_ALLCOMMANDS flag.

in ACLSetUser, when adding subcommand, we don't need to call
ACLGetCommandID ahead since subcommand may be empty.
2020-05-19 00:58:58 +08:00
ShooterIT
16c95dce51 Redis Benchmark: generate random test data
The function of generating random data is designed by antirez. See #7196.
2020-05-18 18:18:27 +08:00
Salvatore Sanfilippo
2b5759908a Merge pull request #7252 from ShooterIT/dictsize
Use dictSize to get the size of dict in dict.c
2020-05-18 10:33:08 +02:00
Salvatore Sanfilippo
4771af6a76 Merge pull request #7255 from madolson/dev-unstable-converge-hash-validation
Converge hash validation for adding and removing
2020-05-18 10:31:47 +02:00
Salvatore Sanfilippo
5c6631d941 Merge pull request #7247 from bsergean/patch-3
Redis-cli 6.0.1 `--cluster-yes` doesn't work (fix #7246)
2020-05-18 10:23:54 +02:00
Salvatore Sanfilippo
187d21c592 Merge pull request #7271 from oranagra/fix_valgrind_repl_test
fix valgrind test failure in replication test
2020-05-18 10:09:39 +02:00
Oran Agra
7c88eca1e6 fix valgrind test failure in replication test
in 00323f342 i added more keys to that test to make it run longer
but in valgrind this now means the test times out, give valgrind more
time.
2020-05-18 10:26:53 +03:00
antirez
857bf0b4b9 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2020-05-17 18:24:48 +02:00
antirez
5781712458 Improve the PSYNC2 test reliability. 2020-05-17 18:24:34 +02:00
Salvatore Sanfilippo
3eac39fa96 Merge pull request #7264 from oranagra/test_for_7205
add regression test for the race in #7205
2020-05-17 17:59:14 +02:00
Oran Agra
ba6f40ea94 add regression test for the race in #7205
with the original version of 6.0.0, this test detects an excessive full
sync.
with the fix in 146201c69, this test detects memory corruption,
especially when using libc allocator with or without valgrind.
2020-05-17 18:26:02 +03:00
antirez
492bbefdb0 Remove the client from CLOSE_ASAP list before caching the master.
This was broken in 146201c: we identified a crash in the CI, what
was happening before the fix should be like that:

1. The client gets in the async free list.
2. However freeClient() gets called again against the same client
   which is a master.
3. The client arrived in freeClient() with the CLOSE_ASAP flag set.
4. The master gets cached, but NOT removed from the CLOSE_ASAP linked
   list.
5. The master client that was cached was immediately removed since it
   was still in the list.
6. Redis accessed a freed cached master.

This is how the crash looked like:

=== REDIS BUG REPORT START: Cut & paste starting from here ===
1092:S 16 May 2020 11:44:09.731 # Redis 999.999.999 crashed by signal: 11
1092:S 16 May 2020 11:44:09.731 # Crashed running the instruction at: 0x447e18
1092:S 16 May 2020 11:44:09.731 # Accessing address: 0xffffffffffffffff
1092:S 16 May 2020 11:44:09.731 # Failed assertion:  (:0)

------ STACK TRACE ------
EIP:
src/redis-server 127.0.0.1:21300(readQueryFromClient+0x48)[0x447e18]

And the 0xffff address access likely comes from accessing an SDS that is
set to NULL (we go -1 offset to read the header).
2020-05-16 17:15:35 +02:00
antirez
bf6bf4e8de Merge branch 'unstable' of github.com:/antirez/redis into unstable 2020-05-15 10:21:51 +02:00
antirez
146201c694 Cache master without checking of deferred close flags.
The context is issue #7205: since the introduction of threaded I/O we close
clients asynchronously by default from readQueryFromClient(). So we
should no longer prevent the caching of the master client, to later
PSYNC incrementally, if such flags are set. However we also don't want
the master client to be cached with such flags (would be closed
immediately after being restored). And yet we want a way to understand
if a master was closed because of a protocol error, and in that case
prevent the caching.
2020-05-15 10:19:13 +02:00
Benjamin Sergeant
4bbf07dbbb do not handle --cluster-yes for cluster fix mode 2020-05-14 15:29:06 -07:00
Madelyn Olson
4e8d141cba Converge hash validation for adding and removing 2020-05-14 11:07:51 -07:00
Salvatore Sanfilippo
3c8824aa54 Merge pull request #7229 from yossigo/tls-fails-on-recent-debian
TLS: Fix test failures on recent Debian/Ubuntu.
2020-05-14 18:15:17 +02:00
Salvatore Sanfilippo
3a52c1c0ec Merge pull request #7230 from yossigo/tls-crypto-locks
TLS: Add crypto locks for older OpenSSL support.
2020-05-14 18:14:49 +02:00
Salvatore Sanfilippo
cff2fcb7c6 Merge pull request #7244 from devnexen/netbsd_build_fix
NetBSD build update.
2020-05-14 18:14:06 +02:00
Salvatore Sanfilippo
4932dd7fc3 Merge pull request #7253 from madolson/unstable-ae-recursion
Added a refcount on timer events to prevent deletion of recursive timer events
2020-05-14 18:10:57 +02:00
Madelyn Olson
1bc06c7e85 Added a refcount on timer events to prevent deletion of recursive timer calls 2020-05-14 08:49:11 -07:00
antirez
17546e831e Merge branch 'free_clients_during_loading' into unstable 2020-05-14 11:28:08 +02:00
antirez
94e78d22fd Regression test for #7249. 2020-05-14 11:27:31 +02:00
antirez
949521deb2 rax.c updated from upstream antirez/rax. 2020-05-14 11:17:47 +02:00
antirez
afcea23e1a Tracking: send eviction messages when evicting entries.
A fix for #7249.
2020-05-14 11:17:04 +02:00
antirez
e3166461ed Track events processed while blocked globally.
Related to #7234.
2020-05-14 10:06:27 +02:00
Benjamin Sergeant
ca5aaa961a fix typo ... 2020-05-13 09:32:27 -07:00
Benjamin Sergeant
c00b8e959a Redis-cli 6.0.1 --cluster-yes doesn't work (fix #7246)
This make it so that all prompts for all redis-cli --cluster commands are automatically answered with a yes.
2020-05-13 09:24:51 -07:00
David Carlier
f75ab4fcb5 NetBSD build update.
This platform supports CPU affinity (but not OpenBSD).
2020-05-12 21:21:22 +01:00
antirez
7a3005da90 Some rework of #7234. 2020-05-12 13:07:44 +02:00
Salvatore Sanfilippo
8ab703f73d Merge pull request #7240 from oranagra/fix_replication_test
fix unstable replication test
2020-05-12 08:44:18 +02:00
Oran Agra
00323f342d fix unstable replication test
this test which has coverage for varoius flows of diskless master was
failing randomly from time to time.

the failure was:
[err]: diskless all replicas drop during rdb pipe in tests/integration/replication.tcl
log message of '*Diskless rdb transfer, last replica dropped, killing fork child*' not found

what seemed to have happened is that the master didn't detect that all
replicas dropped by the time the replication ended, it thought that one
replica is still connected.

now the test takes a few seconds longer but it seems stable.
2020-05-12 08:59:09 +03:00
Oran Agra
b1913ae504 fix redis 6.0 not freeing closed connections during loading.
This bug was introduced by a recent change in which readQueryFromClient
is using freeClientAsync, and despite the fact that now
freeClientsInAsyncFreeQueue is in beforeSleep, that's not enough since
it's not called during loading in processEventsWhileBlocked.
furthermore, afterSleep was called in that case but beforeSleep wasn't.

This bug also caused slowness sine the level-triggered mode of epoll
kept signaling these connections as readable causing us to keep doing
connRead again and again for ll of these, which keep accumulating.

now both before and after sleep are called, but not all of their actions
are performed during loading, some are only reserved for the main loop.

fixes issue #7215
2020-05-11 11:33:46 +03:00
WuYunlong
ed326b743a Handle keys with hash tag when computing hash slot using tcl cluster client. 2020-05-11 13:14:18 +08:00
WuYunlong
82752a96b1 Add a test to prove current tcl cluster client can not handle keys with hash tag. 2020-05-11 13:14:18 +08:00
Yossi Gottlieb
e15f563368 TLS: Add crypto locks for older OpenSSL support.
This is really required only for older OpenSSL versions.

Also, at the moment Redis does not use OpenSSL from multiple threads so
this will only be useful if modules end up doing that.
2020-05-10 17:40:31 +03:00
Yossi Gottlieb
e2b59c13a3 TLS: Fix test failures on recent Debian/Ubuntu.
Seems like on some systems choosing specific TLS v1/v1.1 versions no
longer works as expected. Test is reduced for v1.2 now which is still
good enough to test the mechansim, and matters most anyway.
2020-05-10 17:38:04 +03:00
antirez
87da1483a0 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2020-05-09 11:13:32 +02:00
antirez
3311d52e80 Cluster: clarify we always resolve the sender. 2020-05-09 11:12:51 +02:00
antirez
dc35bcdeb7 Cluster: refactor ping/data delay handling. 2020-05-09 11:10:38 +02:00
antirez
f3194fce40 Cluster: introduce data_received field.
We want to send pings and pongs at specific intervals, since our packets
also contain information about the configuration of the cluster and are
used for gossip. However since our cluster bus is used in a mixed way
for data (such as Pub/Sub or modules cluster messages) and metadata,
sometimes a very busy channel may delay the reception of pong packets.
So after discussing it in #7216, this commit introduces a new field that
is not exposed in the cluster, is only an internal information about
the last time we received any data from a given node: we use this field
in order to avoid detecting failures, claiming data reception of new
data from the node is a proof of liveness.
2020-05-09 11:10:35 +02:00