Commit Graph

12598 Commits

Author SHA1 Message Date
Yuan Wang 951ec79654
Cluster compatibility check (#13846)
CI / build-macos-latest (push) Waiting to run Details
CI / build-32bit (push) Failing after 31s Details
CI / build-libc-malloc (push) Failing after 31s Details
CI / build-debian-old (push) Failing after 1m32s Details
CI / build-old-chain-jemalloc (push) Failing after 31s Details
Codecov / code-coverage (push) Failing after 31s Details
CI / test-ubuntu-latest (push) Failing after 3m21s Details
Spellcheck / Spellcheck (push) Failing after 31s Details
CI / test-sanitizer-address (push) Failing after 6m36s Details
CI / build-centos-jemalloc (push) Failing after 6m36s Details
External Server Tests / test-external-standalone (push) Failing after 2m10s Details
Coverity Scan / coverity (push) Has been skipped Details
External Server Tests / test-external-nodebug (push) Failing after 2m12s Details
External Server Tests / test-external-cluster (push) Failing after 2m16s Details
### Background
The program runs normally in standalone mode, but migrating to cluster
mode may cause errors, this is because some cross slot commands can not
run in cluster mode. We should provide an approach to detect this issue
when running in standalone mode, and need to expose a metric which
indicates the usage of no incompatible commands.

### Solution
To avoid perf impact, we introduce a new config
`cluster-compatibility-sample-ratio` which define the sampling ratio
(0-100) for checking command compatibility in cluster mode. When a
command is executed, it is sampled at the specified ratio to determine
if it complies with Redis cluster constraints, such as cross-slot
restrictions.

A new metric is exposed: `cluster_incompatible_ops` in `info stats`
output.

The following operations will be considered incompatible operations.

- cross-slot command
   If a command has multiple cross slot keys, it is incompatible
- `swap, copy, move, select` command
These commands involve multi databases in some cases, we don't allow
multiple DB in cluster mode, so there are not compatible
- Module command with `no-cluster` flag
If a module command has `no-cluster` flag, we will encounter an error
when loading module, leading to fail to load module if cluster is
enabled, so this is incompatible.
- Script/function with `no-cluster` flag
Similar with module command, if we declare `no-cluster` in shebang of
script/function, we also can not run it in cluster mode
- `sort` command by/get pattern
When `sort` command has `by/get` pattern option, we must ask that the
pattern slot is equal with the slot of keys, otherwise it is
incompatible in cluster mode.

- The script/function command accesses the keys and declared keys have
different slots
For the script/function command, we not only check the slot of declared
keys, but only check the slot the accessing keys, if they are different,
we think it is incompatible.

**Besides**, commands like `keys, scan, flushall, script/function
flush`, that in standalone mode iterate over all data to perform the
operation, are only valid for the server that executes the command in
cluster mode and are not broadcasted. However, this does not lead to
errors, so we do not consider them as incompatible commands.

### Performance impact test
**cross slot test**
Below are the test commands and results. When using MSET with 8 keys,
performance drops by approximately 3%.

**single key test**
It may be due to the overhead of the sampling function, and single-key
commands could cause a 1-2% performance drop.
2025-03-20 10:35:53 +08:00
Filipe Oliveira (Redis) 3e012c9260
Fix string2d usage in case of hexadecimal strings parsing and overflow (#13845)
CI / build-macos-latest (push) Waiting to run Details
CI / build-debian-old (push) Failing after 6s Details
CI / build-centos-jemalloc (push) Failing after 5s Details
CI / build-old-chain-jemalloc (push) Failing after 3s Details
Codecov / code-coverage (push) Failing after 7s Details
CI / build-libc-malloc (push) Successful in 56s Details
CI / test-sanitizer-address (push) Failing after 1m8s Details
CI / test-ubuntu-latest (push) Failing after 2m13s Details
CI / build-32bit (push) Failing after 3m28s Details
Coverity Scan / coverity (push) Has been skipped Details
External Server Tests / test-external-nodebug (push) Failing after 1m48s Details
External Server Tests / test-external-standalone (push) Failing after 2m9s Details
External Server Tests / test-external-cluster (push) Failing after 2m14s Details
Spellcheck / Spellcheck (push) Successful in 9m3s Details
Since https://github.com/redis/redis/pull/11884, what was previously
accepted as a valid input (hexadecimal string) before 8.0 returned an
error. This PR addresses it. To avoid performance penalties if hints the
compiler that the fallbacks are not likely to happen.
Furthermore, we were ignoring std::result_out_of_range outputs from
fast_float. This PR addresses it as well and includes tests for both
identified scenarios.

---------

Co-authored-by: debing.sun <debing.sun@redis.com>
2025-03-19 20:08:45 +08:00
antirez 758e963a4e VRANDMEMBER documentation. 2025-03-19 09:02:15 +01:00
debing.sun 26dcec4812
Fix messed-up unblocked clients in flush command (#13865)
CI / build-macos-latest (push) Waiting to run Details
CI / build-debian-old (push) Failing after 6s Details
CI / build-centos-jemalloc (push) Failing after 5s Details
CI / build-old-chain-jemalloc (push) Failing after 3s Details
Codecov / code-coverage (push) Failing after 7s Details
CI / build-32bit (push) Failing after 20s Details
CI / build-libc-malloc (push) Successful in 47s Details
CI / test-sanitizer-address (push) Failing after 2m6s Details
CI / test-ubuntu-latest (push) Failing after 2m11s Details
External Server Tests / test-external-standalone (push) Failing after 2m13s Details
External Server Tests / test-external-nodebug (push) Failing after 2m11s Details
External Server Tests / test-external-cluster (push) Failing after 2m18s Details
Spellcheck / Spellcheck (push) Successful in 9m4s Details
Fix https://github.com/redis/redis/pull/13853#pullrequestreview-2675227138

This PR ensures that the client's current command is not reset by
unblockClient(), while still needing to be handled after `unblockclient()`.
The FLUSH command still requires reprocessing (update the replication
offset) after unblockClient(). Therefore, we mark such blocked clients
with the CLIENT_PENDING_COMMAND flag to prevent the command from being
reset during unblockClient().
2025-03-19 10:22:47 +08:00
antirez 3424757f4d Test: added another threading stress test.
This access pattern triggered the bug fixed
about VADD and CAS in 70ffa8c.
2025-03-18 23:18:26 +01:00
antirez 70ffa8ce5c Fix VADD_CASReply() NULL reference on ID mismatch.
This bug was fixed thanks to the kind help of Dvir Dukhan
(@DvirDukhan) that found it and provided useful context.
2025-03-18 21:37:06 +01:00
antirez 99176b3e04 Test: VRANDMEMBER test added. 2025-03-18 16:49:27 +01:00
antirez 22ce9f3fad VRANDMEMBER command implemented. 2025-03-17 23:52:15 +01:00
debing.sun a5a3afd923
Fix crash during SLAVEOF when clients are blocked on lazyfree (#13853)
CI / build-debian-old (push) Failing after 7s Details
CI / build-centos-jemalloc (push) Failing after 6s Details
CI / build-old-chain-jemalloc (push) Failing after 4s Details
Codecov / code-coverage (push) Failing after 7s Details
CI / build-libc-malloc (push) Successful in 53s Details
CI / test-sanitizer-address (push) Failing after 1m4s Details
CI / test-ubuntu-latest (push) Failing after 2m9s Details
CI / build-32bit (push) Failing after 9m50s Details
Spellcheck / Spellcheck (push) Successful in 9m0s Details
Coverity Scan / coverity (push) Has been skipped Details
External Server Tests / test-external-standalone (push) Failing after 31s Details
External Server Tests / test-external-cluster (push) Failing after 6m36s Details
External Server Tests / test-external-nodebug (push) Failing after 9m54s Details
CI / build-macos-latest (push) Has been cancelled Details
After https://github.com/redis/redis/pull/13167, when a client calls
`FLUSHDB` command, we still async empty database, and the client was
blocked until the lazyfree completes.

1) If another client calls `SLAVEOF` command during this time, the
server will unblock all blocked clients, including those blocked by the
lazyfree. However, when unblocking a lazyfree blocked client, we forgot
to call `updateStatsOnUnblock()`, which ultimately triggered the
following assertion.

2) If a client blocked by Lazyfree is unblocked midway, and at this
point the `bio_comp_list` has already received the completion
notification for the bio, we might end up processing a client that has
already been unblocked in `flushallSyncBgDone()`. Therefore, we need to
filter it out.

---------

Co-authored-by: oranagra <oran@redislabs.com>
2025-03-17 20:27:05 +08:00
kei-nan 752576ce47
Use Search v7.99.5 (#13859)
CI / build-macos-latest (push) Waiting to run Details
CI / test-ubuntu-latest (push) Failing after 32s Details
CI / test-sanitizer-address (push) Failing after 31s Details
CI / build-debian-old (push) Failing after 31s Details
CI / build-32bit (push) Failing after 32s Details
CI / build-libc-malloc (push) Failing after 31s Details
CI / build-centos-jemalloc (push) Failing after 31s Details
CI / build-old-chain-jemalloc (push) Failing after 31s Details
Codecov / code-coverage (push) Failing after 31s Details
Spellcheck / Spellcheck (push) Failing after 31s Details
Coverity Scan / coverity (push) Has been skipped Details
External Server Tests / test-external-standalone (push) Failing after 2m7s Details
External Server Tests / test-external-nodebug (push) Failing after 2m5s Details
External Server Tests / test-external-cluster (push) Failing after 8m25s Details
2025-03-16 10:00:51 +02:00
antirez 706721f8c8 HSNW: random node. 2025-03-16 00:08:43 +01:00
antirez 8a5cf17cb2 HNSW: cursor fixes and thread safety. 2025-03-15 23:31:24 +01:00
antirez a363e5fe6d README: memory usage section. 2025-03-15 23:16:28 +01:00
antirez 6e434bcaaf HNSW: use node max link property.
This is both more correct in formal terms, and in practical
terms as well, as we could over-allocate nodes sometimes.
2025-03-15 10:30:14 +01:00
antirez 68d3067125 w2v test: fix recall EF usage. 2025-03-15 10:24:20 +01:00
antirez d94058fad9 w2v test: recall histograms + configurable M. 2025-03-15 09:46:42 +01:00
antirez c1c7eeaa69 Document VADD M parameter. 2025-03-15 09:28:55 +01:00
antirez 542736ce25 w2v test: proper recall test added. 2025-03-15 00:24:10 +01:00
antirez 13a0a63bef Copyright Sanfilipo -> Redis Ltd. 2025-03-14 23:06:22 +01:00
antirez d996eb82ef VADD: make M configurable at creation time. 2025-03-13 16:58:55 +01:00
antirez 4e57d3f76f README: grammar. 2025-03-13 15:56:05 +01:00
antirez 2fcf389f2a README: troubleshooting and understandability. 2025-03-13 13:25:48 +01:00
antirez 9500539c55 HNSW: implement last resort node reallocation. 2025-03-13 11:30:07 +01:00
antirez 095842a748 README: scaling information. 2025-03-12 22:58:33 +01:00
antirez 63ae981599 README: show main scalability property of vsets. 2025-03-12 18:41:49 +01:00
antirez cc3874ab87 VADD CAS: fallback when thread creation fails. 2025-03-12 16:57:03 +01:00
antirez f05912dea2 cJSON updated to latest version. 2025-03-12 09:55:23 +01:00
Eran Hadad b704179f15
Update release of RedisJSON, RedisTS and RedisBloom 7.99.4 (#13850)
CI / test-ubuntu-latest (push) Failing after 32s Details
CI / build-32bit (push) Failing after 25s Details
CI / build-centos-jemalloc (push) Failing after 3s Details
CI / build-old-chain-jemalloc (push) Failing after 3s Details
CI / test-sanitizer-address (push) Failing after 1m0s Details
CI / build-libc-malloc (push) Failing after 31s Details
Codecov / code-coverage (push) Failing after 55s Details
CI / build-debian-old (push) Failing after 8m12s Details
Spellcheck / Spellcheck (push) Successful in 9m45s Details
CI / build-macos-latest (push) Has been cancelled Details
External Server Tests / test-external-standalone (push) Failing after 31s Details
External Server Tests / test-external-cluster (push) Failing after 31s Details
Coverity Scan / coverity (push) Has been skipped Details
External Server Tests / test-external-nodebug (push) Failing after 31s Details
CodeQL / Analyze (cpp) (push) Failing after 31s Details
2025-03-11 09:36:28 +02:00
DvirDukhan 557e0b1c07
Update Makefile with search 7.99.4 (#13848) 2025-03-09 13:55:27 +02:00
antirez f829d46535 HNSW: creation time M parameter VS hardcoded. 2025-03-08 16:15:15 +01:00
antirez 0258e85186 VSIM TRUTH option for ground truth results. 2025-03-07 09:58:16 +01:00
debing.sun f364dcca2d
Make RM_DefragRedisModuleDict API support incremental defragmentation for dict leaf (#13840)
After https://github.com/redis/redis/pull/13816, we make a new API to
defrag RedisModuleDict.
Currently, we only support incremental defragmentation of the dictionary
itself, but the defragmentation of values is still not incremental. If
the values are very large, it could lead to significant blocking.
Therefore, in this PR, we have added incremental defragmentation for the
values.

The main change is to the `RedisModuleDefragDictValueCallback`, we
modified the return value of this callback.
When the callback returns 1, we will save the `seekTo` as the key of the
current unfinished node, and the next time we enter, we will continue
defragmenting this node.
When the return value is 0, we will proceed to the next node.

## Test
Since each dictionary in the global dict originally contained only 10
strings, but now it has been changed to a nested dictionary, each
dictionary now has 10 sub-dictionaries, with each sub-dictionary
containing 10 strings, this has led to a corresponding reduction in the
defragmentation time obtained from other tests.
Therefore, the other tests have been modified to always wait for
defragmentation to be turned off before the test begins, then start it
after creating fragmentation, ensuring that they can always run for a
full defragmentation cycle.

---------

Co-authored-by: ephraimfeldblum <ephraim.feldblum@redis.com>
2025-03-04 17:19:41 +08:00
antirez 2114c65012 VINFO: add attributes count. 2025-03-04 09:35:41 +01:00
antirez ed7c539303 Improve Vector Sets MEMORY USAGE implementation.
Now attributes are added as well. Moreover the code no longer uses
the first node to guess the size of the items, but does an average
of the few first items/attributes found. Still O(1) but more precise.
2025-03-04 09:35:41 +01:00
antirez 1d09d67909 Tests: regressios for MEMORY USAGE / DEBUG DIGEST. 2025-03-04 09:35:41 +01:00
antirez 1f92040fcf Fix MEMORY USAGE and DEBUG DIGEST crash.
After adding attributes, the code was still accessing
node->value as a string, but now this is mediated by the value
object.

Close #5
2025-03-04 09:35:41 +01:00
Rowan Trollope 0f2c356b07
Merge pull request #4 from rowantrollope/main
Update readme to fix VGET
2025-03-03 12:31:10 -08:00
Rowan Trollope 0e3ee9afb4 Update readme to fix VGET
VGET -> VGETATTR :)
2025-03-03 11:14:36 -08:00
antirez ab5e01d6bc README: Remove the term "hybrid" search. 2025-03-03 17:29:41 +01:00
antirez b49bc14f96 Fix README conflict. 2025-03-03 13:12:25 +01:00
antirez 883d9e3a75 README: example data set. 2025-03-03 13:10:10 +01:00
antirez 07fd2fa8a6 README: extensive hybrid search documentation. 2025-03-03 10:07:05 +01:00
antirez afcc2ff6e8 LICENSE: change copyright to Redis Ltd. 2025-03-03 09:51:26 +01:00
antirez 4b0bd5b0bd README: VSETATTR / VGETATTR first documentation. 2025-03-03 09:44:40 +01:00
antirez 1ad503001f README: initial documentation of hybrid search. 2025-03-02 22:41:34 +01:00
antirez 6c95ec1d6c Test: fix integration test for FILTER. 2025-03-02 13:38:32 +01:00
antirez abe33257d9 Expr: improve selectors / operators parsing. 2025-03-02 12:58:06 +01:00
antirez c8b6cbc6e1 Test: FILTER integration tests, work in progress. 2025-03-02 12:03:49 +01:00
antirez 1cb927aef6 Test: text FILTER expressions basics. 2025-02-28 17:52:46 +01:00
antirez b417685430 Expr: Allow _ in selectors. 2025-02-28 17:52:27 +01:00