Commit Graph

318 Commits

Author SHA1 Message Date
8bbc0768b8 BITOP command 10x speed improvement.
This commit adds a fast-path to the BITOP that can be used for all the
bytes from 0 to the minimal length of the string, and if there are
at max 16 input keys.

Often the intersected bitmaps are roughly the same size, so this
optimization can provide a 10x speed boost to most real world usages
of the command.

Bytes are processed four full words at a time, in loops specialized
for the specific BITOP sub-command, without the need to check for
length issues with the inputs (since we run this algorithm only as far
as there is data from all the keys at the same time).

The remaining part of the string is intersected in the usual way using
the slow but generic algorith.

It is possible to do better than this with inputs that are not roughly
the same size, sorting the input keys by length, by initializing the
result string in a smarter way, and noticing that the final part of the
output string composed of only data from the longest string does not
need any proecessing since AND, OR and XOR against an empty string does
not alter the output (zero in the first case, and the original string in
the other two cases).

More implementations will be implemented later likely, but this should
be enough to release Redis 2.6-RC4 with bitops merged in.

Note: this commit also adds better testing for BITOP NOT command, that
is currently the faster and hard to optimize further since it just
flips the bits of a single input string.
2012-05-24 15:25:13 +02:00
f0d962c0ec BITOP: handle integer encoded objects correctly.
A bug in the implementation caused BITOP to crash the server if at least
one one of the source objects was integer encoded.

The new implementation takes an additional array of Redis objects
pointers and calls getDecodedObject() to get a reference to a string
encoded object, and then uses decrRefCount() to release the object.

Tests modified to cover the regression and improve coverage.
2012-05-24 15:25:10 +02:00
951213e2d2 Bit operations tests improved.
Fuzzing tests of BITCOUNT / BITOP are iterated multiple times.
The new BITCOUNT fuzzing test uses random strings in a wider interval of
lengths including zero-len strings.
2012-05-24 15:24:35 +02:00
1f40cdd0e5 BITOP and BITCOUNT tests.
The Redis implementation is tested against Tcl implementations of the
same operation. Both fuzzing and testing of specific aspects of the
commands behavior are performed.
2012-05-24 15:22:45 +02:00
4dada1b5bc Fixed issue #516 (ZINTERSTORE mixing sets and zsets).
Weeks ago trying to fix an harmless GCC warning I introduced a bug in
the ziplist-encoded implementations of sorted sets.

The bug completely broke zuiNext() iterator, that is used in the
ZINTERSTORE and ZUNIONSTORE implementation, so those two commands are no
longer reliable starting from Redis version 2.4.12 and latest 2.6.0-RC
releases.

This commit fixes the problem and adds a regression test.
2012-05-23 11:12:38 +02:00
1858da2faa Test "Turning off AOF kills the background writing child if any" is now more reliable. 2012-05-02 11:40:55 +02:00
8520066d7b Show problem with 'keys' command with specific command sequence. 2012-04-30 09:51:23 -07:00
d7bad544dc Redis test: scripting EVALSHA replication test more reliable.
A new primitive wait_for_condition was introduced in the scripting
engine that makes waiting for events simpler, so that it is simpler to
write tests that are more resistant to timing issues.
2012-04-27 11:47:12 +02:00
69b30cfcb6 Ziplist encoding now tested with negative integers as well. 2012-04-24 19:34:08 +02:00
0a8a1e78dc New time limit for protocol desync test set to 30 seconds to reduce false positives. 2012-04-24 19:34:03 +02:00
7d6bf7956e Replace unnecessary calls to echo and cat
Tcl's exec can send data to stdout itself, no need to call cat/echo for
that usually.
2012-04-24 19:33:54 +02:00
590d55a206 Limit memory used by big SLOWLOG entries.
Two limits are added:

1) Up to SLOWLOG_ENTRY_MAX_ARGV arguments are logged.
2) Up to SLOWLOG_ENTRY_MAX_STRING bytes per argument are logged.
3) slowlog-max-len is set to 128 by default (was 1024).

The number of remaining arguments / bytes is logged in the entry
so that the user can understand better the nature of the logged command.
2012-04-21 21:00:33 +02:00
abfd08f5ad New tests related to scripts max execution time. 2012-04-19 23:49:46 +02:00
c3312760fe Tests for scripting PRNG. 2012-04-18 23:50:27 +02:00
5c45ae1f7b Test SDIFF with first set empty. 2012-04-18 21:23:35 +02:00
7a2065ef33 Test SINTER against same integer elements, but different set encoding. 2012-04-18 21:23:31 +02:00
eb624e3416 Test SINTER with non existing key. 2012-04-18 21:23:15 +02:00
ff5e31f74b Added an SMOVE test where src and dest key are the same. 2012-04-18 21:23:07 +02:00
24982f2bbc New hash fuzzing test. 2012-04-18 21:23:04 +02:00
bec200ec39 Explicit RPOP/LPOP tests. 2012-04-18 21:22:56 +02:00
a00fcaa671 Test LINSERT syntax error. 2012-04-18 21:22:52 +02:00
8d12645569 Test LINDEX out of range index. 2012-04-18 21:22:48 +02:00
212bb9ca2e More robust maxclients test. 2012-04-18 11:41:03 +02:00
a1090c1193 Added test for SORT corner case: pattern ending with just "->". 2012-04-17 18:26:56 +02:00
96aeca4b9d Less false positives in maxclients test, hopefully. 2012-04-17 10:04:59 +02:00
59333ffd37 New test for scripting engine: DECR_IF_GT. 2012-04-13 16:23:46 +02:00
d63a1716eb Tests modified to match the new global protection implementation. 2012-04-13 16:23:34 +02:00
e387dc52a0 Tests for lua globals protection. 2012-04-13 16:22:43 +02:00
fdf8bd4025 Test for maxclients. 2012-04-10 16:28:21 +02:00
08211b25d3 Added new test to check that "CONFIG appendonly no" actually kills the background AOF operation in progress if any. 2012-04-08 10:43:33 +02:00
2cf3f071a5 Tests for MONITOR. 2012-04-07 11:27:04 +02:00
b162e6f133 New client info field added to CLIENT LIST output: multi, containing the length of the current pipeline. Test modified accordingly. 2012-04-07 11:27:00 +02:00
eb6bc2e047 Two new tests for BGREWRTIEAOF.
Check for scheduled rewrite if a BGSAVAE is in progress.
Check for error if a rewrite is already in progress.
2012-04-07 11:26:47 +02:00
e3fd3ccd72 More MIGRATE tests. 2012-04-03 15:14:03 +02:00
b739506936 MIGRATE test modified because the implementation changed. 2012-04-02 16:41:11 +02:00
8cf8974a03 DUMP, RESTORE, MIGRATE tests. 2012-04-02 14:22:07 +02:00
ee704a0ff1 Test for redis.sha1hex(). 2012-03-29 09:33:57 +02:00
3e8fcb6d03 CLIENT LIST test modified to reflect the new output. 2012-03-13 18:08:59 +01:00
8562798308 Merge conflicts resolved. 2012-03-09 22:07:45 +01:00
fcdeb98568 even less false positive on obuf-limits test. 2012-02-22 11:25:30 +01:00
d347348109 Issue #330 regression test. 2012-02-16 16:13:40 +01:00
c17947287a Added tests checking ability of the scripting engine to reorder the output of commands with a random output regarding signle elements position in the multi bulk reply. 2012-02-01 17:49:03 +01:00
44d77bb217 A few SORT tests made more resistant to false negatives resulitng from poor randomization of Redis hash function with one byte inputs. 2012-02-01 17:37:48 +01:00
01f75bf352 New SORT tests checking the new more deterministic behavior of SORT sorting algorithm. 2012-02-01 17:17:52 +01:00
de79a2ee12 Make SORT BY <constant> STORE ... to always produce the same output by force sorting, so that we have deterministic replication of this command. 2012-02-01 17:05:45 +01:00
2c861050c1 SORT is now more deterministic: does not accept to compare by score items that have scores not representing a valid double. Also items with the same score are compared lexycographically. At the same time the scripting side introduced the ability to sort the output of SORT when sort uses the BY <constant> optimization, resulting in no specific ordering. Since in this case the user may use GET, and the result of GET can be null, converted into false as Lua data type, this commit also introduces the ability to sort Lua tables containining false, only if the first (faster) attempt at using just table.sort with a single argument fails. 2012-02-01 15:22:28 +01:00
fc4ed4299b minimal change to obuf-limits.tcl test to make sure there are no false positives with 32bit instances as well. 2012-01-30 21:08:10 +01:00
a0bf8d0ad8 SORT with STORE removes key if result is empty. This fixes issue #227. 2012-01-30 07:36:49 +01:00
6c29410117 false positive in expire tests mitigated with a sleep, but other solutions exist if needed later. 2012-01-26 16:45:08 +01:00
7f7a13b27b Less false positives for obuf-limits.tcl tests 2012-01-26 16:08:24 +01:00