summaryrefslogtreecommitdiff
path: root/tests/integration/corrupt-dump.tcl
diff options
context:
space:
mode:
authorViktor Söderqvist <viktor.soderqvist@est.tech>2021-09-06 08:12:38 +0200
committerGitHub <noreply@github.com>2021-09-06 09:12:38 +0300
commit547c3405d4d5cdb38ea598c07286c26688824f0a (patch)
tree90975d73e0539f44d5ac556900f462c2f8a4dbfd /tests/integration/corrupt-dump.tcl
parent763fd0941683eb64190daca6abab1f29a72a772e (diff)
downloadredis-547c3405d4d5cdb38ea598c07286c26688824f0a.tar.gz
Optimize quicklistIndex to seek from the nearest end (#9454)
Until now, giving a negative index seeks from the end of a list and a positive seeks from the beginning. This change makes it seek from the nearest end, regardless of the sign of the given index. quicklistIndex is used by all list commands which operate by index. LINDEX key 999999 in a list if 1M elements is greately optimized by this change. Latency is cut by 75%. LINDEX key -1000000 in a list of 1M elements, likewise. LRANGE key -1 -1 is affected by this, since LRANGE converts the indices to positive numbers before seeking. The tests for corrupt dumps are updated to make sure the corrup data is seeked in the same direction as before.
Diffstat (limited to 'tests/integration/corrupt-dump.tcl')
-rw-r--r--tests/integration/corrupt-dump.tcl4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/integration/corrupt-dump.tcl b/tests/integration/corrupt-dump.tcl
index fab15fc7b..ff956796c 100644
--- a/tests/integration/corrupt-dump.tcl
+++ b/tests/integration/corrupt-dump.tcl
@@ -82,7 +82,7 @@ test {corrupt payload: valid zipped hash header, dup records} {
test {corrupt payload: quicklist big ziplist prev len} {
start_server [list overrides [list loglevel verbose use-exit-on-panic yes crash-memcheck-enabled no] ] {
r config set sanitize-dump-payload no
- r restore key 0 "\x0E\x01\x13\x13\x00\x00\x00\x0E\x00\x00\x00\x02\x00\x00\x02\x61\x00\x0E\x02\x62\x00\xFF\x09\x00\x49\x97\x30\xB2\x0D\xA1\xED\xAA"
+ r restore key 0 "\x0e\x01\x1b\x1b\x00\x00\x00\x16\x00\x00\x00\x04\x00\x00\x02\x61\x00\x04\x02\x62\x00\x04\x02\x63\x00\x19\x02\x64\x00\xff\x09\x00\xec\x42\xe9\xf5\xd6\x19\x9e\xbd"
catch {r lindex key -2}
assert_equal [count_log_message 0 "crashed by signal"] 0
assert_equal [count_log_message 0 "ASSERTION FAILED"] 1
@@ -107,7 +107,7 @@ test {corrupt payload: quicklist ziplist wrong count} {
# we'll be able to push, but iterating on the list will assert
r lpush key header
r rpush key footer
- catch { [r lrange key -1 -1] }
+ catch { [r lrange key 0 -1] }
assert_equal [count_log_message 0 "crashed by signal"] 0
assert_equal [count_log_message 0 "ASSERTION FAILED"] 1
}