541 Commits

Author SHA1 Message Date
antirez
e978e71402 Comment clearly why we moved some code in #6623. 2020-04-29 11:16:30 +02:00
srzhao
e9d4c24e01 fix pipelined WAIT performance issue.
If client gets blocked again in `processUnblockedClients`, redis will not send
`REPLCONF GETACK *` to slaves untill next eventloop, so the client will be
blocked for 100ms by default(10hz) if no other file event fired.

move server.get_ack_from_slaves sinppet after `processUnblockedClients`, so
that both the first WAIT command that puts client in blocked context and the
following WAIT command processed in processUnblockedClients would trigger
redis-sever to send `REPLCONF GETACK *`, so that the eventloop would get
`REPLCONG ACK <reploffset>` from slaves and unblocked ASAP.
2020-04-29 11:00:35 +02:00
Oran Agra
3a8f8fa487 hickup, re-fix dictEncObjKeyCompare
come to think of it, in theory (not in practice), getDecodedObject can
return the same original object with refcount incremented, so the
pointer comparision in the previous commit was invalid.
so now instead of checking the encoding, we explicitly check the
refcount.
2020-04-28 12:14:46 +03:00
antirez
bee51ef883 Rework comment in dictEncObjKeyCompare(). 2020-04-27 22:40:15 +02:00
Oran Agra
9499903e56 allow dictFind using static robj
since the recent addition of OBJ_STATIC_REFCOUNT and the assertion in
incrRefCount it is now impossible to use dictFind using a static robj,
because dictEncObjKeyCompare will call getDecodedObject which tries to
increment the refcount just in order to decrement it later.
2020-04-27 23:17:19 +03:00
Salvatore Sanfilippo
9112fe9ebd Merge pull request #7148 from madolson/unstable-crc
Unstable crc
2020-04-27 17:29:13 +02:00
antirez
23a3f0bd14 Fix STRALGO command flags. 2020-04-27 13:35:17 +02:00
Madelyn Olson
0978a60b3b Implemented CRC64 based on slice by 4 2020-04-24 17:00:03 -07:00
antirez
75cf725568 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2020-04-24 16:59:56 +02:00
antirez
ae3cf7911a LCS -> STRALGO LCS.
STRALGO should be a container for mostly read-only string
algorithms in Redis. The algorithms should have two main
characteristics:

1. They should be non trivial to compute, and often not part of
programming language standard libraries.
2. They should be fast enough that it is a good idea to have optimized C
implementations.

Next thing I would love to see? A small strings compression algorithm.
2020-04-24 16:54:32 +02:00
Dave-in-lafayette
fc6e48cdf6 fix for unintended crash during panic response
If redis crashes early, before lua is set up (like, if File Descriptor 0 is closed before exec), it will crash again trying to print memory statistics.
2020-04-20 16:34:36 -07:00
antirez
901e70ca72 Fix XCLAIM propagation in AOF/replicas for blocking XREADGROUP.
See issue #7105.
2020-04-17 12:38:15 +02:00
Itamar Haber
658f6ea302 Prevents default save configuration being reset...
...when using any command line argument
2020-04-13 17:28:11 +03:00
antirez
a27cd352d3 Speedup: unblock clients on keys in O(1).
See #7071.
2020-04-08 12:55:57 +02:00
antirez
45d7fcec22 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 12:07:54 +02:00
antirez
f543150d0b Merge branch 'lcs' into unstable 2020-04-06 13:51:55 +02:00
Salvatore Sanfilippo
60251ac868 Merge pull request #6797 from patpatbear/issue_#6565_memory_borderline
Check OOM at script start to get stable lua OOM state.
2020-04-06 11:59:01 +02:00
Salvatore Sanfilippo
d07c340a58 Merge pull request #7030 from valentinogeron/xread-in-lua
XREAD and XREADGROUP should not be allowed from scripts when BLOCK op…
2020-04-03 11:14:13 +02:00
Guy Benoish
7894a37841 Stale replica should allow MULTI/EXEC
Example: Client uses a pipe to send the following to a
stale replica:

MULTI
.. do something ...
DISCARD

The replica will reply the MUTLI with -MASTERDOWN and
execute the rest of the commands... A client using a
pipe might not be aware that MULTI failed until it's
too late.

I can't think of a reason why MULTI/EXEC/DISCARD should
not be executed on stale replicas...

Also, enable MULTI/EXEC/DISCARD during loading
2020-04-02 18:23:59 +03:00
antirez
d77fd23ae2 LCS: initial functionality implemented. 2020-04-01 16:13:18 +02:00
antirez
a3decf12af cast raxSize() to avoid warning with format spec. 2020-03-31 17:41:46 +02:00
antirez
f93573cb6b Minor changes to #7037. 2020-03-31 17:10:09 +02:00
Salvatore Sanfilippo
2399ed885b Merge pull request #7037 from guybe7/fix_module_replicate_multi
Modules: Test MULTI/EXEC replication of RM_Replicate
2020-03-31 17:00:57 +02:00
Guy Benoish
fd914fdd52 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 13:55:51 +03:00
antirez
84dc7c0f65 Merge branch 'pubsub_patterns_boost' of https://github.com/leeyiw/redis into leeyiw-pubsub_patterns_boost 2020-03-31 12:40:08 +02:00
antirez
ab89ab5173 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 11:00:45 +02:00
antirez
aa3efaa1d2 timeout.c created: move client timeouts code there. 2020-03-27 16:35:03 +01:00
antirez
ab10e0f2fb 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-27 16:35:03 +01:00
antirez
2ee65aff6b Precise timeouts: fix comments after functional change. 2020-03-27 16:35:03 +01:00
antirez
0264a78063 Precise timeouts: use only radix tree for timeouts. 2020-03-27 16:35:03 +01:00
antirez
c54576c631 Precise timeouts: fast exit for clientsHandleShortTimeout(). 2020-03-27 16:35:03 +01:00
antirez
36cba9bb8e Precise timeouts: fix bugs in initial implementation. 2020-03-27 16:35:03 +01:00
antirez
f232cb6670 Precise timeouts: working initial implementation. 2020-03-27 16:35:03 +01:00
antirez
86bd36d93a Precise timeouts: refactor unblocking on timeout. 2020-03-27 16:35:02 +01:00
Valentino Geron
53a7041535 XREAD and XREADGROUP should not be allowed from scripts when BLOCK option is being used 2020-03-26 15:46:31 +02:00
antirez
21976106a9 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:26:37 +01:00
antirez
27a14b7a32 Explain why we allow transactions in -BUSY state.
Related to #7022.
2020-03-25 12:46:59 +01:00
Oran Agra
fd1e1935a6 MULTI/EXEC during LUA script timeout are messed up
Redis refusing to run MULTI or EXEC during script timeout may cause partial
transactions to run.

1) if the client sends MULTI+commands+EXEC in pipeline without waiting for
response, but these arrive to the shards partially while there's a busy script,
and partially after it eventually finishes: we'll end up running only part of
the transaction (since multi was ignored, and exec would fail).

2) similar to the above if EXEC arrives during busy script, it'll be ignored and
the client state remains in a transaction.

the 3rd test which i added for a case where MULTI and EXEC are ok, and
only the body arrives during busy script was already handled correctly
since processCommand calls flagTransaction
2020-03-23 20:45:32 +02:00
antirez
0558a0b35e Abort transactions after -READONLY error. Fix #7014. 2020-03-23 11:47:49 +01:00
Salvatore Sanfilippo
5f848d8cb3 Merge pull request #6951 from yangbodong22011/feature-bitfield-ro
Added BITFIELD_RO variants for read-only operations.
2020-03-23 11:23:21 +01:00
antirez
08af68436d Merge branch 'unstable' of github.com:/antirez/redis into unstable 2020-03-20 13:21:28 +01:00
antirez
90f5d83381 ACL: default user off should not allow automatic authentication.
This fixes issue #7011.
2020-03-20 12:45:48 +01:00
WuYunlong
f4a6b931cc 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-18 16:22:07 +08:00
zhaozhao.zz
a02e9fc81d Threaded IO: handle pending reads clients ASAP after event loop 2020-03-16 11:20:48 +08:00
bodong.ybd
e0cf09cace Added BITFIELD_RO variants for read-only operations. 2020-03-04 20:51:45 +08:00
antirez
1d048a3b46 Remove RDB files used for replication in persistence-less instances. 2020-03-03 14:58:15 +01:00
Salvatore Sanfilippo
23772a54d7 Merge pull request #6862 from oranagra/command_info_no_auth
add no_auth to COMMAND INFO
2020-02-28 11:05:31 +01:00
antirez
c98236a5f3 Tracking: BCAST: basic feature now works. 2020-02-12 19:22:04 +01:00
antirez
c797326742 Tracking: BCAST: parsing of the options + skeleton. 2020-02-10 17:18:11 +01:00
antirez
dcb43f4530 Tracking: minor change of names and new INFO field. 2020-02-07 18:12:45 +01:00