Commit Graph

12620 Commits

Author SHA1 Message Date
jonathan keinan fd5c325886 * initial commit 2025-02-06 13:16:33 +02:00
Alexander Gorbulya 17eb33e0c3
Fix typo in repl-ping-replica-period comment in redis.conf (#13782)
The comment for the `repl-ping-replica-period` option in `redis.conf`
mistakenly refers to `repl_ping_replica_period` (with underscores).
This PR corrects it to use the proper format with dashes, as per the
actual configuration option.
2025-02-06 10:14:56 +08:00
YaacovHazan 0aeb86d78d Revert "Improve GETRANGE command behavior (#12272)"
Although the commit #6ceadfb58 improves GETRANGE command behavior,
we can't accept it as we should avoid breaking changes for non-critical bug fixes.

This reverts commit 6ceadfb580.
2025-02-05 20:49:42 +02:00
YaacovHazan 8afb72a326 Revert "improve performance for scan command when matching data type (#12395)"
Although the commit #7f0a7f0a6 improves the performance of the SCAN command,
we can't accept it as we should avoid breaking changes for non-critical bug fixes.

This reverts commit 7f0a7f0a69.
2025-02-05 20:49:42 +02:00
antirez 6c1e55d07c VEMB RAW implemented. 2025-02-05 11:21:06 +01:00
antirez 8206c782b5 Function to get quantization name. 2025-02-05 11:07:35 +01:00
Raz Monsonego 04589f90d7
Add internal connection and command mechanism (#13740)
# PR: Add Mechanism for Internal Commands and Connections in Redis

This PR introduces a mechanism to handle **internal commands and
connections** in Redis. It includes enhancements for command
registration, internal authentication, and observability.

## Key Features

1. **Internal Command Flag**:
   - Introduced a new **module command registration flag**: `internal`.
- Commands marked with `internal` can only be executed by **internal
connections**, AOF loading flows, and master-replica connections.
- For any other connection, these commands will appear as non-existent.

2. **Support for internal authentication added to `AUTH`**:
- Used by depicting the special username `internal connection` with the
right internal password, i.e.,: `AUTH "internal connection"
<internal_secret>`.
- No user-defined ACL username can have this name, since spaces are not
aloud in the ACL parser.
   - Allows connections to authenticate as **internal connections**.
- Authenticated internal connections can execute internal commands
successfully.

4. **Module API for Internal Secret**:
- Added the `RedisModule_GetInternalSecret()` API, that exposes the
internal secret that should be used as the password for the new `AUTH
"internal connection" <password>` command.
- This API enables the modules to authenticate against other shards as
local connections.

## Notes on Behavior

- **ACL validation**:
- Commands dispatched by internal connections bypass ACL validation, to
give the caller full access regardless of the user with which it is
connected.

- **Command Visibility**:
- Internal commands **do not appear** in `COMMAND <subcommand>` and
`MONITOR` for non-internal connections.
- Internal commands **are logged** in the slow log, latency report and
commands' statistics to maintain observability.

- **`RM_Call()` Updates**:
  - **Non-internal connections**:
- Cannot execute internal commands when the command is sent with the `C`
flag (otherwise can).
- Internal connections bypass ACL validations (i.e., run as the
unrestricted user).

- **Internal commands' success**:
- Internal commands succeed upon being sent from either an internal
connection (i.e., authenticated via the new `AUTH "internal connection"
<internal_secret>` API), an AOF loading process, or from a master via
the replication link.
Any other connections that attempt to execute an internal command fail
with the `unknown command` error message raised.

- **`CLIENT LIST` flags**:
  - Added the `I` flag, to indicate that the connection is internal.

- **Lua Scripts**:
   - Prevented internal commands from being executed via Lua scripts.

---------

Co-authored-by: Meir Shpilraien <meir@redis.com>
2025-02-05 11:48:08 +02:00
Ozan Tezcan 09f8a2f374
Start AOFRW before streaming repl buffer during fullsync (#13758)
During fullsync, before loading RDB on the replica, we stop aof child to
prevent copy-on-write disaster.
Once rdb is loaded, aof is started again and it will trigger aof
rewrite. With https://github.com/redis/redis/pull/13732 , for rdbchannel
replication, this behavior was changed. Currently, we start aof after
replication buffer is streamed to db. This PR changes it back to start
aof just after rdb is loaded (before repl buffer is streamed)

Both approaches may have pros and cons. If we start aof before streaming
repl buffers, we may still face with copy-on-write issues as repl
buffers potentially include large amount of changes. If we wait until
replication buffer drained, it means we are delaying starting aof
persistence.

Additional changes are introduced as part of this PR:

- Interface change:
Added `mem_replica_full_sync_buffer` field to the `INFO MEMORY` command
reply. During full sync, it shows total memory consumed by accumulated
replication stream buffer on replica. Added same metric to `MEMORY
STATS` command reply as `replica.fullsync.buffer` field.
  
  
- Fixes: 
- Count repl stream buffer size of replica as part of 'memory overhead'
calculation for fields in "INFO MEMORY" and "MEMORY STATS" outputs.
Before this PR, repl buffer was not counted as part of memory overhead
calculation, causing misreports for fields like `used_memory_overhead`
and `used_memory_dataset` in "INFO STATS" and for `overhead.total` field
in "MEMORY STATS" command reply.
- Dismiss replication stream buffers memory of replica in the fork to
reduce COW impact during a fork.
- Fixed a few time sensitive flaky tests, deleted a noop statement,
fixed some comments and fail messages in rdbchannel tests.
2025-02-04 21:40:18 +03:00
Rowan Trollope 324f861f0e Merge branch 'main' of https://github.com/rowantrollope/vector-sets 2025-02-03 13:27:17 -08:00
Rowan Trollope a50f3b517c typo fix 2025-02-03 13:23:15 -08:00
antirez e6f1667a3d Q8 option for VADD. See README update for info. 2025-02-03 13:05:40 +01:00
antirez ff20d534c6 VSIM: execute on main thread for Lua and MULTI/EXEC. 2025-02-03 11:46:01 +01:00
antirez 337fc3d6fd Don't use threaded VADD in replicas, lua, multi. 2025-02-03 11:28:48 +01:00
Meir Shpilraien (Spielrein) 870b6bd487
Added a shared secret over Redis cluster. (#13763)
The PR introduces a new shared secret that is shared over all the nodes
on the Redis cluster. The main idea is to leverage the cluster bus to
share a secret between all the nodes such that later the nodes will be
able to authenticate using this secret and send internal commands to
each other (see #13740 for more information about internal commands).

The way the shared secret is chosen is the following:
1. Each node, when start, randomly generate its own internal secret.
2. Each node share its internal secret over the cluster ping messages.
3. If a node gets a ping message with secret smaller then his current
secret, it embrace it.
4. Eventually all nodes should embrace the minimal secret

The converges of the secret is as good as the topology converges.

To extend the ping messages to contain the secret, we leverage the
extension mechanism. Nodes that runs an older Redis version will just
ignore those extensions.

Specific tests were added to verify that eventually all nodes see the
secrets. In addition, a verification was added to the test infra to
verify the secret on `cluster_config_consistent` and to
`assert_cluster_state`.
2025-02-03 09:54:37 +02:00
Raz Monsonego c688537d49
Add flag for ability of a module context to execute debug commands (#13774)
This PR adds a flag to the `RM_GetContextFlags` module-API function that
depicts whether the context may execute debug commands, according to
redis's standards.
2025-02-03 09:52:41 +02:00
Rowan Trollope 285134e43d Comment said: "XXX: check explicitly that ELE was passed, not just size" however this code is in the else block after strcasecmp already was checked for ! ELE, therefore we have already validated that this is an ELE element type. REMOVED comment for clarity. 2025-02-01 10:28:24 +01:00
Rowan Trollope daea83d2cf Moved hardcoded default EF of 100 (during threaded search) to define. 2025-02-01 10:25:58 +01:00
Mingyi Kang e3b9397dfe
Bump actions/upload-artifact from 3 to 4 (#13780)
Update `upload-artifact` from v3 to v4 to avoid the failure of `External
Server Tests` (I encountered this error when opening
[#13779](https://github.com/redis/redis/pull/13779)):

> Error: This request has been automatically failed because it uses a
deprecated version of `actions/upload-artifact: v3`. Learn more:
https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/
2025-02-01 14:09:00 +08:00
antirez 31f2b27a05 Digest method: fix calls for order independent hashing. 2025-01-31 20:17:38 +01:00
antirez b61e3021b6 Remove rounding error due to re-normalization on loading. 2025-01-31 19:36:11 +01:00
antirez a71feb6dd8 Replicate VADD with CAS. 2025-01-30 23:26:00 +01:00
antirez 6d1a15987b CLI tool added as example / utility. 2025-01-30 22:44:20 +01:00
Moti Cohen 2bfffe85e9
Fix memleak of SFLUSH experimental command (#13766)
On flushallSyncBgDone, if client doesn't exists, take care release
sflush struct.
2025-01-30 13:35:02 +02:00
antirez 182737f3cc Movies plots example. 2025-01-29 12:45:06 +01:00
antirez 7b5fbf7b3f glove-100 example added. 2025-01-29 12:37:59 +01:00
antirez 26e5871c67 Use -latomic only for ARM. 2025-01-28 22:17:01 +01:00
antirez 9771ca726a Link with -latomic in Linux. 2025-01-28 22:12:05 +01:00
antirez 42a8981b46 HNSW: do not denormalize binary vectors. 2025-01-28 10:12:37 +01:00
antirez 5c8097c2de Document VADD EF option. 2025-01-28 08:39:20 +01:00
antirez 5c23f59ee3 HSNW: Fix adding node with binary quants. 2025-01-27 20:03:14 +01:00
antirez 7cfd894f3a Fix binary quants loading. 2025-01-27 19:30:58 +01:00
antirez 31f097d418 VINFO: handle bin quantization. 2025-01-27 17:59:18 +01:00
antirez 33d653e24f First internal release. 2025-01-27 17:24:58 +01:00
Mason f5e046a730
Update history for ban-list propagation (#13749)
Update CLUSTER FORGET docs for changes in
https://github.com/redis/redis/pull/10869

Docs PR:
https://github.com/redis/docs/pull/1057

---------

Co-authored-by: debing.sun <debing.sun@redis.com>
2025-01-27 21:05:37 +08:00
Vitah Lin 5dbcb3e4ab
Add codecov for automated code coverage (#13393)
This PR introduces Codecov to automate code coverage tracking for our
project's tests.
For more information about the Codecov platform, please refer to
https://docs.codecov.com/docs/quick-start

---------

Co-authored-by: debing.sun <debing.sun@redis.com>
2025-01-27 21:04:11 +08:00
Dustin Rodrigues eb50eb20a5
Fix compile error with TLS_DEBUGGING (#13772) 2025-01-26 10:14:43 +08:00
YaacovHazan c2d3e28540
Update RQE version 7.99.3 (#13767) (#13769)
Update RQE version 7.99.3
2025-01-24 09:20:23 +02:00
YaacovHazan 0c1a764074 Merge commit 'dcd0b3d02' into HEAD 2025-01-24 09:15:59 +02:00
debing.sun f86575f210
Gradually reduce defrag CPU usage when defragmentation is ineffective (#13752)
This PR addresses an issue where if a module does not provide a
defragmentation callback, we cannot defragment the fragmentation it
generates. However, the defragmentation process still considers a large
amount of fragmentation to be present, leading to more aggressive
defragmentation efforts that ultimately have no effect.

To mitigate this, the PR introduces a mechanism to gradually reduce the
CPU consumption for defragmentation when the defragmentation
effectiveness is poor. This occurs when the fragmentation rate drops
below 2% and the hit ratio is less than 1%, or when the fragmentation
rate increases by no more than 2%. The CPU consumption will be gradually
decreased until it reaches the minimum threshold defined by
`active-defrag-cycle-min`.

---------

Co-authored-by: oranagra <oran@redislabs.com>
2025-01-24 11:35:32 +08:00
nafraf dcd0b3d020
Update RQE version 7.99.3 (#13767)
Update RQE version 7.99.3
2025-01-23 22:46:50 +02:00
YaacovHazan d88611d36f
Redis 8.0 M03 (#13759) 2025-01-20 19:45:10 +02:00
YaacovHazan 4c5a9076d7 Redis 8.0 M03 2025-01-20 16:00:49 +02:00
YaacovHazan 8aab7ca84c Merge remote-tracking branch 'upstream/unstable' into HEAD 2025-01-20 11:06:49 +02:00
YaacovHazan 781ccc1bee
Update modules with latest version (#13755)
Update redisbloom, redisjson and redistimeseries versions to 7.99.2

Co-authored-by: YaacovHazan <yaacov.hazan@redislabs.com>
2025-01-20 10:08:19 +02:00
DvirDukhan ee96a5a6f5
Update RQE version (#13750)
v7.99.2
2025-01-16 08:40:19 +02:00
YaacovHazan 9c81f8bd61 Merge remote-tracking branch 'upstream/unstable' into HEAD 2025-01-14 14:01:19 +02:00
debing.sun 0f65806b5b
Update info.tcl test to revert client output limits sooner (#13738)
This PR is based on: https://github.com/valkey-io/valkey/pull/1462

We set the client output buffer limits to 10 bytes, and then execute
info stats which produces more than 10 bytes of output, which can cause
that command to throw an error.

I'm not sure why it wasn't consistently erroring before, might have been
some change related to the ubuntu upgrade though.

failed CI:
https://github.com/redis/redis/actions/runs/12738281720/job/35500381299

------
Co-authored-by: Madelyn Olson
[madelyneolson@gmail.com](mailto:madelyneolson@gmail.com)
2025-01-14 17:30:18 +08:00
Yuan Wang 5b8b58e472
Fix incorrect parameter type reports (#13744)
After upgrading of ubuntu 24.04, clang18 can check runtime error: call
to function XXX through pointer to incorrect function type, our daily CI
reports the errors by UndefinedBehaviorSanitizer (UBSan):

https://github.com/redis/redis/actions/runs/12738281720/job/35500380251#step:6:346

now we add generic version of some existing `free` functions to support
to call function through (void*) pointer, actually, they just are the
wrapper functions that will cast the data type and call the
corresponding functions.
2025-01-14 15:51:05 +08:00
YaacovHazan 342ee426ad Fix LUA garbage collector (CVE-2024-46981)
Reset GC state before closing the lua VM to prevent user data
to be wrongly freed while still might be used on destructor callbacks.
2025-01-13 21:20:19 +02:00
YaacovHazan 4a95b3005a Fix Read/Write key pattern selector (CVE-2024-51741)
The '%' rule must contain one or both of R/W
2025-01-13 21:20:19 +02:00