12176 Commits

Author SHA1 Message Date
christianEQ
ec255fea11 bump version
Former-commit-id: 35dc4df1df72ac0ff8224ad664426f26bd4c8868
2022-01-13 00:07:03 +00:00
christianEQ
6122cce93b Merge branch 'unstable' into RELEASE_6
Former-commit-id: e69f1023a96e0da8880be4afb3107c3d8b6b9a75
2022-01-10 23:54:30 +00:00
John Sully
d652b13a32 Remove double free in keydb-benchmark
Former-commit-id: b4528b797de8ea81d4bfabbfd86231c6a904e7f4
2021-12-23 14:20:41 -05:00
John Sully
b38157b581 Fix deadlock issue #183 cause by lock inversion
Former-commit-id: e070651039975ad1d5be4a5f7cbb28eeefcb0015
2021-12-23 13:17:14 -05:00
John Sully
ff5e5f89ed Apple build break fix
Former-commit-id: 7a32ec39fdb738e9c3cd2b73ee18355ced793a65
2021-12-23 13:12:59 -05:00
John Sully
9f09e3aa9c Fix module test break
Former-commit-id: 50dfee2039e199f60f927790e7ac81625402b191
2021-12-23 13:12:34 -05:00
benschermel
e8bcf8fbac update deb changelog
Former-commit-id: 5169f974b1ae05ce383242f3820033e9214b9a72
2021-11-17 18:22:36 +00:00
VivekSainiEQ
1ab337d760 bump version
Former-commit-id: 2d25e62ece9ecaff4252197c050031737fc1f211
2021-11-15 23:45:46 +00:00
VivekSainiEQ
147abcb3bc Merge branch 'unstable' into RELEASE_6
Former-commit-id: b0b81c60d9a8457c8840b4424b18fa4851907b22
2021-11-15 18:08:01 +00:00
Vivek Saini
440c637c6c Merge pull request #375 from VivekSainiEQ/time_thread_backport
Backport the time thread code from the enterprise version of KeyDB.

Also fix an issue with clustering where connections are potentially written to after being closed.

Former-commit-id: 4b6bdcbccef3c4c93d85c62281b266e452912bac
2021-11-15 12:57:15 -05:00
benschermel
2b2cf42e11 Merge pull request #377 from EQ-Alpha/systemd_rel
update release packaging

Former-commit-id: 244af9451cbe22db9bf0a0239b3e17a82d7077fa
2021-11-13 13:16:48 -05:00
benschermel
81d9257758 update release packaging
Former-commit-id: 639179471ec155ce3ec4443095c44b66cfe66cfe
2021-11-13 17:50:42 +00:00
benschermel
87a05a7782 Merge pull request #345 from EQ-Alpha/pkg_update_tools
add keydb-diagnostic-tool to packaging

Former-commit-id: 31c0e38d86398ff1f8c7859c62900a18f8104c08
2021-11-10 22:16:09 -05:00
benschermel
8e31c59279 Merge pull request #376 from EQ-Alpha/systemd_build
Systemd build

Former-commit-id: 8f5b94c75fdbb890c9686f130600be2eed152ad9
2021-11-10 22:14:24 -05:00
benschermel
3df64e5a42 fix typo
Former-commit-id: d1fc7b96ed6bb18776ef334882d8c00fb3c068d0
2021-11-11 02:36:20 +00:00
benschermel
18f082e302 update license
Former-commit-id: b253a7aa8d5fffcb46b40c30a8cd8b0b60489345
2021-11-11 02:19:56 +00:00
benschermel
9f0dfd3df8 Merge branch 'unstable' into systemd_build
Former-commit-id: 1625c74a368f32c4ee4185f3b9b3d849636a4936
2021-11-11 00:59:33 +00:00
Vivek Saini
b8136b1580 Security fixes (#373)
Fixing potential buffer overflows when using the bitop shift and cron commands, as well as comparing ACL user passwords in constant time.

Former-commit-id: 3c716ee33d2d14d517271b674dd57c8328d14522
2021-11-09 19:00:01 -05:00
VivekSainiEQ
83b23eafd0 Backported time thread code from enterprise
Former-commit-id: b03eab2a0628df157c1f6b6242bb500ca826ef45
2021-11-05 00:30:34 +00:00
VivekSainiEQ
591f0c77c4 Check that cluster connection is valid before setting write handler
Former-commit-id: 6a0a005ff2587c1c2647d3a077472b8bca38a074
2021-11-02 17:43:17 +00:00
malavan
c48a942ce4 null check for delete override
Former-commit-id: 51216ee433d606644f3c2953abb97753b2eae079
2021-10-29 15:59:21 +00:00
Vivek Saini
6b8e55ce06 Merge pull request #372 from VivekSainiEQ/Redis_626_Merge
Redis 6.2.6 merge

Former-commit-id: 5f7ca6a2f6643352296d6b2ec41dc67c99300b20
2021-10-28 17:21:14 -04:00
VivekSainiEQ
349d9d2c05 Cast pointer correctly and fixed MVCC not updating correctly
Former-commit-id: 79bdcf0b3d0c190a24e6b7da50ce05f4e5185d04
2021-10-27 17:08:37 +00:00
VivekSainiEQ
a7e7540284 Resolved merge conflicts in prior commit
Former-commit-id: b88f06b16f3d9e58ec884c61d2d074d7a489775e
2021-10-21 22:35:15 +00:00
VivekSainiEQ
b84ee93b5d Merge tag '6.2.6' into Redis_626_Merge
Former-commit-id: e6d7e01be6965110d487e12f40511fe0b3497695
2021-10-21 22:33:55 +00:00
noobpwnftw
b9d171eb32 Fix incorrect counting of client connections
This affects later distribution of clients among threads if there had been many connection attempts during loading phase.


Former-commit-id: 889bcd1bf1adeb246af04bbeb7f9e51c0c4eff1b
2021-10-12 21:47:15 -04:00
Alexis
2e9f7b5069 Fix alignment of #ifndef USE_ALIGNED_ACCESS
Former-commit-id: 9637887264336fdce84519afe773ea7b1a628705
2021-10-12 14:27:53 -04:00
Oran Agra
46dddd680c Redis 6.2.6 2021-10-04 13:59:40 +03:00
Oran Agra
c7f304e118 corrupt-dump-fuzzer test, avoid creating junk keys (#9302)
The execution of the RPOPLPUSH command by the fuzzer created junk keys,
that were later being selected by RANDOMKEY and modified.
This also meant that lists were statistically tested more than other
files.

Fix the fuzzer not to pass junk key names to RPOPLPUSH, and add a check
that detects that new keys are not added by the fuzzer to detect future
similar issues.

(cherry picked from commit 3f3f678a4741e6af18230ee1862d9ced7af79faf)
2021-10-04 13:59:40 +03:00
sundb
e8874ee387 Fix missing check for sanitize_dump in corrupt-dump-fuzzer test (#9285)
this means the assertion that checks that when deep sanitization is enabled,
there are no crashes, was missing.

(cherry picked from commit 3db0f1a284e4fba703419b892b2d5b8d385afc06)
2021-10-04 13:59:40 +03:00
Yunier Pérez
0708720d3c Allow to override OPENSSL_PREFIX (#9567)
While the original issue was on Linux, this should work for other
platforms as well.
2021-10-04 13:59:40 +03:00
Yossi Gottlieb
dc91aca7b0 Propagate OPENSSL_PREFIX to hiredis. (#9345) 2021-10-04 13:59:40 +03:00
Oran Agra
dd65d55634 Fix stream sanitization for non-int first value (#9553)
This was recently broken in #9321 when we validated stream IDs to be
integers but did that after to the stepping next record instead of before.

(cherry picked from commit 5a4ab7c7d2da1773c5ed3dcfc6e367b5af03a33e)
2021-10-04 13:59:40 +03:00
David CARLIER
fe6cfa9615 TLS build fix on OpenBSD when built with LibreSSL. (#9486)
(cherry picked from commit 418c2e79313b367e64e47d38edd59f9f22a3b4fa)
2021-10-04 13:59:40 +03:00
yvette903
1e21863e20 Fix: client pause uses an old timeout (#9477)
A write request may be paused unexpectedly because `server.client_pause_end_time` is old.

**Recreate this:**
redis-cli -p 6379
127.0.0.1:6379> client pause 500000000 write
OK
127.0.0.1:6379> client unpause
OK
127.0.0.1:6379> client pause 10000 write
OK
127.0.0.1:6379> set key value

The write request `set key value` is paused util  the timeout of 500000000 milliseconds was reached.

**Fix:**
reset `server.client_pause_end_time` = 0 in `unpauseClients`

(cherry picked from commit f560531d5b8a6e6d810b62114e69a5ffda7730f7)
2021-10-04 13:59:40 +03:00
zhaozhao.zz
e5e3cd469c Fix wrong offset when replica pause (#9448)
When a replica paused, it would not apply any commands event the command comes from master, if we feed the non-applied command to replication stream, the replication offset would be wrong, and data would be lost after failover(since replica's `master_repl_offset` grows but command is not applied).

To fix it, here are the changes:
* Don't update replica's replication offset or propagate commands to sub-replicas when it's paused in `commandProcessed`.
* Show `slave_read_repl_offset` in info reply.
* Add an assert to make sure master client should never be blocked unless pause or module (some modules may use block way to do background (parallel) processing and forward original block module command to the replica, it's not a good way but it can work, so the assert excludes module now, but someday in future all modules should rewrite block command to propagate like what `BLPOP` does).

(cherry picked from commit 1b83353dc382959e218191f64d94edb9703552e3)
2021-10-04 13:59:40 +03:00
Madelyn Olson
b9c6d6a321 Add test verifying PUBSUB NUMPAT behavior (#9209)
(cherry picked from commit 8b8f05c86c1f1f002caa1f4e1877020389f167e4)
2021-10-04 13:59:40 +03:00
guybe7
7c2c8608a7 Fix two minor bugs (MIGRATE key args and getKeysUsingCommandTable) (#9455)
1. MIGRATE has a potnetial key arg in argv[3]. It should be reflected in the command table.
2. getKeysUsingCommandTable should never free getKeysResult, it is always freed by the caller)
   The reason we never encountered this double-free bug is that almost always getKeysResult
   uses the statis buffer and doesn't allocate a new one.

(cherry picked from commit 6aa2285e32a6bc16fe2938bfb40d833db7d3752d)
2021-10-04 13:59:40 +03:00
sundb
69ffd6cbc5 Fix the timing of read and write events under kqueue (#9416)
Normally we execute the read event first and then the write event.
When the barrier is set, we will do it reverse.
However, under `kqueue`, if an `fd` has both read and write events,
reading the event using `kevent` will generate two events, which will
result in uncontrolled read and write timing.

This also means that the guarantees of AOF `appendfsync` = `always` are
not met on MacOS without this fix.

The main change to this pr is to cache the events already obtained when reading
them, so that if the same `fd` occurs again, only the mask in the cache is updated,
rather than a new event is generated.

This was exposed by the following test failure on MacOS:
```
*** [err]: AOF fsync always barrier issue in tests/integration/aof.tcl
Expected 544 != 544 (context: type eval line 26 cmd {assert {$size1 != $size2}} proc ::test)
```

(cherry picked from commit 306a5ccd2d053ff653988b61a779e3cbce408874)
2021-10-04 13:59:40 +03:00
sundb
b69f619f17 Sanitize dump payload: fix double free after insert dup nodekey to stream rax and returns 0 (#9399)
(cherry picked from commit 492d8d09613cff88f15dcef98732392b8d509eb1)
2021-10-04 13:59:40 +03:00
Wang Yuan
db7c9e66c6 Fix the wrong detection of sync_file_range system call (#9371)
If we want to check `defined(SYNC_FILE_RANGE_WAIT_BEFORE)`, we should include fcntl.h.
otherwise, SYNC_FILE_RANGE_WAIT_BEFORE is not defined, and there is alway not `sync_file_range` system call.
Introduced by #8532

(cherry picked from commit 8edc3cd62c0d0508b68c887610ca53b632b8165b)
2021-10-04 13:59:40 +03:00
sundb
b2f4ca8c64 Sanitize dump payload: handle remaining empty key when RDB loading and restore command (#9349)
This commit mainly fixes empty keys due to RDB loading and restore command,
which was omitted in #9297.

1) When loading quicklsit, if all the ziplists in the quicklist are empty, NULL will be returned.
    If only some of the ziplists are empty, then we will skip the empty ziplists silently.
2) When loading hash zipmap, if zipmap is empty, sanitization check will fail.
3) When loading hash ziplist, if ziplist is empty, NULL will be returned.
4) Add RDB loading test with sanitize.

(cherry picked from commit cbda492909cd2fff25263913cd2e1f00bc48a541)
2021-10-04 13:59:40 +03:00
DarrenJiang13
94bf9b175e [BUGFIX] Add some missed error statistics (#9328)
add error counting for some missed behaviors.

(cherry picked from commit 43eb0ce3bf76a5d287b93a767bead9ad6230a1ad)
2021-10-04 13:59:40 +03:00
Oran Agra
1334180f82 Improvements to corrupt payload sanitization (#9321)
Recently we found two issues in the fuzzer tester: #9302 #9285
After fixing them, more problems surfaced and this PR (as well as #9297) aims to fix them.

Here's a list of the fixes
- Prevent an overflow when allocating a dict hashtable
- Prevent OOM when attempting to allocate a huge string
- Prevent a few invalid accesses in listpack
- Improve sanitization of listpack first entry
- Validate integrity of stream consumer groups PEL
- Validate integrity of stream listpack entry IDs
- Validate ziplist tail followed by extra data which start with 0xff

Co-authored-by: sundb <sundbcn@gmail.com>
(cherry picked from commit 0c90370e6d71cc68e4d9cc79a0d8b1e768712a5b)
2021-10-04 13:59:40 +03:00
sundb
a85fb0283c Sanitize dump payload: fix empty keys when RDB loading and restore command (#9297)
When we load rdb or restore command, if we encounter a length of 0, it will result in the creation of an empty key.
This could either be a corrupt payload, or a result of a bug (see #8453 )

This PR mainly fixes the following:
1) When restore command will return `Bad data format` error.
2) When loading RDB, we will silently discard the key.

Co-authored-by: Oran Agra <oran@redislabs.com>
(cherry picked from commit 8ea777a6a02cae22aeff95f054d810f30b7b69ad)
2021-10-04 13:59:40 +03:00
menwen
44b3a6df77 Add latency monitor sample when key is deleted via lazy expire (#9317)
Fix that there is no sample latency after the key expires via expireIfNeeded().
Some refactoring for shared code.

(cherry picked from commit ca559819f7dcd97ba9ef667bf38360a9527d62f6)
2021-10-04 13:59:40 +03:00
Viktor Söderqvist
39ce98163a redis-cli ASK redirect test: Add retry loop to fix timing issue (#9315)
(cherry picked from commit 1c59567a7fe207997eef6197eefa7d508d7fbf9f)
2021-10-04 13:59:40 +03:00
Oran Agra
667d95f025 Skip new redis-cli ASK test in TLS mode (#9312)
(cherry picked from commit 52df350fe59d73e6a1a4a5fb3c2b91d5c62f5a76)
2021-10-04 13:59:40 +03:00
Huang Zhw
68e3acf113 When redis-cli received ASK, it didn't handle it (#8930)
When redis-cli received ASK, it used string matching wrong and didn't
handle it.

When we access a slot which is in migrating state, it maybe
return ASK. After redirect to the new node, we need send ASKING
command before retry the command.  In this PR after redis-cli receives
ASK, we send a ASKING command before send the origin command
after reconnecting.

Other changes:
* Make redis-cli -u and -c (unix socket and cluster mode) incompatible
  with one another.
* When send command fails, we avoid the 2nd reconnect retry and just
  print the error info. Users will decide how to do next.
  See #9277.
* Add a test faking two redis nodes in TCL to just send ASK and OK in
  redis protocol to test ASK behavior.

Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Co-authored-by: Oran Agra <oran@redislabs.com>
(cherry picked from commit cf61ad14cc45787e57d9af3f28f41462ac0f2aa2)
2021-10-04 13:59:40 +03:00
Binbin
e87d855ab2 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>
(cherry picked from commit 8351a10b959364cff9fc026188ebc9c653ef230a)
2021-10-04 13:59:40 +03:00