Commit Graph

12568 Commits

Author SHA1 Message Date
jonathan keinan 98be450f1d * fix typo 2025-02-06 13:16:33 +02:00
jonathan keinan 0f6e3a8273 * improve function documentation 2025-02-06 13:16:33 +02:00
jonathan keinan de4e92ac39 * addressing code review comments 2025-02-06 13:16:33 +02:00
jonathan keinan 49455c43ae * change foo to goo so test will be correct and pass 2025-02-06 13:16:33 +02:00
jonathan keinan c2694fb696 * change config value in test to be different than overwritten value 2025-02-06 13:16:33 +02:00
jonathan keinan c88f9fe26f * update comment 2025-02-06 13:16:33 +02:00
jonathan keinan 855ec46a6a * rename MODULE_ONLOAD_CONFIG to MODULE_NON_DEFAULT_CONFIG 2025-02-06 13:16:33 +02:00
jonathan keinan f7353db7eb * fix test
* cleanup strval2 on if an error during the OnLoad was encountered.
2025-02-06 13:16:33 +02:00
jonathan keinan 294492dbf2 * fix tests
* add some logging to test module
2025-02-06 13:16:33 +02:00
jonathan keinan 192799539f * register `LoadDefaultConfigs` 2025-02-06 13:16:33 +02:00
jonathan keinan a8850a8d30 * remove unused variable 2025-02-06 13:16:33 +02:00
jonathan keinan f35ad82314 * add missing newline 2025-02-06 13:16:33 +02:00
jonathan keinan a034773497 * remove redundant module config variable 2025-02-06 13:16:33 +02:00
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
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