Unverified Commit 29622276 authored by Oran Agra's avatar Oran Agra Committed by GitHub
Browse files

Release Redis 7.2.0 GA

parents 1a589818 3d1d3e23
...@@ -81,6 +81,23 @@ start_multiple_servers 3 [list overrides $base_conf] { ...@@ -81,6 +81,23 @@ start_multiple_servers 3 [list overrides $base_conf] {
set node1_rd [redis_deferring_client 0] set node1_rd [redis_deferring_client 0]
test "use previous hostip in \"cluster-preferred-endpoint-type unknown-endpoint\" mode" {
# backup and set cluster-preferred-endpoint-type unknown-endpoint
set endpoint_type_before_set [lindex [split [$node1 CONFIG GET cluster-preferred-endpoint-type] " "] 1]
$node1 CONFIG SET cluster-preferred-endpoint-type unknown-endpoint
# when redis-cli not in cluster mode, return MOVE with empty host
set slot_for_foo [$node1 CLUSTER KEYSLOT foo]
assert_error "*MOVED $slot_for_foo :*" {$node1 set foo bar}
# when in cluster mode, redirect using previous hostip
assert_equal "[exec src/redis-cli -h 127.0.0.1 -p [srv 0 port] -c set foo bar]" {OK}
assert_match "[exec src/redis-cli -h 127.0.0.1 -p [srv 0 port] -c get foo]" {bar}
assert_equal [$node1 CONFIG SET cluster-preferred-endpoint-type "$endpoint_type_before_set"] {OK}
}
test "Sanity test push cmd after resharding" { test "Sanity test push cmd after resharding" {
assert_error {*MOVED*} {$node3 lpush key9184688 v1} assert_error {*MOVED*} {$node3 lpush key9184688 v1}
......
...@@ -307,6 +307,13 @@ start_server {tags {"scripting"}} { ...@@ -307,6 +307,13 @@ start_server {tags {"scripting"}} {
set e set e
} {*against a key*} } {*against a key*}
test {EVAL - JSON string encoding a string larger than 2GB} {
run_script {
local s = string.rep("a", 1024 * 1024 * 1024)
return #cjson.encode(s..s..s)
} 0
} {3221225474} {large-memory} ;# length includes two double quotes at both ends
test {EVAL - JSON numeric decoding} { test {EVAL - JSON numeric decoding} {
# We must return the table as a string because otherwise # We must return the table as a string because otherwise
# Redis converts floats to ints and we get 0 and 1023 instead # Redis converts floats to ints and we get 0 and 1023 instead
...@@ -1112,6 +1119,53 @@ start_server {tags {"scripting"}} { ...@@ -1112,6 +1119,53 @@ start_server {tags {"scripting"}} {
r ping r ping
} {PONG} } {PONG}
test {Timedout scripts and unblocked command} {
# make sure a command that's allowed during BUSY doesn't trigger an unblocked command
# enable AOF to also expose an assertion if the bug would happen
r flushall
r config set appendonly yes
# create clients, and set one to block waiting for key 'x'
set rd [redis_deferring_client]
set rd2 [redis_deferring_client]
set r3 [redis_client]
$rd2 blpop x 0
wait_for_blocked_clients_count 1
# hack: allow the script to use client list command so that we can control when it aborts
r DEBUG set-disable-deny-scripts 1
r config set lua-time-limit 10
run_script_on_connection $rd {
local clients
redis.call('lpush',KEYS[1],'y');
while true do
clients = redis.call('client','list')
if string.find(clients, 'abortscript') ~= nil then break end
end
redis.call('lpush',KEYS[1],'z');
return clients
} 1 x
# wait for the script to be busy
after 200
catch {r ping} e
assert_match {BUSY*} $e
# run cause the script to abort, and run a command that could have processed
# unblocked clients (due to a bug)
$r3 hello 2 setname abortscript
# make sure the script completed before the pop was processed
assert_equal [$rd2 read] {x z}
assert_match {*abortscript*} [$rd read]
$rd close
$rd2 close
$r3 close
r DEBUG set-disable-deny-scripts 0
} {OK} {external:skip needs:debug}
test {Timedout scripts that modified data can't be killed by SCRIPT KILL} { test {Timedout scripts that modified data can't be killed by SCRIPT KILL} {
set rd [redis_deferring_client] set rd [redis_deferring_client]
r config set lua-time-limit 10 r config set lua-time-limit 10
......
...@@ -182,4 +182,33 @@ start_server {tags {"incr"}} { ...@@ -182,4 +182,33 @@ start_server {tags {"incr"}} {
r incrbyfloat foo [expr double(-1)/41] r incrbyfloat foo [expr double(-1)/41]
r get foo r get foo
} {0} } {0}
foreach cmd {"incr" "decr" "incrby" "decrby"} {
test "$cmd operation should update encoding from raw to int" {
set res {}
set expected {1 12}
if {[string match {*incr*} $cmd]} {
lappend expected 13
} else {
lappend expected 11
}
r set foo 1
assert_encoding "int" foo
lappend res [r get foo]
r append foo 2
assert_encoding "raw" foo
lappend res [r get foo]
if {[string match {*by*} $cmd]} {
r $cmd foo 1
} else {
r $cmd foo
}
assert_encoding "int" foo
lappend res [r get foo]
assert_equal $res $expected
}
}
} }
...@@ -656,4 +656,19 @@ if {[string match {*jemalloc*} [s mem_allocator]]} { ...@@ -656,4 +656,19 @@ if {[string match {*jemalloc*} [s mem_allocator]]} {
} }
} }
} }
test {APPEND modifies the encoding from int to raw} {
r del foo
r set foo 1
assert_encoding "int" foo
r append foo 2
set res {}
lappend res [r get foo]
assert_encoding "raw" foo
r set bar 12
assert_encoding "int" bar
lappend res [r get bar]
} {12 12}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment