613 Commits

Author SHA1 Message Date
John Sully
ce54857237 Merge commit '454e12cb8961f21c9dd8502dc82ae6ffd7e22fe0' into redis_6_merge
Former-commit-id: cc3ebbe5194e9744fb84ce490e90ac5fbe7f8716
2020-04-14 22:19:29 -04:00
John Sully
90cbdd5573 Merge commit 'c208956fbe077e8249d2965dec2ea1b9b7588d6d' into redis_6_merge
Former-commit-id: 2825e515504cffcf6000be2e547ab1cbd86441bc
2020-04-14 20:55:29 -04:00
John Sully
68c50ae876 Merge commit '6718d5d37517bd927635649708913affb98f67c9' into redis_6_merge
Former-commit-id: ef1236b6009ebd7b00f6dd2f43df57ad95e51253
2020-04-14 20:19:48 -04:00
John Sully
2c049c16a2 Merge commit '79e8b17d7b44c793d8b22668b8583a297ee1b387' into redis_6_merge
Former-commit-id: 28cbed1d13961c5568f2bdc50c6a23107d3434d0
2020-04-14 20:09:53 -04:00
John Sully
d48ea996e7 Merge commit '13fbdf970660b15011c4312f31137e58bbda5b2c' into redis_6_merge
Former-commit-id: cde199a7973ad63317b68f581df607321e12bf46
2020-04-14 19:43:04 -04:00
John Sully
6df76a3bfa Merge commit 'a8e2bbe8f6a3f4833f286cc5049e6b52c87de1a9' into redis_6_merge
Former-commit-id: 5589a0a69ca6f5798b750a6a79f7e9b44d20e136
2020-04-14 19:22:44 -04:00
John Sully
2038fa270a Merge commit '491949ee5bf4ffbfc746ea4ed5a6d673b0e2fb81' into redis_6_merge
Former-commit-id: 09e8fb17cd0889ad17461e48446221b3955f5a8f
2020-04-14 18:44:42 -04:00
antirez
c38bc83f47 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
f7e8240900 Remove RDB files used for replication in persistence-less instances.
Former-commit-id: b323645227a3e2cc5928e649586221aba508b10d
2020-04-14 17:27:05 -04:00
Guy Benoish
49dda32114 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
fdd6da647d 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
73e7bcc598 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
087ed099d1 LCS: initial functionality implemented. 2020-04-07 16:52:57 +02:00
srzhao
c5d805f877 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
6f54629071 modules don't signalModifiedKey in setKey() since that's done (optionally) in RM_CloseKey 2020-04-07 16:52:04 +02:00
John Sully
9b2392107c 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
2684a266c8 Fix subkey expires not replicating correctly, and AOF issues
Former-commit-id: bd183cdee13081a02efef5df75edf2292b872a16
2020-04-04 21:52:27 -04:00
Guy Benoish
5c23cd55d4 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
2a820251c8 timeout.c created: move client timeouts code there. 2020-03-31 16:57:20 +02:00
antirez
514ca204bb Fix module commands propagation double MULTI bug.
b512cb40 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
c881ba1680 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
0e5723ff18 Precise timeouts: fix comments after functional change. 2020-03-31 16:56:46 +02:00
antirez
444089c55e Precise timeouts: use only radix tree for timeouts. 2020-03-31 16:56:46 +02:00
antirez
cedeec01f2 Precise timeouts: working initial implementation. 2020-03-31 16:56:46 +02:00
antirez
b636856df0 Precise timeouts: refactor unblocking on timeout. 2020-03-31 16:56:46 +02:00
伯成
2a13f59a18 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
9c4b66b9a4 Merge branch 'unstable' into redis_6_merge
Former-commit-id: 908cf5042ebcd7870166bd1a0bb450f37e5f3b4d
2020-03-25 22:12:22 -04:00
John Sully
71fe6f7ba9 Fix issue #143
Former-commit-id: 6ec1641294b23e22a2a5dc5cc6098a02ce234df3
2020-03-25 21:55:31 -04:00
antirez
ce73158a9c 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
015d1cb2ff Added BITFIELD_RO variants for read-only operations. 2020-03-25 15:55:24 +01:00
WuYunlong
37c6571a6c 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
d9f9a29afa 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
antirez
749a4e962a Make sync RDB deletion configurable. Default to no. 2020-03-05 12:51:15 +01:00
antirez
e91ca9fee9 Remove RDB files used for replication in persistence-less instances. 2020-03-05 12:51:14 +01:00
John Sully
1187fb6afc Fix CLANG build break
Former-commit-id: 5e63c0955d2861ab0ebe2055d4f2d2e8989ea4f3
2020-03-04 17:24:17 -05:00
John Sully
435bd4c2fb Fix CLANG build break
Former-commit-id: c2a98a60f964f28455a5d04e18b88a9a45c9e586
2020-03-04 17:23:40 -05:00
John Sully
e39dd04f6c Merge branch 'unstable' into redis_6_merge
Former-commit-id: 52fd4445a472fa3112e96c6a7ef66ecdfe6ce9f5
2020-03-04 17:13:01 -05:00
John Sully
01a85ba7fe Add extra logging when reporting errors from masters - especially in rreplay
Former-commit-id: 5397f0b03312b8cace07a85333d8f035bdfb8d57
2020-03-04 17:09:12 -05:00
antirez
75a7615ce2 Tracking: optin/out implemented. 2020-02-27 18:02:30 +01:00
antirez
a227fd7cca Tracking: fix max-keys configuration directive. 2020-02-27 18:00:46 +01:00
antirez
fce22c6a42 Tracking: first conversion from hashing to key names. 2020-02-27 17:59:57 +01:00
antirez
261fabeaa4 Tracking: BCAST: broadcasting of keys in prefixes implemented. 2020-02-27 17:59:57 +01:00
antirez
abdaebc6c4 Tracking: BCAST: registration in the prefix table. 2020-02-27 17:59:57 +01:00
antirez
ed36f3c76f Tracking: BCAST: parsing of the options + skeleton. 2020-02-27 17:59:57 +01:00
antirez
ddc4965ac5 Tracking: minor change of names and new INFO field. 2020-02-27 17:59:57 +01:00
John Sully
bd5ffe7069 Merge branch 'unstable' into redis_6_merge
Former-commit-id: 6a71de7835f427cebb23e4c2f0d19ed63a02f09e
2020-02-16 19:14:51 -05:00
John Sully
d229b03b2c Support C++14 and remove dependency on future standard 2a
Former-commit-id: 18496b62853738bf7bd48f65fe34aafcba8bbe0b
2020-02-16 19:04:56 -05:00
John Sully
b6db2d32ad Graceful shutdown of server threads when quit is requested
Former-commit-id: b9db899f6ccea62222170c6eec264d403a7a911d
2020-02-16 18:53:46 -05:00
John Sully
04d174ba1a Merge branch 'unstable' into redis_6_merge
Former-commit-id: 30a603ce05956195aa027a3400eafd48d2750ea7
2020-02-16 18:18:24 -05:00
John Sully
8f6f496c7e Memory leak fix on config, and redisDb dtor
Former-commit-id: b92bbf4de8ffc3edc965e2f9da4dd82ed7071559
2020-02-16 17:08:00 -05:00