Commit Graph

10755 Commits

Author SHA1 Message Date
zhaozhao.zz
2ff53060d2 Modules: show path and args in LIST reply 2021-06-01 13:43:48 +03:00
zhaozhao.zz
babe3c7b29 Modules: rewrite config loadmodule option 2021-06-01 13:43:48 +03:00
zhaozhao.zz
09e435c8d4 Modules: free node after module loaded from server.loadmodule_queue 2021-06-01 13:43:48 +03:00
Oran Agra
1ddecf1958
Fix integer overflow in STRALGO LCS (CVE-2021-32625) (#9011)
An integer overflow bug in Redis version 6.0 or newer can be exploited using the
STRALGO LCS command to corrupt the heap and potentially result with remote code
execution. This is a result of an incomplete fix by CVE-2021-29477.
2021-06-01 09:12:45 +03:00
Oran Agra
ae67539c8b
Improve new time sensitive pexpireat propagation test (#9010)
The test that was merged yesterday fails with valgrind and freebsd CI
that are too slow, and 10 seconds apparently passed between the time the
command was sent to redis and the time it was actually executed.

```
*** [err]: All TTL in commands are propagated as absolute timestamp in replication stream in tests/unit/expire.tcl
Expected 'del a' to match 'set foo1 bar PXAT *' (context: type source line 778 file /home/runner/work/redis/redis/tests/test_helper.tcl cmd {assert_match [lindex $patterns $j] [read_from_replication_stream $s]} proc ::assert_replication_stream level 1)
```
2021-06-01 08:01:10 +03:00
Binbin
01495c674a
Extend freeSlotsToKeysMapAsync and freeTrackingRadixTreeAsync to check LAZYFREE_THRESHOLD. (#8969)
Without this fix, FLUSHALL ASYNC would have freed these in a background thread,
even if they didn't contain many elements (unlike how it works with other structures), which could be inefficient.
2021-05-30 17:56:04 +03:00
Wang Yuan
58a03eca67
Make full use of aofrwblock's buf (#8975)
Make aof rewrite buffer memory size more accurate, before, there may be 20%
deviation with its real memory usage.

The implication are both lower memory usage, and also a more accurate INFO.
2021-05-30 11:57:36 +03:00
ny0312
53d1acd598
Always replicate time-to-live(TTL) as absolute timestamps in milliseconds (#8474)
Till now, on replica full-sync we used to transfer absolute time for TTL,
however when a command arrived (EXPIRE or EXPIREAT),
we used to propagate it as is to replicas (possibly with relative time),
but always translate it to EXPIREAT (absolute time) to AOF.

This commit changes that and will always use absolute time for propagation.
see discussion in #8433

Furthermore, we Introduce new commands: `EXPIRETIME/PEXPIRETIME`
that allow extracting the absolute TTL time from a key.
2021-05-30 09:20:32 +03:00
YaacovHazan
501d775583
unregister AE_READABLE from the read pipe in backgroundSaveDoneHandlerSocket (#8991)
In diskless replication, we create a read pipe for the RDB, between the child and the parent.
When we close this pipe (fd), the read handler also needs to be removed from the event loop (if it still registered).
Otherwise, next time we will use the same fd, the registration will be fail (panic), because
we will use EPOLL_CTL_MOD (the fd still register in the event loop), on fd that already removed from epoll_ctl
2021-05-26 14:51:53 +03:00
Wen Hui
be6ce8a92a
fix sentinel test failure (#8983)
fix for recent breakage from #8958, did a mistake when updating the pr.
2021-05-24 08:36:51 +03:00
Wen Hui
ae6f58690b
[SENTINEL] reset sentinel-user/pass to NULL when user config with empty string (#8958) 2021-05-23 14:31:01 +03:00
wuYin
a319327ffb
remove unnecessary determine statement in sdsrange (#8978)
Already verified that start < len, so if end >= len, then start cannot be > len.
2021-05-22 14:49:35 +03:00
YaacovHazan
32a2584e07
stabilize tests that involved with load handlers (#8967)
When test stop 'load handler' by killing the process that generating the load,
some commands that already in the input buffer, still might be processed by the server.
This may cause some instability in tests, that count on that no more commands
processed after we stop the `load handler'

In this commit, new proc 'wait_load_handlers_disconnected' added, to verify that no more
cammands from any 'load handler' prossesed, by checking that the clients who
genreate the load is disconnceted.

Also, replacing check of dbsize with wait_for_ofs_sync before comparing debug digest, as
it would fail in case the last key the workload wrote was an overridden key (not a new one).

Affected tests
Race fix:
- failover command to specific replica works
- Connect multiple replicas at the same time (issue #141), master diskless=$mdl, replica diskless=$sdl
- AOF rewrite during write load: RDB preamble=$rdbpre

Cleanup and speedup:
- Test replication with blocking lists and sorted sets operations
- Test replication with parallel clients writing in different DBs
- Test replication partial resync: $descr (diskless: $mdl, $sdl, reconnect: $reconnect
2021-05-20 15:29:43 +03:00
Wang Yuan
8627751ec6
Make aof buf alloc size more accurate in overhead (#8970)
In theory we should have used zmalloc_usable_size, but it may be slower,
and now after #7875, there's no actual difference.
So this change isn't making a dramatic change.

Co-authored-by: Oran Agra <oran@redislabs.com>
2021-05-20 15:04:17 +03:00
Wang Yuan
0b2d0be35a
Make full use of replication backlog memory (#8966)
According jemalloc size classes, we may allocate much more memory
than our setting of repl_backlog_size, but we don't make full use of it.
2021-05-20 08:23:53 +03:00
Madelyn Olson
a59e75a475
Hide migrate command from slowlog if they include auth (#8859)
Redact commands that include sensitive data from slowlog and monitor
2021-05-19 08:23:54 -07:00
Oran Agra
d67e66de72
Fix race in new lazyfree test (#8965)
I recently saw this failure:
[err]: lazy free a stream with all types of metadata in tests/unit/lazyfree.tcl
Expected '2' to be equal to '1' (context: type eval line 23 cmd {assert_equal [s lazyfreed_objects] 1} proc ::test)

The only explanation for such a thing is that the async flushdb wasn't
done before we did the resetstat
2021-05-19 16:06:43 +03:00
Huang Zhw
ed2602ab99
redis-cli clusterManagerCommandCreate calculate interleaved_len wrong (#8964)
which make interleaved_len bigger and may access array out of range.
2021-05-19 14:49:38 +03:00
Bonsai
20268d04c0
Fix different reply on SENTINEL SIMULATE-FAILURE help command (#8962) 2021-05-19 14:42:33 +03:00
DarrenJiang13
1bab4cd198
try a more concise rdbTryIntegerEncoding using string2ll rather than strtoll. (#8926)
when string2ll was made to replace isStringRepresentableAsLongLong
(which was similar to what rdbTryIntegerEncoding does),
rdbTryIntegerEncoding was probably forgotten.
2021-05-19 09:24:26 +03:00
Binbin
09a99fcd5f
In activeDefragStringOb, we have took care defragged so not need to self-incr. (#8952)
incrementing the defragged hits counter twice in activeDefragSdsListAndDict
2021-05-18 18:33:01 +03:00
Eduardo Felipe
25d827d949
Add documentation for firstkey, lastkey and keystep parameters of RedisModule_CreateCommand (#8883)
These parameters of RedisModule_CreateCommand were previously
undocumented but they are needed for ACL to check permission on keys and
by Redis Cluster to figure our how to route the command.

Co-authored-by: Eduardo Felipe Castegnaro <edufelipe@onsign.tv>
Co-authored-by: Oran Agra <oran@redislabs.com>
2021-05-18 17:19:30 +03:00
Guy Korland
e5a8928290
Avoid passing GeoHashRadius by value (#8941)
This parameter of type GeoHashRadius is 192 bytes - passing a `const` pointer instead.
2021-05-18 17:14:34 +03:00
Oran Agra
8458baf6a9
longer timeout in replication test (#8963)
the test normally passes. but we saw one failure in a valgrind run in github actions
2021-05-18 17:13:59 +03:00
Oran Agra
7b48de68ce
Remove useless - from help.h on commands with no arguments (#8939)
As far as i can tell it shows up in redis-cli in both HELP, e.g.
`help client list`, and also in the command completion tips, but it is
unclear what it was needed for.
It exists since the very first commit that added this mechanism.
2021-05-18 17:13:10 +03:00
Oran Agra
cf41c0b5ff
fix race in config rewrite test (#8960) 2021-05-18 17:10:06 +03:00
Huang Zhw
55fa91ae53
redis-cli: some commands should bypass history file. (#8895)
Currently in redis-cli only AUTH and ACL SETUSER bypass history
file. We add CONFIG SET masterauth/masteruser/requirepass,
HELLO with AUTH, MIGRATE with AUTH or AUTH2 to bypass history
file too.

The drawback is HELLO and MIGRATE's code is a mess. Someday if
we change these commands, we have to change here too.
2021-05-18 10:30:24 +03:00
Binbin
8351a10b95
redis-cli: Sleep for a while in each cliConnect when we got connect error in cluster mode. (#8884)
There's an infinite loop when redis-cli fails to connect in cluster mode.
This commit adds a 1 second sleep to prevent flooding the console with errors.
It also adds a specific error print in a few places that could have error without printing anything.

Co-authored-by: Oran Agra <oran@redislabs.com>
2021-05-18 10:09:45 +03:00
zhaozhao.zz
0ecc814c81
AOF: remove memmove in aofChildWriteDiffData and record the latency (#5362)
Improve performance by avoiding inefficiencies in the parent process during AOFRW.
* AOF: record the latency of aofChildWriteDiffData
* AOF: avoid memmove in aofChildWriteDiffData
2021-05-17 16:57:17 +03:00
Oran Agra
fbc0e2b834
Reset lazyfreed_objects info field with RESETSTAT, test for stream lazyfree (#8934)
And also add tests to cover lazy free of streams with various types of
metadata (see #8932)
2021-05-17 16:54:37 +03:00
Huang Zhw
8827aae83b
redis-cli: fix bugs in hints of commands with subcommands. (#8914)
There are two bugs in redis-cli hints:
* The hints of commands with subcommands lack first params.
* When search matching command of currently input, we should find the
command with longest matching prefix. If not COMMAND INFO will always
match COMMAND and display no hints.
2021-05-17 16:52:40 +03:00
patpatbear
46d9f31e94
sinterstore: add missing keyspace del event when any source set not exists. (#8949)
this patch fixes sinterstore by add missing keyspace del event when any source set not exists.

Co-authored-by: srzhao <srzhao@sysnew.com>
2021-05-15 15:43:09 +03:00
Madelyn Olson
df4d916007
Moved security bugs and vulnerability policy to SECURITY.md (#8938)
Moved security bugs and vulnerability policy to SECURITY.MD and extended security policy.

Co-authored-by: Yossi Gottlieb <yossigo@gmail.com>
2021-05-13 21:16:27 -07:00
Raghav Muddur
31edc22ecc
EVALSHA_RO and EVAL_RO Commands (#8820)
* EVALSHA_RO and EVAL_RO Commands

Added new readonly versions of EVAL
and EVALSHA.
2021-05-12 21:07:34 -07:00
George Anderson Guimarães
e01c92a5ef
improve error handing in anetFDToString to avoid returning successfully with garbage. (#8678)
Check for errors in inet_ntop and snprintf rather than ignore them
and return success (with garbage output).
The check for ip_len == 0 seems like dead code, removed.
2021-05-11 14:27:08 +03:00
Huang Zhw
8526e04e7b
cluster process publish message only for known nodes. (#8856) 2021-05-10 08:29:11 -07:00
Oran Agra
97108845e2
Fix crash unlinking a stream with groups rax and no groups (#8932)
When estimating the effort for unlink, we try to compute the effort of
the first group and extrapolate.
If there's a groups rax that's empty, there'a an assertion.

reproduce:
xadd s * a b
xgroup create s bla $
xgroup destroy s bla
unlink s
2021-05-10 17:08:43 +03:00
Binbin
fb66c1b58c
Fix typos, and consistent function argument names in quicklist (#8915)
Also fixes a chance for compilation error if REDIS_TEST_VERBOSE would be used.
2021-05-10 14:02:25 +03:00
Huang Zhw
4d4db9797f
Cleanup: sentinel config, latency extra time() (#8810) 2021-05-09 18:45:45 +03:00
Oran Agra
d32fd31588
redis-benchmark bad check for NOAUTH and NOPERM (#8931)
also, print errors to stderr rather than stdout
2021-05-09 18:19:25 +03:00
Binbin
56976ffb49
Use function instead of code in dict.c and delete dead code in dict.h (#8878)
Use function instead of code in dict.c and delete dead code in dict.h
2021-05-09 15:21:18 +03:00
Binbin
57b94eacaa
Typo: Change port_get to port_getn in aeApiPoll panic message. (#8920) 2021-05-07 15:34:35 +03:00
Huang Zhw
6b47598998
redis-cli when SELECT fails, we should reset dbnum to 0 (#8898)
when SELECT fails, we should reset dbnum to 0, so the prompt will not
display incorrectly.

Additionally when SELECT and HELLO fail, we output message to inform
it.

Add config.input_dbnum which means the dbnum about to select.
And config.dbnum means currently selected dbnum. When users succeed to
select db, config.dbnum and config.input_dbnum will be the same. When
users select db failed, config.input_dbnum will be kept. Next time if users
auth success, config.input_dbnum will be automatically selected.
When reconnect, we should select the origin dbnum.

Co-authored-by: Oran Agra <oran@redislabs.com>
2021-05-06 18:34:45 +03:00
Oran Agra
4d1094e8be
fix redis-benchmark to ignore unsupported configs (#8916)
Redis Enterprise supports the CONFIG GET command, but it replies with am
empty array since the save and appendonly configs are not supported.
before this fix redis-benchmark would segfault for trying to access the
error string on an array type reply.
see #8869
2021-05-06 17:45:49 +03:00
Wang Yuan
81e2d7272b
Fix wrong COW memory in log (#8917)
Always 0 MB of memory used by copy-on-write, introduced in #8645.
2021-05-06 10:52:11 +03:00
Zerong Yao
bcc519fa7c
remove duplicate fd lookup in aeProcessEvents (#3886)
Minor code cleanup.
2021-05-05 15:12:53 +03:00
Binbin
a62801eb53
redis-cli: Fix integer overflow in intrinsic-latency (#8907) 2021-05-04 20:21:14 +03:00
yoav-steinberg
152fce5e2c
Enforce client output buffer soft limit when no traffic. (#8833)
When client breached the output buffer soft limit but then went idle,
we didn't disconnect on soft limit timeout, now we do.
Note this also resolves some sporadic test failures in due to Linux
buffering data which caused tests to fail if during the test we went
back under the soft COB limit.

Co-authored-by: Oran Agra <oran@redislabs.com>
Co-authored-by: sundb <sundbcn@gmail.com>
2021-05-04 13:45:08 +03:00
Oran Agra
fd7d51c353 Resolve nonsense static analysis warnings 2021-05-03 18:59:47 +03:00
Oran Agra
f0c5f920d0 Fix integer overflow in STRALGO LCS (CVE-2021-29477)
An integer overflow bug in Redis version 6.0 or newer could be exploited using
the STRALGO LCS command to corrupt the heap and potentially result with remote
code execution.
2021-05-03 18:59:47 +03:00