8774 Commits

Author SHA1 Message Date
Guy Benoish
f4c30fd74b Fix small bugs related to replica and monitor ambiguity
1. server.repl_no_slaves_since can be set when a MONITOR client disconnects
2. c->repl_ack_time can be set by a newline from a MONITOR client
3. Improved comments
2020-02-12 14:15:56 +01:00
Yossi Gottlieb
351529cc39 TLS: Some redis.conf clarifications. 2020-02-12 14:15:56 +01:00
Oran Agra
601d423498 config.c verbose error replies for CONFIG SET, like config file parsing
We noticed that the error replies for the generic mechanism for enums
are very verbose for config file parsing, but not for config set
command.

instead of replicating this code, i did a small refactoring to share
code between CONFIG SET and config file parsing.

and also renamed the enum group functions to be consistent with the
naming of other types.
2020-02-12 14:15:56 +01:00
Oran Agra
138252dc56 memoryGetKeys helper function so that ACL can limit access to keys for MEMORY command 2020-02-12 14:15:56 +01:00
antirez
491949ee5b ACL LOG: make max log entries configurable. 2020-02-12 14:15:35 +01:00
antirez
c30fe3a93f ACL LOG: test for AUTH reason. 2020-02-12 14:15:35 +01:00
antirez
c0de265bfa ACL LOG: log failed auth attempts. 2020-02-12 14:15:35 +01:00
antirez
c60351e489 ACL LOG: implement a few basic tests. 2020-02-12 14:15:35 +01:00
antirez
74c4d2f158 ACL LOG: also log ACL errors in the scripting/MULTI ctx. 2020-02-12 14:15:35 +01:00
antirez
3853c71288 ACL LOG: implement LOG RESET. 2020-02-12 14:15:35 +01:00
antirez
7b53636462 ACL LOG: group similar entries in a given time delta. 2020-02-12 14:15:35 +01:00
antirez
9f5b64c4a6 ACL LOG: actually emit entries. 2020-02-12 14:15:35 +01:00
antirez
e6eafd3e1f ACL LOG: implement ACL LOG subcommadn skeleton. 2020-02-12 14:15:35 +01:00
antirez
2d06604451 ACL LOG: data structures and initial functions. 2020-02-12 14:15:35 +01:00
Leo Murillo
5b2c6c5efa Set ZSKIPLIST_MAXLEVEL to optimal value given 2^64 elements and p=0.25 2020-02-04 10:23:48 +01:00
WuYunlong
294b194ad4 Fix lua related memory leak. 2020-02-04 10:23:48 +01:00
WuYunlong
7d63a7d128 Add tcl regression test in scripting.tcl to reproduce memory leak. 2020-02-04 10:23:48 +01:00
Yossi Gottlieb
a27a4b82f4 TLS: Fix missing initialization in redis-cli. 2020-02-04 10:23:48 +01:00
Oran Agra
2ffb9a3682 fix uninitialized info_cb var in module.c 2020-02-04 10:23:48 +01:00
Guy Benoish
2ad427f862 ld2string should fail if string contains \0 in the middle
This bug affected RM_StringToLongDouble and HINCRBYFLOAT.
I added tests for both cases.

Main changes:
1. Fixed string2ld to fail if string contains \0 in the middle
2. Use string2ld in getLongDoubleFromObject - No point of
   having duplicated code here

The two changes above broke RM_SaveLongDouble/RM_LoadLongDouble
because the long double string was saved with length+1 (An innocent
mistake, but it's actually a bug - The length passed to
RM_SaveLongDouble should not include the last \0).
2020-02-04 10:23:48 +01:00
antirez
229229eb55 Add more info in the unblockClientFromModule() function. 2020-02-04 10:23:48 +01:00
Guy Benoish
d9f508d527 Modules: Fix blocked-client-related memory leak
If a blocked module client times-out (or disconnects, unblocked
by CLIENT command, etc.) we need to call moduleUnblockClient
in order to free memory allocated by the module sub-system
and blocked-client private data

Other changes:
Made blockedonkeys.tcl tests a bit more aggressive in order
to smoke-out potential memory leaks
2020-02-04 10:23:48 +01:00
antirez
4048cf6125 Change error message for #6775. 2020-01-17 10:47:38 +01:00
Vasyl Melnychuk
037755edd4 Make error when submitting command in incorrect context more explicit
So error message `ERR only (P)SUBSCRIBE / (P)UNSUBSCRIBE / PING / QUIT allowed in this context` will become
`ERR 'get' command submitted, but only (P)SUBSCRIBE / (P)UNSUBSCRIBE / PING / QUIT allowed in this context`
2020-01-17 10:47:38 +01:00
antirez
9a39a227ff Document I/O threads in redis.conf. 2020-01-17 10:47:38 +01:00
antirez
598c324bc1 Setting N I/O threads should mean N-1 additional + 1 main thread. 2020-01-17 10:47:38 +01:00
antirez
dff5370c8b Simplify #6379 changes. 2020-01-17 10:47:38 +01:00
WuYunlong
e67a3a377f Free allocated sds in pfdebugCommand() to avoid memory leak. 2020-01-17 10:47:38 +01:00
WuYunlong
1588f30ae2 Fix potential memory leak of clusterLoadConfig(). 2020-01-17 10:47:38 +01:00
WuYunlong
2a3a035b64 Fix potential memory leak of rioWriteBulkStreamID(). 2020-01-17 10:47:38 +01:00
antirez
87d059a745 Jump to right label on AOF parsing error.
Related to #6054.
2020-01-17 10:47:38 +01:00
antirez
0b02b27705 Port PR #6110 to new connection object code. 2020-01-17 10:47:38 +01:00
antirez
a6eb3f8bfb A few comments about main thread serving I/O as well.
Related to #6110.
2020-01-17 10:47:38 +01:00
zhaozhao.zz
1f76ff2fb9 Threaded IO: use main thread to handle read work 2020-01-17 10:47:38 +01:00
zhaozhao.zz
0a3410db70 Threaded IO: use main thread to handle write work 2020-01-17 10:47:38 +01:00
ShooterIT
4e0c2ff1d8 Rename rdb asynchronously 2020-01-10 13:16:25 +01:00
Leo Murillo
b6caf319e5 Fix bug on KEYS command where pattern starts with * followed by \x00 (null char). 2020-01-10 13:16:25 +01:00
Jamie Scott
0b36c7eb26 Update to directive in redis.conf (missing s)
The directive tls-prefer-server-cipher is actually tls-prefer-server-ciphers in config.c. This results in a failed directive call shown below. This pull request adds the "s" in ciphers so that the directive is able to be properly called in config.c

ubuntu@ip-172-31-16-31:~/redis$ src/redis-server ./redis.conf 

*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 200
>>> 'tls-prefer-server-cipher yes'
Bad directive or wrong number of arguments
2020-01-10 13:16:25 +01:00
antirez
a4f462bebb Free fakeclient argv on AOF error.
We exit later, so no bug fixed, but it is more correct.

See #6054, thanks to @ShooterIT for finding the issue.
2020-01-10 13:16:25 +01:00
antirez
d08b8b92fc Git ignore: ignore more files. 2020-01-10 13:16:14 +01:00
Guy Benoish
3913ffd5bc Blocking XREAD[GROUP] should always reply with valid data (or timeout)
This commit solves the following bug:
127.0.0.1:6379> XGROUP CREATE x grp $ MKSTREAM
OK
127.0.0.1:6379> XADD x 666 f v
"666-0"
127.0.0.1:6379> XREADGROUP GROUP grp Alice BLOCK 0 STREAMS x >
1) 1) "x"
   2) 1) 1) "666-0"
         2) 1) "f"
            2) "v"
127.0.0.1:6379> XADD x 667 f v
"667-0"
127.0.0.1:6379> XDEL x 667
(integer) 1
127.0.0.1:6379> XREADGROUP GROUP grp Alice BLOCK 0 STREAMS x >
1) 1) "x"
   2) (empty array)

The root cause is that we use s->last_id in streamCompareID
while we should use the last *valid* ID
2020-01-10 13:16:14 +01:00
John Sully
2539a8a3ce Add support for incremental build with header files 2020-01-10 13:16:14 +01:00
WuYunlong
7030e66807 Fix petential cluster link error.
Funcion adjustOpenFilesLimit() has an implicit parameter, which is server.maxclients.
This function aims to ajust maximum file descriptor number according to server.maxclients
by best effort, which is "bestlimit" could be lower than "maxfiles" but greater than "oldlimit".
When we try to increase "maxclients" using CONFIG SET command, we could increase maximum
file descriptor number to a bigger value without calling aeResizeSetSize the same time.
When later more and more clients connect to server, the allocated fd could be bigger and bigger,
and eventually exceeds events size of aeEventLoop.events. When new nodes joins the cluster,
new link is created, together with new fd, but when calling aeCreateFileEvent, we did not
check the return value. In this case, we have a non-null "link" but the associated fd is not
registered.

So when we dynamically set "maxclients" we could reach an inconsistency between maximum file
descriptor number of the process and server.maxclients. And later could cause cluster link and link
fd inconsistency.

While setting "maxclients" dynamically, we consider it as failed when resulting "maxclients" is not
the same as expected. We try to restore back the maximum file descriptor number when we failed to set
"maxclients" to the specified value, so that server.maxclients could act as a guard as before.
2020-01-10 13:16:14 +01:00
Yossi Gottlieb
3f8a690161 Add REDISMODULE_CTX_FLAGS_MULTI_DIRTY. 2020-01-10 13:16:03 +01:00
hwware
86fd8f0e3f typo fix in acl.c 2020-01-10 13:16:03 +01:00
Itamar Haber
d6a6b6f40c Adjusts 'io_threads_num' max to 128
Instead of 512, use the defined max from networking.c
2020-01-10 13:16:03 +01:00
antirez
4a63d5d881 XCLAIM: Create the consumer only on successful claims.
Fixes #6744.
2020-01-08 12:31:39 +01:00
yz1509
28622cc532 avoid sentinel changes promoted_slave to be its own replica. 2020-01-08 12:31:25 +01:00
antirez
d22d40a2eb Fix active expire division by zero.
Likely fix #6723.

This is what happens AFAIK: we enter the main loop where we expire stuff
until a given percentage of keys is still found to be logically expired.
There are however other potential exit conditions.

However the "sampled" variable is not always incremented inside the
loop, because we may found no valid slot as we scan the hash table, but
just NULLs ad dict entries. So when the do/while loop condition is
triggered at the end, we do (expired*100/sampled), dividing by zero if
we sampled 0 keys.
2020-01-01 18:10:39 +01:00
antirez
c2461ba531 Fix duplicated CLIENT SETNAME reply.
Happened when we set the name to "" to cancel the name.
Was introduced during the RESP3 refactoring.

See #6036.
2019-12-29 15:46:31 +01:00