Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed516c3c5a | ||
|
|
b2fc72afba | ||
|
|
52b28d12eb | ||
|
|
bdacddf391 | ||
|
|
b50f0cc21f | ||
|
|
48e5220d00 |
No files matched your search
@@ -21,10 +21,10 @@ jobs:
|
||||
- name: test-tls
|
||||
run: |
|
||||
sudo apt-get -y install tcl tcl-tls
|
||||
./runtest --clients 2 --verbose --tls
|
||||
./runtest --clients 1 --verbose --tls --config server-threads 3
|
||||
- name: cluster-test
|
||||
run: |
|
||||
./runtest-cluster --tls
|
||||
./runtest-cluster --tls --config server-threads 3
|
||||
- name: sentinel test
|
||||
run: |
|
||||
./runtest-sentinel
|
||||
|
||||
@@ -104,6 +104,12 @@ Avoid forwarding RREPLAY messages to other masters? WARNING: This setting is dan
|
||||
If you would like KeyDB to dump and load directly to AWS S3 this option specifies the bucket. Using this option with the traditional RDB options will result in KeyDB backing up twice to both locations. If both are specified KeyDB will first attempt to load from the local dump file and if that fails load from S3. This requires the AWS CLI tools to be installed and configured which are used under the hood to transfer the data.
|
||||
|
||||
|
||||
```
|
||||
storage-provider flash /path/to/flash
|
||||
```
|
||||
If you would like to use KeyDB FLASH storage, specify the storage medium followed by the directory path on your local SSD volume. Note that this feature is still considered experimental and should be used with discretion. See [FLASH Documentation](https://docs.keydb.dev/docs/flash) for more details on configuration and setting up your FLASH volume.
|
||||
|
||||
|
||||
Building KeyDB
|
||||
--------------
|
||||
|
||||
@@ -145,6 +151,12 @@ installed):
|
||||
% ./utils/gen-test-certs.sh
|
||||
% ./runtest --tls
|
||||
|
||||
To build with KeyDB FLASH support, use:
|
||||
|
||||
% make ENABLE_FLASH=yes
|
||||
|
||||
***Note that the KeyDB FLASH feature is considered experimental (beta) and should used with discretion
|
||||
|
||||
|
||||
Fixing build problems with dependencies or cached build options
|
||||
---------
|
||||
|
||||
+15
-1
@@ -2073,4 +2073,18 @@ replica-weighting-factor 2
|
||||
#
|
||||
# By default this is enabled
|
||||
#
|
||||
active-client-balancing yes
|
||||
active-client-balancing yes
|
||||
|
||||
# Enable FLASH support (Experimental Feature)
|
||||
# storage-provider flash /path/to/flash/db
|
||||
|
||||
# Blob support is a way to store very large objects (>200MB) on disk
|
||||
# The files are automatically cleaned up when KeyDB exits and are only
|
||||
# for temporary use. This helps reduce memory pressure for very large
|
||||
# data items at the cost of some performance.
|
||||
#
|
||||
# By default this config is disable. When enabled the disk associated
|
||||
# with KeyDB's working directory will be used. If there is insufficient
|
||||
# disk space or any other I/O error KeyDB will instead use memory.
|
||||
#
|
||||
# blob-support false
|
||||
@@ -2063,3 +2063,17 @@ server-threads 2
|
||||
#
|
||||
# By default KeyDB sets this to 2.
|
||||
replica-weighting-factor 2
|
||||
|
||||
# Enable FLASH support (Experimental Feature)
|
||||
# storage-provider flash /path/to/flash/db
|
||||
|
||||
# Blob support is a way to store very large objects (>200MB) on disk
|
||||
# The files are automatically cleaned up when KeyDB exits and are only
|
||||
# for temporary use. This helps reduce memory pressure for very large
|
||||
# data items at the cost of some performance.
|
||||
#
|
||||
# By default this config is disable. When enabled the disk associated
|
||||
# with KeyDB's working directory will be used. If there is insufficient
|
||||
# disk space or any other I/O error KeyDB will instead use memory.
|
||||
#
|
||||
# blob-support false
|
||||
@@ -19,6 +19,11 @@ elif [ "$distributor" == "Ubuntu" ]; then
|
||||
fi
|
||||
codename=$(lsb_release --codename --short)
|
||||
date=$(date +%a," "%d" "%b" "%Y" "%T)
|
||||
|
||||
# overwrite debian bookworm version until updated
|
||||
if [ $codename == "bookworm" ]; then
|
||||
distname=+deb12u1
|
||||
fi
|
||||
pkg_name=keydb-$majorv:$version$distname
|
||||
|
||||
# create build tree
|
||||
|
||||
@@ -4,6 +4,7 @@ include /usr/share/dpkg/buildflags.mk
|
||||
|
||||
export BUILD_TLS=yes
|
||||
export USE_SYSTEMD=yes
|
||||
export ENABLE_FLASH=yes
|
||||
export CFLAGS CPPFLAGS LDFLAGS
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
export DEB_LDFLAGS_MAINT_APPEND = -ldl -latomic $(LUA_LDFLAGS)
|
||||
|
||||
@@ -10,6 +10,7 @@ include /usr/share/dpkg/buildflags.mk
|
||||
|
||||
export BUILD_TLS=yes
|
||||
export USE_SYSTEMD=yes
|
||||
export ENABLE_FLASH=yes
|
||||
export CFLAGS CPPFLAGS LDFLAGS
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
export DEB_LDFLAGS_MAINT_APPEND = -ldl -latomic $(LUA_LDFLAGS)
|
||||
|
||||
@@ -2063,3 +2063,17 @@ server-threads 2
|
||||
#
|
||||
# By default KeyDB sets this to 2.
|
||||
replica-weighting-factor 2
|
||||
|
||||
# Enable FLASH support (Experimental Feature)
|
||||
# storage-provider flash /path/to/flash/db
|
||||
|
||||
# Blob support is a way to store very large objects (>200MB) on disk
|
||||
# The files are automatically cleaned up when KeyDB exits and are only
|
||||
# for temporary use. This helps reduce memory pressure for very large
|
||||
# data items at the cost of some performance.
|
||||
#
|
||||
# By default this config is disable. When enabled the disk associated
|
||||
# with KeyDB's working directory will be used. If there is insufficient
|
||||
# disk space or any other I/O error KeyDB will instead use memory.
|
||||
#
|
||||
# blob-support false
|
||||
+6
-4
@@ -194,8 +194,8 @@ void sortCommand(client *c) {
|
||||
list *operations;
|
||||
unsigned int outputlen = 0;
|
||||
int desc = 0, alpha = 0;
|
||||
long limit_start = 0, limit_count = -1, start, end;
|
||||
int j, dontsort = 0, vectorlen;
|
||||
long limit_start = 0, limit_count = -1, start, end, vectorlen;
|
||||
int j, dontsort = 0;
|
||||
int getop = 0; /* GET operation counter */
|
||||
int int_conversion_error = 0;
|
||||
int syntax_error = 0;
|
||||
@@ -321,8 +321,10 @@ void sortCommand(client *c) {
|
||||
default: vectorlen = 0; serverPanic("Bad SORT type"); /* Avoid GCC warning */
|
||||
}
|
||||
|
||||
/* Perform LIMIT start,count sanity checking. */
|
||||
start = (limit_start < 0) ? 0 : limit_start;
|
||||
/* Perform LIMIT start,count sanity checking.
|
||||
* And avoid integer overflow by limiting inputs to object sizes. */
|
||||
start = std::min(std::max(limit_start, (long)0), vectorlen);
|
||||
limit_count = std::min(std::max(limit_count, (long)-1), vectorlen);
|
||||
end = (limit_count < 0) ? vectorlen-1 : start+limit_count-1;
|
||||
if (start >= vectorlen) {
|
||||
start = vectorlen-1;
|
||||
|
||||
+6
-1
@@ -1225,8 +1225,13 @@ void hrandfieldCommand(client *c) {
|
||||
if (c->argc > 4 || (c->argc == 4 && strcasecmp(szFromObj(c->argv[3]),"withvalues"))) {
|
||||
addReplyErrorObject(c,shared.syntaxerr);
|
||||
return;
|
||||
} else if (c->argc == 4)
|
||||
} else if (c->argc == 4) {
|
||||
withvalues = 1;
|
||||
if (l < LONG_MIN/2 || l > LONG_MAX/2) {
|
||||
addReplyError(c,"value is out of range");
|
||||
return;
|
||||
}
|
||||
}
|
||||
hrandfieldWithCountCommand(c, l, withvalues);
|
||||
return;
|
||||
}
|
||||
|
||||
+11
-6
@@ -38,8 +38,14 @@ int getGenericCommand(client *c);
|
||||
* String Commands
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static int checkStringLength(client *c, long long size) {
|
||||
if (!(c->flags & CLIENT_MASTER) && size > g_pserver->proto_max_bulk_len) {
|
||||
static int checkStringLength(client *c, long long size, long long append) {
|
||||
if (c->flags & CLIENT_MASTER)
|
||||
return C_OK;
|
||||
/* 'uint64_t' cast is there just to prevent undefined behavior on overflow */
|
||||
long long total = (uint64_t)size + append;
|
||||
/* Test configured max-bulk-len represending a limit of the biggest string object,
|
||||
* and also test for overflow. */
|
||||
if (total > g_pserver->proto_max_bulk_len || total < size || total < append) {
|
||||
addReplyError(c,"string exceeds maximum allowed size (proto-max-bulk-len)");
|
||||
return C_ERR;
|
||||
}
|
||||
@@ -445,7 +451,7 @@ void setrangeCommand(client *c) {
|
||||
}
|
||||
|
||||
/* Return when the resulting string exceeds allowed size */
|
||||
if (checkStringLength(c,offset+sdslen(value)) != C_OK)
|
||||
if (checkStringLength(c,offset,sdslen(value)) != C_OK)
|
||||
return;
|
||||
|
||||
o = createObject(OBJ_STRING,sdsnewlen(NULL, offset+sdslen(value)));
|
||||
@@ -465,7 +471,7 @@ void setrangeCommand(client *c) {
|
||||
}
|
||||
|
||||
/* Return when the resulting string exceeds allowed size */
|
||||
if (checkStringLength(c,offset+sdslen(value)) != C_OK)
|
||||
if (checkStringLength(c,offset,sdslen(value)) != C_OK)
|
||||
return;
|
||||
|
||||
/* Create a copy when the object is shared or encoded. */
|
||||
@@ -685,8 +691,7 @@ void appendCommand(client *c) {
|
||||
|
||||
/* "append" is an argument, so always an sds */
|
||||
append = c->argv[2];
|
||||
totlen = stringObjectLen(o)+sdslen((sds)ptrFromObj(append));
|
||||
if (checkStringLength(c,totlen) != C_OK)
|
||||
if (checkStringLength(c,stringObjectLen(o),sdslen((sds)ptrFromObj(append))) != C_OK)
|
||||
return;
|
||||
|
||||
/* Append the value */
|
||||
|
||||
+6
-1
@@ -4214,8 +4214,13 @@ void zrandmemberCommand(client *c) {
|
||||
if (c->argc > 4 || (c->argc == 4 && strcasecmp(szFromObj(c->argv[3]),"withscores"))) {
|
||||
addReplyErrorObject(c,shared.syntaxerr);
|
||||
return;
|
||||
} else if (c->argc == 4)
|
||||
} else if (c->argc == 4) {
|
||||
withscores = 1;
|
||||
if (l < LONG_MIN/2 || l > LONG_MAX/2) {
|
||||
addReplyError(c,"value is out of range");
|
||||
return;
|
||||
}
|
||||
}
|
||||
zrandmemberWithCountCommand(c, l, withscores);
|
||||
return;
|
||||
}
|
||||
|
||||
+36
-5
@@ -66,6 +66,33 @@ proc redis {{server 127.0.0.1} {port 6379} {defer 0} {tls 0} {tlsoptions {}} {re
|
||||
interp alias {} ::redis::redisHandle$id {} ::redis::__dispatch__ $id
|
||||
}
|
||||
|
||||
# On recent versions of tcl-tls/OpenSSL, reading from a dropped connection
|
||||
# results with an error we need to catch and mimic the old behavior.
|
||||
proc ::redis::redis_safe_read {fd len} {
|
||||
if {$len == -1} {
|
||||
set err [catch {set val [read $fd]} msg]
|
||||
} else {
|
||||
set err [catch {set val [read $fd $len]} msg]
|
||||
}
|
||||
if {!$err} {
|
||||
return $val
|
||||
}
|
||||
if {[string match "*connection abort*" $msg]} {
|
||||
return {}
|
||||
}
|
||||
error $msg
|
||||
}
|
||||
|
||||
proc ::redis::redis_safe_gets {fd} {
|
||||
if {[catch {set val [gets $fd]} msg]} {
|
||||
if {[string match "*connection abort*" $msg]} {
|
||||
return {}
|
||||
}
|
||||
error $msg
|
||||
}
|
||||
return $val
|
||||
}
|
||||
|
||||
# This is a wrapper to the actual dispatching procedure that handles
|
||||
# reconnection if needed.
|
||||
proc ::redis::__dispatch__ {id method args} {
|
||||
@@ -146,6 +173,10 @@ proc ::redis::__method__read {id fd} {
|
||||
::redis::redis_read_reply $id $fd
|
||||
}
|
||||
|
||||
proc ::redis::__method__rawread {id fd {len -1}} {
|
||||
return [redis_safe_read $fd $len]
|
||||
}
|
||||
|
||||
proc ::redis::__method__write {id fd buf} {
|
||||
::redis::redis_write $fd $buf
|
||||
}
|
||||
@@ -192,8 +223,8 @@ proc ::redis::redis_writenl {fd buf} {
|
||||
}
|
||||
|
||||
proc ::redis::redis_readnl {fd len} {
|
||||
set buf [read $fd $len]
|
||||
read $fd 2 ; # discard CR LF
|
||||
set buf [redis_safe_read $fd $len]
|
||||
redis_safe_read $fd 2 ; # discard CR LF
|
||||
return $buf
|
||||
}
|
||||
|
||||
@@ -239,11 +270,11 @@ proc ::redis::redis_read_map {id fd} {
|
||||
}
|
||||
|
||||
proc ::redis::redis_read_line fd {
|
||||
string trim [gets $fd]
|
||||
string trim [redis_safe_gets $fd]
|
||||
}
|
||||
|
||||
proc ::redis::redis_read_null fd {
|
||||
gets $fd
|
||||
redis_safe_gets $fd
|
||||
return {}
|
||||
}
|
||||
|
||||
@@ -260,7 +291,7 @@ proc ::redis::redis_read_reply {id fd} {
|
||||
}
|
||||
|
||||
while {1} {
|
||||
set type [read $fd 1]
|
||||
set type [redis_safe_read $fd 1]
|
||||
switch -exact -- $type {
|
||||
_ {return [redis_read_null $fd]}
|
||||
: -
|
||||
|
||||
@@ -40,6 +40,12 @@ proc assert_failed {expected_err detail} {
|
||||
error "assertion:$expected_err $detail"
|
||||
}
|
||||
|
||||
proc assert_not_equal {value expected {detail ""}} {
|
||||
if {!($expected ne $value)} {
|
||||
assert_failed "Expected '$value' not equal to '$expected'" $detail
|
||||
}
|
||||
}
|
||||
|
||||
proc assert_equal {value expected {detail ""}} {
|
||||
if {$expected ne $value} {
|
||||
assert_failed "Expected '$value' to be equal to '$expected'" $detail
|
||||
|
||||
@@ -111,7 +111,7 @@ start_server {tags {"obuf-limits"} overrides { server-threads 1 }} {
|
||||
|
||||
# Read nothing
|
||||
set fd [$rd channel]
|
||||
assert_equal {} [read $fd]
|
||||
assert_equal {} [$rd rawread]
|
||||
}
|
||||
|
||||
# Note: This test assumes that what's written with one write, will be read by redis in one read.
|
||||
@@ -151,8 +151,7 @@ start_server {tags {"obuf-limits"} overrides { server-threads 1 }} {
|
||||
assert_equal "PONG" [r ping]
|
||||
set clients [r client list]
|
||||
assert_no_match "*name=multicommands*" $clients
|
||||
set fd [$rd2 channel]
|
||||
assert_equal {} [read $fd]
|
||||
assert_equal {} [$rd2 rawread]
|
||||
}
|
||||
|
||||
test {Execute transactions completely even if client output buffer limit is enforced} {
|
||||
|
||||
@@ -315,4 +315,15 @@ start_server {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test {SETRANGE with huge offset} {
|
||||
r lpush L 2 1 0
|
||||
# expecting a different outcome on 32 and 64 bit systems
|
||||
foreach value {9223372036854775807 2147483647} {
|
||||
catch {[r sort_ro L by a limit 2 $value]} res
|
||||
if {![string match "2" $res] && ![string match "*out of range*" $res]} {
|
||||
assert_not_equal $res "expecting an error or 2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,11 @@ start_server {tags {"hash"}} {
|
||||
r hrandfield myhash 0
|
||||
} {}
|
||||
|
||||
test "HRANDFIELD count overflow" {
|
||||
r hmset myhash a 1
|
||||
assert_error {*value is out of range*} {r hrandfield myhash -9223372036854770000 withvalues}
|
||||
} {}
|
||||
|
||||
test "HRANDFIELD with <count> against non existing key" {
|
||||
r hrandfield nonexisting_key 100
|
||||
} {}
|
||||
|
||||
@@ -574,4 +574,14 @@ start_server {tags {"string"}} {
|
||||
test {LCS indexes with match len and minimum match len} {
|
||||
dict get [r STRALGO LCS IDX KEYS virus1 virus2 WITHMATCHLEN MINMATCHLEN 5] matches
|
||||
} {{{1 222} {13 234} 222}}
|
||||
|
||||
test {SETRANGE with huge offset} {
|
||||
foreach value {9223372036854775807 2147483647} {
|
||||
catch {[r setrange K $value A]} res
|
||||
# expecting a different error on 32 and 64 bit systems
|
||||
if {![string match "*string exceeds maximum allowed size*" $res] && ![string match "*out of range*" $res]} {
|
||||
assert_equal $res "expecting an error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1714,6 +1714,11 @@ start_server {tags {"zset"}} {
|
||||
r zrandmember nonexisting_key 100
|
||||
} {}
|
||||
|
||||
test "ZRANDMEMBER count overflow" {
|
||||
r zadd myzset 0 a
|
||||
assert_error {*value is out of range*} {r zrandmember myzset -9223372036854770000 withscores}
|
||||
} {}
|
||||
|
||||
# Make sure we can distinguish between an empty array and a null response
|
||||
r readraw 1
|
||||
|
||||
|
||||
Reference in new issue
Block a user