349 Commits

Author SHA1 Message Date
antirez
3e0309f0a9 Added a new hash fuzzy tester.
The new fuzzy tester also removes elements from the hash instead of just
adding random fields. This should increase the probability to find bugs
in the implementations of the hash type internal representations.
2012-06-12 15:21:54 +02:00
antirez
c1be7c2610 New test: hash ziplist -> hashtable encoding conversion.
A new stress test was added to stress test the code converting a ziplist
into an hash table.

In this commit also randomValue helper function was modified to also
return negative values.
2012-06-11 15:19:46 +02:00
antirez
7f255aac59 EVAL replication test: less false positives.
wait_for_condition is now used instead of the usual "after 1000" (that
is the way to sleep in Tcl). This should avoid to find the replica in
a state where it is loading the RDB in memory, returning -LOADING error.

This test used to fail when running the test over valgrind, due to the
added latencies.
2012-06-02 23:29:57 +02:00
Alex Mitrofanov
33700ab2a7 Fixed RESTORE hash failure (Issue #532)
(additional commit notes by antirez@gmail.com):

The rdbIsObjectType() macro was not updated when the new RDB object type
of ziplist encoded hashes was added.

As a result RESTORE, that uses rdbLoadObjectType(), failed when a
ziplist encoded hash was loaded.
This does not affected normal RDB loading because in that case we use
the lower-level function rdbLoadType().

The commit also adds a regression test.
2012-06-02 10:24:27 +02:00
antirez
d13ed62ce7 BITOP bug when called against non existing keys fixed.
In the issue #529 an user reported a bug that can be triggered with the
following code:

flushdb
set a
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
bitop or x a b

The bug was introduced with the speed optimization in commit 8bbc076
that specializes every BITOP operation loop up to the minimum length of
the input strings.

However the computation of the minimum length contained an error when a
non existing key was present in the input, after a key that was non zero
length.

This commit fixes the bug and adds a regression test for it.
2012-05-31 21:52:47 +02:00
antirez
f2ca912f74 Tests modified to account for INFO fields renaming.
Commit 2f22d57a5219aaabe088cc4e64624d3d3fccf760 modified the name of a
few INFO fields. This commit changes the Redis test to account for this
changes.
2012-05-25 15:20:59 +02:00
antirez
9aff93dc1b 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:20:20 +02:00
antirez
04f7e07aa7 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:20:16 +02:00
antirez
7021d1b75c 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:20:02 +02:00
antirez
d7c60f0ca9 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:19:48 +02:00
antirez
e093a09c2f 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:43 +02:00
antirez
ccc9234552 Redis test: include bug report on crash.
Due to a change in the format of the bug report in case of crash of
failed assertion the test suite was no longer able to properly log it.
Instead just a protocol error was logged by the Redis TCL client that
provided no clue about the actual problem.

This commit resolves the issue by logging everything from the first line
of the log including the string REDIS BUG REPORT, till the end of the
file.
2012-05-22 13:13:24 +02:00
antirez
9d2a56f2d9 If the computer running the Redis test is slow, we revert to --clients 1 to avoid false positives. 2012-05-11 17:26:16 +02:00
antirez
00505d6fed Test "Turning off AOF kills the background writing child if any" is now more reliable. 2012-05-02 11:40:46 +02:00
Harmen
6bcc2d9e34 Show problem with 'keys' command with specific command sequence. 2012-05-01 10:51:59 +02:00
antirez
30d3fc3024 Properly wait the slave to sync with master in BRPOPLPUSH test. 2012-04-30 10:55:03 +02:00
antirez
9f97d57184 A more lightweight implementation of issue 141 regression test. 2012-04-29 17:16:44 +02:00
antirez
53e898d3f1 Redis test: More reliable BRPOPLPUSH replication test.
Now it uses the new wait_for_condition testing primitive.
Also wait_for_condition implementation was fixed in this commit to properly
escape the expr command and its argument.
2012-04-26 11:25:13 +02:00
antirez
d3d7542a86 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-26 11:16:52 +02:00
antirez
e12b40d3be Ziplist encoding now tested with negative integers as well. 2012-04-23 17:27:46 +02:00
Salvatore Sanfilippo
4770086174 Merge pull request #461 from schlenk/unstable
Replace some unnecessary calls to echo and cat in tests
2012-04-23 02:07:21 -07:00
antirez
95e457fdfd New time limit for protocol desync test set to 30 seconds to reduce false positives. 2012-04-23 10:57:43 +02:00
antirez
51b202cab7 Merge remote-tracking branch 'origin/unstable' into unstable 2012-04-21 20:35:51 +02:00
antirez
4d9822ce1a 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 20:34:45 +02:00
Salvatore Sanfilippo
4ee9dd57d6 Merge pull request #414 from chobits/unstable
fix typos in tests/assets/default.conf
2012-04-21 03:27:15 -07:00
antirez
b2023cd0fa New tests related to scripts max execution time. 2012-04-19 23:49:33 +02:00
antirez
e719081188 Tests for scripting PRNG. 2012-04-18 23:50:16 +02:00
antirez
9d80adcf99 Test SDIFF with first set empty. 2012-04-18 18:13:31 +02:00
antirez
bfdb8667fd Test SINTER against same integer elements, but different set encoding. 2012-04-18 18:10:48 +02:00
antirez
f56007b3d5 Test SINTER with non existing key. 2012-04-18 18:05:02 +02:00
antirez
9611f24607 Added an SMOVE test where src and dest key are the same. 2012-04-18 18:00:12 +02:00
antirez
25b016e4d3 New hash fuzzing test. 2012-04-18 17:56:17 +02:00
antirez
353f01d462 Explicit RPOP/LPOP tests. 2012-04-18 17:32:48 +02:00
antirez
62d36c3d16 Test LINSERT syntax error. 2012-04-18 17:22:14 +02:00
antirez
eab7143b2c Test LINDEX out of range index. 2012-04-18 17:17:53 +02:00
antirez
da0fd6248c More robust maxclients test. 2012-04-18 11:34:18 +02:00
Michael Schlenker
00ed1334f7 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-17 22:20:54 +02:00
antirez
8d1f304a34 Added test for SORT corner case: pattern ending with just "->". 2012-04-17 16:28:59 +02:00
antirez
2efe89f513 Less false positives in maxclients test, hopefully. 2012-04-17 10:04:42 +02:00
antirez
7509de176a Merge branch 'strict.lua' into unstable 2012-04-13 16:16:13 +02:00
antirez
549e3d0a85 New test for scripting engine: DECR_IF_GT. 2012-04-13 15:23:32 +02:00
antirez
a45cd5edd8 Tests modified to match the new global protection implementation. 2012-04-13 13:40:57 +02:00
antirez
1bbc0b92b7 Tests for lua globals protection. 2012-04-13 11:48:45 +02:00
antirez
9eb184b338 Test for maxclients. 2012-04-08 11:16:40 +02:00
antirez
2b621a5799 Added new test to check that "CONFIG appendonly no" actually kills the background AOF operation in progress if any. 2012-04-07 13:22:04 +02:00
antirez
06612a970f Tests for MONITOR. 2012-04-07 11:26:24 +02:00
antirez
8f49d6f257 New client info field added to CLIENT LIST output: multi, containing the length of the current pipeline. Test modified accordingly. 2012-04-07 11:14:52 +02:00
antirez
5705f88616 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-06 23:52:53 +02:00
antirez
52dff91e8f redis.tcl: no longer leave unread replies if an error happens during a MULTI/EXEC block. 2012-04-06 23:52:28 +02:00
Salvatore Sanfilippo
1c701fbe84 Merge pull request #430 from anydot/f-testsuite
Two changes of testsuite (killing redis and new option)
2012-04-05 01:56:12 -07:00