12431 Commits

Author SHA1 Message Date
Ping Xie
9f4f6036b8
Restore comments for client flags (#718) 2024-07-01 13:45:14 -07:00
ranshid
752b6ee8ff
Avoid compilation error oin valkey-cli (#721)
Signed-off-by: ranshid <ranshid@amazon.com>
2024-07-01 19:47:45 +08:00
ranshid
24208812a6
Increase ping and cluster timeout for cluster-slots test (#717)
cluster-slots test is tesing a very fragmented slots range of a
relatively large cluster. For this reason, when run under valgrind, some
of the nodes are timing out when cluster is attempting to converge and
propagate.
This pr sets the test's cluster-node-timeout to 90000 and
cluster-ping-interval to 1000.

Signed-off-by: ranshid <ranshid@amazon.com>
2024-06-30 16:30:46 -07:00
skyfirelee
e4c1f6d45a
Replace client flags to bitfield (#614) 2024-06-30 11:33:10 -07:00
Wen Hui
7415a576a8
Add prompt when Ctrl-C pressed (#702)
When I play the pubsub command in console, I am confused by the
following scenario:


![image](https://github.com/valkey-io/valkey/assets/51993843/c56e3976-1e8f-4053-9abb-16fa05ef6ec4)

The reason is that when I press Ctrl-C, client exits current connection
and reconnects to the server.
Thus I add one prompt message to make everyone clear what it happens.


![image](https://github.com/valkey-io/valkey/assets/51993843/cc620f27-4522-4f34-a7b3-86bcdeedfaba)

---------

Signed-off-by: hwware <wen.hui.ware@gmail.com>
2024-06-28 22:05:40 -04:00
w. ian douglas
b59762f734
Very minor misspelling in some tests (#705)
Fix misspelling "faiover" instead of "failover" in two test cases.

Signed-off-by: w. ian douglas <ian.douglas@iandouglas.com>
2024-06-28 23:56:30 +02:00
Binbin
2979fe6060
CLUSTER SLOT-STATS ORDERBY when stats are the same, compare by slot in ascending order (#710)
Test failed in my local:
```
*** [err]: CLUSTER SLOT-STATS ORDERBY LIMIT correct response pagination, where limit is less than number of assigned slots in tests/unit/cluster/slot-stats.tcl
Expected [dict exists 0 0 1 0 2 0 3 0 4 0 16383] (context: type source line 64 file /xxx/tests/unit/cluster/slot-stats.tcl cmd {assert {[dict exists $expected_slots $slot]}} proc ::assert_slot_visibility level 1)
```

It seems that when the stat is equal, that is, when the key-count is
equal,
the qsort performance will be different. When the stat is equal, we
compare
by slot (in ascending order).

Signed-off-by: Binbin <binloveplay1314@qq.com>
2024-06-28 08:03:03 -07:00
Binbin
518f0bf79b
Fix limit undefined behavior crash in CLUSTER SLOT-STATS (#709)
We did not set a default value for limit, but it will be used
in addReplyOrderBy later, the undefined behavior may crash the
server since the value could be negative and crash will happen
in addReplyArrayLen.

An interesting reproducible example (limit reuses the value of -1):
```
> cluster slot-stats orderby key-count desc limit -1
(error) ERR Limit has to lie in between 1 and 16384 (maximum number of slots).
> cluster slot-stats orderby key-count desc
Error: Server closed the connection
```

Set the default value of limit to 16384.

---------

Signed-off-by: Binbin <binloveplay1314@qq.com>
2024-06-28 08:02:52 -07:00
Binbin
7f7ef9a3fa
Update availability-zone to use the flag instead of the number 0 (#711)
Minor cleanup.

Signed-off-by: Binbin <binloveplay1314@qq.com>
2024-06-28 08:00:07 -07:00
zhaozhao.zz
4fbe31ab87
Fix the TLS and REPS issues about CLUSTER SLOTS cache (#581)
PR #53 introduced the cache of CLUSTER SLOTS response, but the cache has
some problems for different types of clients:

1. the RESP version is wrongly ignored:

    ```
    $./valkey-cli
    127.0.0.1:6379> cluster slots
    1) 1) (integer) 0
       2) (integer) 16383
       3) 1) ""
          2) (integer) 6379
          3) "f1aeceb352401ce57acd432c68c60b359c00ef85"
          4) (empty array)
    127.0.0.1:6379> hello 3
    1# "server" => "valkey"
    2# "version" => "255.255.255"
    3# "proto" => (integer) 3
    4# "id" => (integer) 3
    5# "mode" => "cluster"
    6# "role" => "master"
    7# "modules" => (empty array)
    127.0.0.1:6379> cluster slots
    1) 1) (integer) 0
       2) (integer) 16383
       3) 1) ""
          2) (integer) 6379
          3) "f1aeceb352401ce57acd432c68c60b359c00ef85"
          4) (empty array)
    ```

    RESP3 should get "empty hash" but get RESP2's "empty array"

3. we should use the original client's connect type, or lua/function and
module would get wrong port:

    ```
    $./valkey-cli --tls --insecure -p 6789
    127.0.0.1:6789> config get port tls-port
    1) "tls-port"
    2) "6789"
    3) "port"
    4) "6379"
    127.0.0.1:6789> cluster slots
    1) 1) (integer) 0
       2) (integer) 16383
       3) 1) ""
          2) (integer) 6789
          3) "f1aeceb352401ce57acd432c68c60b359c00ef85"
          4) (empty array)
    127.0.0.1:6789> eval "return redis.call('cluster','slots')" 0
    1) 1) (integer) 0
       2) (integer) 16383
       3) 1) ""
          2) (integer) 6379
          3) "f1aeceb352401ce57acd432c68c60b359c00ef85"
          4) (empty array)
        ```

---------

Signed-off-by: zhaozhao.zz <zhaozhao.zz@alibaba-inc.com>
2024-06-28 14:56:13 +08:00
Kyle Kim (kimkyle@)
1269532fbd
Introduce CLUSTER SLOT-STATS command (#20). (#351)
The command provides detailed slot usage statistics upon invocation,
with initial support for key-count metric. cpu-usec (approved) and
memory-bytes (pending-approval) metrics will soon follow after the
merger of this PR.

---------

Signed-off-by: Kyle Kim <kimkyle@amazon.com>
Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
2024-06-27 16:58:27 -07:00
Wen Hui
7719dbb84b
Update readonly and readwrite json (#704)
Update and align with the latest readonly.md and readwrite.md doc under
https://github.com/valkey-io/valkey-doc/tree/main/commands

Signed-off-by: hwware <wen.hui.ware@gmail.com>
2024-06-27 13:23:53 -07:00
John Sully
ad5704f803
Upstream the availability zone info string from KeyDB (#700)
When Redis/Valkey/KeyDB is run in a cloud environment across multiple
AZ's it is preferable to keep traffic local to an AZ both for cost
reasons and for latency. This is typically done when you are enabling
reads on replicas with the READONLY command.

For this change we are creating a setting that is echo'd back in the
info command. We do not want to add the cloud SDKs as dependencies and
this is the easiest way around that. It is fairly trivial to grab the AZ
from the cloud and push that into your setting file.

Currently at Snapchat we have a custom client that after connecting
reads this from the server and will preferentially use that server if
the AZ string matches its internally configured AZ.

In the future it would be ideal if we used this information when
performing failover or even exposed it in cluster nodes.

Signed-off-by: John Sully <john@csquare.ca>
2024-06-27 12:30:26 -07:00
Binbin
2b0723957e
Enable protected-configs, debug and module commands in create-cluster script (#701)
The create-cluster in utils mainly used to create a test cluster, 
turning on these options is useful for testing purposes.

Signed-off-by: Binbin <binloveplay1314@qq.com>
2024-06-27 12:27:09 -07:00
zhaozhao.zz
28c5a17edf
replica redirect read&write to primary in standalone mode (#325)
To implement #319 

1. replica is able to redirect read and write commands to it's primary
in standalone mode
    * reply with "-REDIRECT primary-ip:port"
2. add a subcommand `CLIENT CAPA redirect`, a client can announce the
capability to handle redirection
    * if a client can handle redirection, the data access commands (read and
write) will be redirected
3. allow `readonly` and `readwrite` command in standalone mode, may be a
breaking change
    * a client with redirect capability cannot process read commands on a
replica by default
    * use READONLY command can allow read commands on a replica

---------

Signed-off-by: zhaozhao.zz <zhaozhao.zz@alibaba-inc.com>
2024-06-27 19:00:45 +08:00
Ouri Half
ab3873011a
Replacing REDIS_STATIC with static (#691)
As discussed, we want to remove the old `REDIS_STATIC` flag which is no
longer relevant.

When moving from Redis to Valkey we renamed all REDIS flags in Makefile.
The REDIS_STATIC flag was renamed to SERVER_STATIC, but this change was
not updated in some of the files.

After discussing it with @madolson and @ranshid, we decided that since
this was introduced 10 years ago, and in many places in the code base we
simply use `static`, we should simplify and remove the flag entirely.

---------

Signed-off-by: Ouri Half <ourih@amazon.com>
2024-06-26 09:47:59 -07:00
Pierre
495c35d918
Add check in CLUSTERLINK KILL cmd to avoid freeing links to myself (#689)
Add check in CLUSTERLINK KILL cmd to avoid freeing cluster bus links to
myself. Also add an assert in `freeClusterLink()`.

Testing:
```
127.0.0.1:6379> debug clusterlink kill all c0404ee68574c6aa1048aaebfe90283afe51d2fc
(error) ERR Cannot free cluster link(s) to myself
```

Signed-off-by: Pierre Turin <pieturin@amazon.com>
2024-06-25 15:18:30 -07:00
Kyle Kim (kimkyle@)
b49eaad367
Introduce a minimal debugger for .tcl integration test suite. (#683)
Introduce a break-point function called `bp`, based on the tcl wiki's
minimal debugger.

```tcl
 proc bp {{s {}}} {
    if ![info exists ::bp_skip] {
        set ::bp_skip [list]
    } elseif {[lsearch -exact $::bp_skip $s]>=0} return
    if [catch {info level -1} who] {set who ::}
    while 1 {
        puts -nonewline "$who/$s> "; flush stdout
        gets stdin line
        if {$line=="c"} {puts "continuing.."; break}
        if {$line=="i"} {set line "info locals"}
        catch {uplevel 1 $line} res
        puts $res
    }
 }
```

```
... your test code before break-point
bp 1
... your test code after break-point
```

The `bp 1` will give back the tcl interpreter to the developer, and
allow you to interactively print local variables (through `puts`), run
functions and so forth.

Source: https://wiki.tcl-lang.org/page/A+minimal+debugger

---------

Signed-off-by: Kyle Kim <kimkyle@amazon.com>
Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
2024-06-25 10:24:53 -07:00
ranshid
3df9d42794
Fix bad memory accounting for sds when no malloc_size available (#694)
Issue Introduced  by #453. 
When we check the SDS _TYPE_5 allocation size we mistakenly used
zmalloc_size which DOES take the PREFIX size into account when no
malloc_size support.
Later when we free we add the PREFIX_SIZE again which leads to negative
memory accounting on some tests.
Example test failure:
https://github.com/valkey-io/valkey/actions/runs/9654170962/job/26627901497

Signed-off-by: ranshid <ranshid@amazon.com>
2024-06-25 08:18:07 -07:00
Lipeng Zhu
4d3d6c06a1
Reduce redundant call of prepareClientToWrite when call addReply* continuously. (#670)
## Description

While exploring hotspots with profiling some benchmark workloads, we
noticed the high cycles ratio of `prepareClientToWrite`, taking about 9%
of the CPU of `smembers`, `lrange` commands. After deep dive the code
logic, we thought we can gain the performance by reducing the redundant
call of `prepareClientToWrite` when call addReply* continuously.

For example: In
https://github.com/valkey-io/valkey/blob/unstable/src/networking.c#L1080-L1082,
`prepareClientToWrite` is called three times in a row.

---------

Signed-off-by: Lipeng Zhu <lipeng.zhu@intel.com>
Co-authored-by: Wangyang Guo <wangyang.guo@intel.com>
2024-06-24 18:33:30 -07:00
Ping Xie
32ca6e5b38
Improve CLUSTER SETSLOT replication handling to support older replica versions. (#686) 2024-06-23 22:08:52 -07:00
Madelyn Olson
ce79539047
Fail tests immediately if the server is no longer running (#678)
Fix a minor inconvenience I have when writing tests. If I have a typo or
forget to generate the tls certificates, the start_server handle will
just loop for 2 minutes before printing the error. This just fails and
prints as soon as it sees the error.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
2024-06-21 15:29:05 +08:00
Binbin
bf1fb1fd36
Fix copy-paste error in scripts eviction test (#671)
The test needs to test "return 2" but mistakenly uses "return 1".
Also remove a extra debug print.

Signed-off-by: Binbin <binloveplay1314@qq.com>
2024-06-20 10:28:47 +08:00
poiuj
0143b7c9dd
Add zfree_with_size to optimize sdsfree since we can get zmalloc_size from the header (#453)
### Description ###
zfree updates memory statistics. It gets the size of the buffer from
jemalloc by calling zmalloc_size. This operation is costly. We can avoid
it if we know the buffer size. For example, we can calculate size of sds
from the data we have in its header.

This commit introduces zfree_with_size function that accepts both
pointer to a buffer, and its size. zfree is refactored to call
zfree_with_size.

sdsfree uses the new interface for all but SDS_TYPE_5.

### Benchmark ###

Dataset is 3 million strings. Each benchmark run uses its own value size
(8192, 512, and 120). The benchmark is 100% write load for 5 minutes.

```
value size       new tps      old tps      %       new us/call    old us/call    %
8k               272088.53    269971.75    0.78    1.83           1.92           -4.69
512              356881.91    352856.72    1.14    1.27           1.35           -5.93
120              377523.81    368774.78    2.37    1.14           1.19           -4.20
```

---------

Signed-off-by: Vadym Khoptynets <vadymkh@amazon.com>
Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
2024-06-19 16:13:55 -07:00
Wen Hui
5d2348cee2
Update json file and sentinelCommand function for Valkey Sentinel (#675)
In this PR, we update master keyword to primary keyword several in
sentinel command json file and sentinelCommand function.
And there is no update for configurable parameters in sentinel.conf file

Signed-off-by: hwware <wen.hui.ware@gmail.com>
2024-06-19 17:16:49 -04:00
Wen Hui
e84eda9092
Remove useless code in sentinel source code (#676)
Just remove them.

Signed-off-by: hwware <wen.hui.ware@gmail.com>
2024-06-19 17:16:35 -04:00
kukey
ae2d4217e1
Add new SCRIPT SHOW subcommand to dump script via sha1 (#617)
In some scenarios, the business may not be able to find the
previously used Lua script and only have a SHA signature.
Or there are multiple identical evalsha's args in monitor/slowlog,
and admin is not able to distinguish the script body.

Add a new script subcommmand to show the contents of script
given the scripts sha1. Returns a NOSCRIPT error if the script
is not present in the cache.

Usage: `SCRIPT SHOW sha1`
Complexity: `O(1)`

Closes #604.
Doc PR: https://github.com/valkey-io/valkey-doc/pull/143

---------

Signed-off-by: wei.kukey <wei.kukey@gmail.com>
Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
Co-authored-by: Binbin <binloveplay1314@qq.com>
Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
2024-06-18 17:48:58 -07:00
ranshid
be2c321682
Support RDB compatability with Redis 7.2.4 RDB format (#665)
This PR makes our current RDB format compatible with the Redis 7.2.4 RDB
format. there are 2 changes introduced in this PR:
1. Move back the RDB version to 11
2. Make slot info section persist as AUX data instead of dedicated
section.

We have introduced slot-info as part of the work to replace cluster
metadata with slot specific dictionaries. This caused us to bump the RDB
version and thus we prevent downgrade (which is conceptualy O.K but
better be prevented). We do not require the slot-info section to exist,
so making it an AUX section will help suppport version downgrade from
Valkey 8.

fixes: [#645](https://github.com/valkey-io/valkey/issues/645)

NOTE: tested manually by:
1. connecting Redis 7.2.4 replica to a Valkey 8(RC) 
2. upgrade/downgrade Redis 7.2.4 cluster and Valkey 8(RC) cluster

---------

Signed-off-by: ranshid <ranshid@amazon.com>
Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
2024-06-18 12:04:06 -07:00
Binbin
a2cc2fe26d
Fix memory leak when loading slot migrations states fails (#658)
When we goto eoferr, we need to release the auxkey and auxval,
this is a cleanup, also explicitly check that decoder return
value is C_ERR.

Introduced in #586.

Signed-off-by: Binbin <binloveplay1314@qq.com>
2024-06-17 21:18:57 -07:00
Madelyn Olson
b33f932c56
Add missing commas from debug command (#662)
The missing commas caused the `DEBUG HELP` to be compressed onto a
single line.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
2024-06-18 12:08:08 +08:00
Ping Xie
4135894a5d
Update remaining master references to primary (#660)
Signed-off-by: Ping Xie <pingxie@google.com>
2024-06-17 20:31:15 -07:00
Binbin
495a121f19
Adjust the log level of some logs in the cluster (#633)
I think the log of pfail status changes will be very useful.
The other parts were scanned and found that it can be modified.

Changes:
1. Changing pfail status releated logs from VERBOSE to NOTICE.
2. Changing configEpoch collision log from VERBOSE(warning) to NOTICE.
3. Changing some logs from DEBUG to NOTICE.

Signed-off-by: Binbin <binloveplay1314@qq.com>
Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
2024-06-18 10:46:56 +08:00
Andy Pan
5a51bf5045
Combine events to eliminate redundant kevent(2) calls (#638)
Combine events to eliminate redundant kevent(2) calls 
to improve performance.

---------

Signed-off-by: Andy Pan <i@andypan.me>
2024-06-16 21:18:20 -07:00
Binbin
db6d3c1138
Only primary with slots has the right to mark a node as failed (#634)
In markNodeAsFailingIfNeeded we will count needed_quorum and failures,
needed_quorum is the half the cluster->size and plus one, and
cluster-size
is the size of primary node which contain slots, but when counting
failures, we dit not check if primary has slots.

Only the primary has slots that has the rights to vote, adding a new
clusterNodeIsVotingPrimary to formalize this concept.

Release notes:

bugfix where nodes not in the quorum group might spuriously mark nodes
as failed

---------

Signed-off-by: Binbin <binloveplay1314@qq.com>
Co-authored-by: Ping Xie <pingxie@outlook.com>
2024-06-16 20:46:08 -07:00
Sankar
a81c32079c
Make cluster meet reliable under link failures (#461)
When there is a link failure while an ongoing MEET request is sent the
sending node stops sending anymore MEET and starts sending PINGs. Since
every node responds to PINGs from unknown nodes with a PONG, the
receiving node never adds the sending node. But the sending node adds
the receiving node when it sees a PONG. This can lead to asymmetry in
cluster membership. This changes makes the sender keep sending MEET
until it sees a PONG, avoiding the asymmetry.

---------

Signed-off-by: Sankar <1890648+srgsanky@users.noreply.github.com>
2024-06-16 20:37:09 -07:00
Samuel Adetunji
93123f97a0
Format yaml files (#615)
Closes #533

---------

Signed-off-by: adetunjii <adetunjithomas1@outlook.com>
2024-06-14 13:40:06 -07:00
Madelyn Olson
6faa48a358
Don't initialize the key buffer in getKeysResult (#631)
getKeysResults is typically initialized with 2kb of zeros (16 * 256),
which isn't strictly necessary since the only thing we have to
initialize is some of the metadata fields. The rest of the data can
remain junk as long as we don't access it. This was a bit of a
regression in 7.0 with the keyspecs, since we doubled the size of the
zeros, but hopefully this recovers a lot of the performance drop.

I saw a modest performance bump for deep pipeline of cluster mode (~8%).

I think we would see some comparable improvements in the other places
where we are using it such as tracking and ACLs.

---------

Signed-off-by: Madelyn Olson <matolson@amazon.com>
2024-06-14 08:42:00 -07:00
Binbin
d5496e42bc
Lua scripts promoted from eval to script load to avoid evict (#637)
In ad28d222edcef9d4496fd7a94656013f07dd08e5, we added a Lua eval
scripts eviction. If the script was previously added via EVAL, we
promote it to SCRIPT LOAD, prevent it from being evicted later.

Signed-off-by: Binbin <binloveplay1314@qq.com>
2024-06-14 08:32:19 -07:00
Wenwen-Chen
4c6bf30f58
Latency report: Rebranding and refine Dave dialog (#644)
This patch try to correct the latency report.

1. Rename Redis to Valkey.
2. Remove redundant Dave dialog, and refine the output message.

---------

Signed-off-by: Wenwen Chen <wenwen.chen@samsung.com>
Signed-off-by: hwware <wen.hui.ware@gmail.com>
2024-06-14 12:56:59 +02:00
Ping Xie
8a776c3509
Fix potential infinite loop in clusterNodeGetPrimary (#651) 2024-06-13 23:43:36 -07:00
Ping Xie
5d9d41868d
Replace DEBUG RESTART with pause_server and resume_server (#652) 2024-06-13 17:52:50 -07:00
Binbin
d309b9b235
Make configs dir/dbfilename/cluster-config-file reject empty string (#636)
Until now, these configuration items allowed typing empty strings,
but empty strings behave strangely.

Empty dir will fail in chdir with No such file or directory:
```
./src/valkey-server --dir ""

*** FATAL CONFIG FILE ERROR (Version 255.255.255) ***
Reading the configuration file, at line 2
>>> 'dir ""'
No such file or directory
```

Empty dbfilename will cause shutdown to fail since it will
always fail in rdb save:
```
./src/valkey-server --dbfilename ""

 * User requested shutdown...
 * Saving the final RDB snapshot before exiting.
 # Error moving temp DB file temp-19530.rdb on the final destination  (in server root dir /xxx/xxx/valkey): No such file or directory
 # Error trying to save the DB, can't exit.
 # Errors trying to shut down the server. Check the logs for more information.
```

Empty cluster-config-file will fail in clusterLockConfig:
```
./src/valkey-server --cluster-enabled yes --cluster-config-file ""

 Can't open  in order to acquire a lock: No such file or directory
```

With this patch, now we will just reject it in config set like:
```
*** FATAL CONFIG FILE ERROR (Version 255.255.255) ***
Reading the configuration file, at line 2
>>> 'xxx ""'
xxx can't be empty
```

Signed-off-by: Binbin <binloveplay1314@qq.com>
2024-06-14 01:47:20 +02:00
Harkrishn Patro
76fc041685
represent cluster node flags with bitwise shift value (#642)
While debugging a cluster bus issue, found the cluster node flags were
represented in numbers. I generally find it easy when these are
represented as bitwise shift operation. It improves readability a bit.

Signed-off-by: Harkrishn Patro <harkrisp@amazon.com>
2024-06-14 00:58:03 +02:00
uriyage
d211078a27
Fix query buffer resized test flakiness (#646)
Added a wait_for_condition to avoid the timing issue.
```
*** [err]: query buffer resized correctly in tests/unit/querybuf.tcl
Expected 11 >= 16384 && 11 <= 32770 (context: type eval line 24 cmd {assert {$orig_test_client_qbuf >= 16384 && $orig_test_client_qbuf <= $MAX_QUERY_BUFFER_SIZE}} proc ::test)
*** [err]: query buffer resized correctly when not idle in tests/unit/querybuf.tcl
Expected 11 > 32768 (context: type eval line 14 cmd {assert {$orig_test_client_qbuf > 32768}} proc ::test)
*** [err]: query buffer resized correctly with fat argv in tests/unit/querybuf.tcl
query buffer should not be resized when client idle time smaller than 2s
```

Signed-off-by: Uri Yagelnik <uriy@amazon.com>
2024-06-13 18:07:07 +08:00
Harkrishn Patro
b546dd26e5
Allow CLUSTER NODES/INFO/MYID/MYSHARDID during loading state (#596)
Allow CLUSTER subcommands NODES, INFO, MYID, MYSHARDID while loading
data.

It's safe to allow them and it's helpful for clients to get cluster
nodes/info information
during a node failover and while loading data to monitor the
state of the cluster.

---------

Signed-off-by: Harkrishn Patro <harkrisp@amazon.com>
2024-06-13 06:09:01 +02:00
Madelyn Olson
627d387ad8
Improve reliability of querybuf test (#639)
We've been seeing some pretty consistent failures from
`test-valgrind-test` and `test-sanitizer-address` because of the
querybuf test periodically failing. I tracked it down to the test
periodically taking too long and the client cron getting triggered. A
simple solution is to just disable the cron during the key race
condition. I was able to run this locally for 100 iterations without
seeing a failure.

Example:
https://github.com/valkey-io/valkey/actions/runs/9474458354/job/26104103514
and
https://github.com/valkey-io/valkey/actions/runs/9474458354/job/26104106830.

Signed-off-by: Madelyn Olson <matolson@amazon.com>
2024-06-12 14:27:42 -07:00
Viktor Söderqvist
4bb7cc471a
Remove unnecessary clang-format off annotations (#628)
We added some clang-format off comments before we had decided on the
format configuration. Now, it turns out that turning formatting off is
often not necessary.

---------

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
2024-06-12 12:52:18 +02:00
Shivshankar
e65b2d235c
Update rewriteConfigSaveOption function code to rewrite multiple save in one line. (#583)
Currently, "config rewrite" writes some default value in the config file
incase of empty config file specified.

But it adds multiple "save" config entries as follows:
```
save 3600 1
save 300 100
save 60 10000
```

After the fix the save will look like:
```
save 3600 1 300 100 60 10000
```

---------

Signed-off-by: Shivshankar-Reddy <shiva.sheri.github@gmail.com>
2024-06-10 16:24:04 -04:00
Madelyn Olson
a3f1535b57
Fix misuse of safe iterators (#612)
Safe iterators must call resetIterators when they are done being used.
Fix one issue where a safe iterator was not correctly calling reset
during cluster slot caching and fixed a second issue where reset
iterator was being called twice. For the double release case,
kvstoreIteratorNextDict is responsible for patching up the iterator, but
we were calling it a second time in kvstoreIteratorNext.

In addition, I added some documentation around initializing iterators,
added an assert to prevent double initialization, and remove a function
from the public interface which isn't needed and might lead to incorrect
usage of the safe iterators.

Bumping srgsanky for finding it here:
c4782066e7 (r142867004).

---------

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
2024-06-10 12:30:57 -07:00
Wen Hui
95a753b18d
Add BSD license explicitly (#620)
Add "BSD 3-Clause License" in License 1 and License 2 part

---------

Signed-off-by: hwware <wen.hui.ware@gmail.com>
Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
2024-06-10 13:14:37 -04:00