996 Commits

Author SHA1 Message Date
John Sully
05cc1fd3de Initial merge of unstable 6
Former-commit-id: aac140de199646914cc02997a45111c9c695e55d
2020-04-16 16:36:16 -04:00
John Sully
c498381b1a Merge branch 'unstable' into redis_6_merge
Former-commit-id: cc9924ffa606200f331b3bf5e1e1a4aa3f2702fa
2020-04-15 23:00:13 -04:00
John Sully
34131bf287 During AOF reload we can erroneously read incorrect aof_state values, so this variable must be read with the global lock acquired
Former-commit-id: 6ff9d23fd4541a011d754209d9fda3ef3af4a7f9
2020-04-15 22:30:19 -04:00
John Sully
bbb08af294 Convert variables accessed outside lock to atomics
Former-commit-id: b0796ff5fd7e069a2fadbfd968f7bbb2020edd2d
2020-04-15 22:25:17 -04:00
antirez
bec68bff29 Use the special static refcount for stack objects. 2020-04-15 16:03:16 +02:00
antirez
0f239e51b0 RDB: refactor some RDB loading code into dbAddRDBLoad(). 2020-04-15 16:03:16 +02:00
antirez
f855db61b0 incrRefCount(): abort on statically allocated object. 2020-04-15 16:03:16 +02:00
antirez
61b153073f RDB: load files faster avoiding useless free+realloc.
Reloading of the RDB generated by

    DEBUG POPULATE 5000000
    SAVE

is now 25% faster.

This commit also prepares the ability to have more flexibility when
loading stuff from the RDB, since we no longer use dbAdd() but can
control exactly how things are added in the database.
2020-04-15 16:03:16 +02:00
John Sully
d3ebe3b6bd Merge tag '6.0-rc3' into redis_6_merge
Redis 6.0 RC3.


Former-commit-id: b2cb10de5f39b4d8e1ee19877c2bdaf19eefd9db
2020-04-14 22:56:19 -04:00
John Sully
68fd7c5c3d Merge commit 'c3b268a0bcded2d730790a772176483efb7c31fb' into redis_6_merge
Former-commit-id: 50768cd242c0360c6e943c57f866789280d30dc0
2020-04-14 22:25:44 -04:00
John Sully
02147b4be0 Merge commit '0f7dfc378ce5ab0524ac28b6142545bc41435386' into redis_6_merge
Former-commit-id: cc3ebbe5194e9744fb84ce490e90ac5fbe7f8716
2020-04-14 22:19:29 -04:00
John Sully
b20093e2f3 Merge commit 'e74e68c84f5eba8013769087c9a46cab811b8417' into redis_6_merge
Former-commit-id: 2825e515504cffcf6000be2e547ab1cbd86441bc
2020-04-14 20:55:29 -04:00
John Sully
f27524674a Merge commit '973297336fc05a601e17be70aba88e5dca6480ae' into redis_6_merge
Former-commit-id: ef1236b6009ebd7b00f6dd2f43df57ad95e51253
2020-04-14 20:19:48 -04:00
John Sully
d57fa7c8f9 Merge commit '349aa24511253b3e323064b95cefb4414f31726c' into redis_6_merge
Former-commit-id: 28cbed1d13961c5568f2bdc50c6a23107d3434d0
2020-04-14 20:09:53 -04:00
John Sully
12999c17dd Merge commit 'df83892760d19b1b7e92d76e72daf4834ad2df6c' into redis_6_merge
Former-commit-id: cde199a7973ad63317b68f581df607321e12bf46
2020-04-14 19:43:04 -04:00
John Sully
947bf289a5 Merge commit 'f42ce57d0f7eee6705fb0a81714cabe97a4f2c0a' into redis_6_merge
Former-commit-id: 5589a0a69ca6f5798b750a6a79f7e9b44d20e136
2020-04-14 19:22:44 -04:00
John Sully
5dbcd55669 Merge commit '51c1a9f8fbc12a9276489178242e498bb6ccbdba' into redis_6_merge
Former-commit-id: 09e8fb17cd0889ad17461e48446221b3955f5a8f
2020-04-14 18:44:42 -04:00
antirez
0fac746f0e PSYNC2: meaningful offset implemented.
A very commonly signaled operational problem with Redis master-replicas
sets is that, once the master becomes unavailable for some reason,
especially because of network problems, many times it wont be able to
perform a partial resynchronization with the new master, once it rejoins
the partition, for the following reason:

1. The master becomes isolated, however it keeps sending PINGs to the
replicas. Such PINGs will never be received since the link connection is
actually already severed.
2. On the other side, one of the replicas will turn into the new master,
setting its secondary replication ID offset to the one of the last
command received from the old master: this offset will not include the
PINGs sent by the master once the link was already disconnected.
3. When the master rejoins the partion and is turned into a replica, its
offset will be too advanced because of the PINGs, so a PSYNC will fail,
and a full synchronization will be required.

Related to issue #7002 and other discussion we had in the past around
this problem.


Former-commit-id: 5d6e8fe3e3e43162f0c57f580b6e8432274fca30
2020-04-14 17:56:09 -04:00
antirez
34f7c653d5 Remove RDB files used for replication in persistence-less instances.
Former-commit-id: b323645227a3e2cc5928e649586221aba508b10d
2020-04-14 17:27:05 -04:00
Guy Benoish
234e6e7b09 Diskless-load emptyDb-related fixes
1. Call emptyDb even in case of diskless-load: We want modules
   to get the same FLUSHDB event as disk-based replication.
2. Do not fire any module events when flushing the backups array.
3. Delete redundant call to signalFlushedDb (Called from emptyDb).


Former-commit-id: aa8a3077a2d20e66e34f72f2860d0cc3daad496e
2020-04-14 17:21:10 -04:00
antirez
35c64b898c Speedup INFO by counting client memory incrementally.
Related to #5145.

Design note: clients may change type when they turn into replicas or are
moved into the Pub/Sub category and so forth. Moreover the recomputation
of the bytes used is problematic for obvious reasons: it changes
continuously, so as a conservative way to avoid accumulating errors,
each client remembers the contribution it gave to the sum, and removes
it when it is freed or before updating it with the new memory usage.
2020-04-07 16:53:13 +02:00
zhaozhao.zz
abd5156f25 lazyfree: add a new configuration lazyfree-lazy-user-del
Delete keys in async way when executing DEL command, if
lazyfree-lazy-user-del is yes.
2020-04-07 16:53:13 +02:00
antirez
a518a9a766 LCS: initial functionality implemented. 2020-04-07 16:52:57 +02:00
srzhao
026cc11b05 Check OOM at script start to get stable lua OOM state.
Checking OOM by `getMaxMemoryState` inside script might get different result
with `freeMemoryIfNeededAndSafe` at script start, because lua stack and
arguments also consume memory.

This leads to memory `borderline` when memory grows near server.maxmemory:

- `freeMemoryIfNeededAndSafe` at script start detects no OOM, no memory freed
- `getMaxMemoryState` inside script detects OOM, script aborted

We solve this 'borderline' issue by saving OOM state at script start to get
stable lua OOM state.

related to issue #6565 and #5250.
2020-04-07 16:52:28 +02:00
Oran Agra
a38ff404bd modules don't signalModifiedKey in setKey() since that's done (optionally) in RM_CloseKey 2020-04-07 16:52:04 +02:00
John Sully
6f15ce125c Add the ability to set a starting core # when setting thread affinity
Former-commit-id: 9e2e2067c6df5919f1c6b8b9e6e3457c7edc0755
2020-04-04 22:58:17 -04:00
John Sully
eeca58777d Fix subkey expires not replicating correctly, and AOF issues
Former-commit-id: bd183cdee13081a02efef5df75edf2292b872a16
2020-04-04 21:52:27 -04:00
Guy Benoish
a509400d58 Modules: Test MULTI/EXEC replication of RM_Replicate
Makse sure call() doesn't wrap replicated commands with
a redundant MULTI/EXEC

Other, unrelated changes:
1. Formatting compiler warning in INFO CLIENTS
2. Use CLIENT_ID_AOF instead of UINT64_MAX
2020-03-31 17:12:19 +02:00
antirez
c3b268a0bc timeout.c created: move client timeouts code there. 2020-03-31 16:57:20 +02:00
antirez
616b1cb7ac Fix module commands propagation double MULTI bug.
37a10cef introduced automatic wrapping of MULTI/EXEC for the
alsoPropagate API. However this collides with the built-in mechanism
already present in module.c. To avoid complex changes near Redis 6 GA
this commit introduces the ability to exclude call() MUTLI/EXEC wrapping
for also propagate in order to continue to use the old code paths in
module.c.
2020-03-31 16:57:20 +02:00
antirez
67643ead69 Precise timeouts: cleaup the table on unblock.
Now that this mechanism is the sole one used for blocked clients
timeouts, it is more wise to cleanup the table when the client unblocks
for any reason. We use a flag: CLIENT_IN_TO_TABLE, in order to avoid a
radix tree lookup when the client was already removed from the table
because we processed it by scanning the radix tree.
2020-03-31 16:56:46 +02:00
antirez
ad94066ec8 Precise timeouts: fix comments after functional change. 2020-03-31 16:56:46 +02:00
antirez
a443ec2e9a Precise timeouts: use only radix tree for timeouts. 2020-03-31 16:56:46 +02:00
antirez
7add0f2490 Precise timeouts: working initial implementation. 2020-03-31 16:56:46 +02:00
antirez
9d6d177994 Precise timeouts: refactor unblocking on timeout. 2020-03-31 16:56:46 +02:00
伯成
11db53f875 Boost up performance for redis PUB-SUB patterns matching
If lots of clients PSUBSCRIBE to same patterns, multiple pattens matching will take place. This commit change it into just one single pattern matching by using a `dict *` to store the unique pattern and which clients subscribe to it.
2020-03-31 12:47:14 +02:00
John Sully
138ce49a96 merge
Former-commit-id: 187773190f153f8a7236bc2e4f42bffe6885f727
2020-03-26 01:16:36 -04:00
John Sully
aaa751acb8 Merge branch 'unstable' into redis_6_merge
Former-commit-id: 908cf5042ebcd7870166bd1a0bb450f37e5f3b4d
2020-03-25 22:12:22 -04:00
John Sully
356ed25c62 Fix issue #143
Former-commit-id: 6ec1641294b23e22a2a5dc5cc6098a02ce234df3
2020-03-25 21:55:31 -04:00
John Sully
375b204382 Fix breaks from merge
Former-commit-id: fa76d19bee9df21967c4d8554128eebdd19021fa
2020-03-25 16:22:32 -04:00
antirez
5f72f69688 PSYNC2: meaningful offset implemented.
A very commonly signaled operational problem with Redis master-replicas
sets is that, once the master becomes unavailable for some reason,
especially because of network problems, many times it wont be able to
perform a partial resynchronization with the new master, once it rejoins
the partition, for the following reason:

1. The master becomes isolated, however it keeps sending PINGs to the
replicas. Such PINGs will never be received since the link connection is
actually already severed.
2. On the other side, one of the replicas will turn into the new master,
setting its secondary replication ID offset to the one of the last
command received from the old master: this offset will not include the
PINGs sent by the master once the link was already disconnected.
3. When the master rejoins the partion and is turned into a replica, its
offset will be too advanced because of the PINGs, so a PSYNC will fail,
and a full synchronization will be required.

Related to issue #7002 and other discussion we had in the past around
this problem.
2020-03-25 15:55:24 +01:00
bodong.ybd
b3e4abf06e Added BITFIELD_RO variants for read-only operations. 2020-03-25 15:55:24 +01:00
WuYunlong
0578157d56 Fix master replica inconsistency for upgrading scenario.
Before this commit, when upgrading a replica, expired keys will not
be loaded, thus causing replica having less keys in db. To this point,
master and replica's keys is logically consistent. However, before
the keys in master and replica are physically consistent, that is,
they have the same dbsize, if master got a problem and the replica
got promoted and becomes new master of that partition, and master
updates a key which does not exist on master, but physically exists
on the old master(new replica), the old master would refuse to update
the key, thus causing master and replica data inconsistent.

How could this happen?
That's all because of the wrong judgement of roles while starting up
the server. We can not use server.masterhost to judge if the server
is master or replica, since it fails in cluster mode.

When we start the server, we load rdb and do want to load expired keys,
and do not want to have the ability to active expire keys, if it is
a replica.
2020-03-25 15:54:34 +01:00
antirez
9c2e42ddfc ACL: Make Redis 6 more backward compatible with requirepass.
Note that this as a side effect fixes Sentinel "requirepass" mode.
2020-03-25 15:54:34 +01:00
John Sully
79f48a214e Prevent issue where count can be out of sync temporarily, causing crashes where we expect the count to be perfect
Former-commit-id: 77c9f36413c6f0cbb0b13a7ec746746c97faadcd
2020-03-24 00:21:12 -04:00
John Sully
ae81c227fe Fix OOM errors during forkless bgsave
Former-commit-id: c31c64b13409c741e8d52ad06add78300c39fce2
2020-03-23 23:12:10 -04:00
antirez
127e09bca1 Make sync RDB deletion configurable. Default to no. 2020-03-05 12:51:15 +01:00
antirez
be4bc1a5be Remove RDB files used for replication in persistence-less instances. 2020-03-05 12:51:14 +01:00
John Sully
c38f94d5d0 Merge branch 'redis_6_merge' into keydbpro
Former-commit-id: b0a3bb848937d24dd74de63032306fd92c61dd7b
2020-03-04 17:24:36 -05:00
John Sully
0114827642 Fix CLANG build break
Former-commit-id: 5e63c0955d2861ab0ebe2055d4f2d2e8989ea4f3
2020-03-04 17:24:17 -05:00