Commit Graph

813 Commits

Author SHA1 Message Date
antirez 7cd2a4e196 Geo: GEOENCODE test fixed for new return value. 2015-06-29 09:46:58 +02:00
antirez cd91beea1c Geo: only one way to specify any given option. 2015-06-27 09:43:47 +02:00
antirez fa9d62d34f Geo: from lat,lon API to lon,lat API according to GIS standard
The GIS standard and all the major DBs implementing GIS related
functions take coordinates as x,y that is longitude,latitude.
It was a bad start for Redis to do things differently, so even if this
means that existing users of the Geo module will be required to change
their code, Redis now conforms to the standard.

Usually Redis is very backward compatible, but this is not an exception
to this rule, since this is the first Geo implementation entering the
official Redis source code. It is not wise to try to be backward
compatible with code forks... :-)

Close #2637.
2015-06-26 10:58:27 +02:00
antirez 5fd756bf13 Geo: GEOHASH command test. 2015-06-24 16:34:20 +02:00
antirez cf89a19f16 Geo: GEORADIUS fuzzy testing by reimplementing it in Tcl.
We set random points in the world, pick a random position, and check if
the returned points by Redis match the ones computed by Tcl by brute
forcing all the points using the distance between two points formula.

This approach is sounding since immediately resulted in finding a bug in
the original implementation.
2015-06-24 10:38:46 +02:00
antirez 0425c60381 Geo: test GEOADD with wrong input coordinates 2015-06-23 10:20:15 +02:00
antirez 575e247a0e Geo: fix tests after distance precision change 2015-06-22 15:00:37 +02:00
antirez 73134f6a0b Geo: removed JSON failing test (false positive)
Server output is matched to a pre-computed output. The last digits
differ because of rouding errors.
2015-06-22 11:16:36 +02:00
Matt Stancliff 7f4ac3d19c [In-Progress] Add Geo Commands
Current todo:
  - replace functions in zset.{c,h} with a new unified Redis
    zset access API.

Once we get the zset interface fixed, we can squash
relevant commits in this branch and have one nice commit
to merge into unstable.

This commit adds:
  - Geo commands
  - Tests; runnable with: ./runtest --single unit/geo
  - Geo helpers in deps/geohash-int/
  - src/geo.{c,h} and src/geojson.{c,h} implementing geo commands
  - Updated build configurations to get everything working
  - TEMPORARY: src/zset.{c,h} implementing zset score and zset
    range reading without writing to client output buffers.
  - Modified linkage of one t_zset.c function for use in zset.c

Conflicts:
	src/Makefile
	src/redis.c
2015-06-22 09:07:13 +02:00
antirez 39b49bcaaf Test: ZADD CH tests 2015-05-29 11:34:43 +02:00
antirez 23ba5c1092 Test: ZADD INCR test 2015-05-29 11:28:52 +02:00
antirez 910e72d1c1 Test: ZADD NX and XX options tests 2015-05-29 11:23:49 +02:00
Glenn Nethercutt 626b4f6907 uphold the smove contract to return 0 when the element is not a member of the source set, even if source=dest 2015-04-17 09:27:54 -04:00
antirez 084a59c324 Test: HSTRLEN stress test of corner cases.
Main point here is to correctly report LLONG_MIN length, since to take
the absolute value we need care in sdigits10().
2015-02-27 15:44:44 +01:00
antirez 4e54b85a19 Hash: HSTRLEN (was HVSTRLEN) improved.
1. HVSTRLEN -> HSTRLEN. It's unlikely one needs the length of the key,
   not clear how the API would work (by value does not make sense) and
   there will be better names anyway.
2. Default is to return 0 when field is missing.
3. Default is to return 0 when key is missing.
4. The implementation was slower than needed, and produced unnecessary COW.

Related issue #2415.
2015-02-27 15:31:55 +01:00
Salvatore Sanfilippo b49c00a79c Merge pull request #2415 from landmime/unstable
added a new hvstrlen command
2015-02-27 15:24:04 +01:00
antirez 74354ceef5 Test: fixes a few tests after basic unit refactoring. 2015-02-25 10:37:52 +01:00
antirez 954151f62b Test: split basic unit into string, incr, keyspace units. 2015-02-25 10:33:29 +01:00
antirez fc365a3a00 Change RENAME behavior when src and dst keys are the same.
Fixes issue #2392.
2015-02-23 11:24:24 +01:00
Jason Roth db9461e466 added a new hvstrlen command
the hvstrlen command returns the length of a hash field value
2015-02-21 15:01:18 +00:00
antirez dffbbb5a78 SPOP explicit tests for the three different code paths. 2015-02-11 10:52:28 +01:00
antirez 5e3dcc522b Faster memory efficiency test.
This test on Linux was extremely slow, since in Tcl we can't enable
easily tcp-nodelay, so the busy loop used to take *a lot* with bigger
writes. Fixed using pipelining.
2015-02-10 14:47:45 +01:00
Matt Stancliff 02bb515a09 Config: Add quicklist, remove old list options
This removes:
  - list-max-ziplist-entries
  - list-max-ziplist-value

This adds:
  - list-max-ziplist-size
  - list-compress-depth

Also updates config file with new sections and updates
tests to use quicklist settings instead of old list settings.
2015-01-02 11:16:10 -05:00
Matt Stancliff e0d94a7b01 Increase test size for migrating large values
Previously, the old test ran 5,000 loops and used about 500k.

With quicklist, storing those same 5,000 loops takes up 24k, so the
"large value check" failed!

This increases the test to 20,000 loops which makes the object dump 96k.
2015-01-02 11:16:09 -05:00
Matt Stancliff 5e362b84ab Add quicklist implementation
This replaces individual ziplist vs. linkedlist representations
for Redis list operations.

Big thanks for all the reviews and feedback from everybody in
https://github.com/antirez/redis/pull/2143
2015-01-02 11:16:08 -05:00
Alon Diamant 288028876f Added <count> parameter to SPOP:
spopCommand() now runs spopWithCountCommand() in case the <count> param is found.
Added intsetRandomMembers() to Intset: Copies N random members from the set into inputted 'values' array. Uses either the Knuth or Floyd sample algos depending on ratio count/size.
Added setTypeRandomElements() to SET type: Returns a number of random elements from a non empty set. This is a version of setTypeRandomElement() that is modified in order to return multiple entries, using dictGetRandomKeys() and intsetRandomMembers().
Added tests for SPOP with <count>: unit/type/set, unit/scripting, integration/aof
--
Cleaned up code a bit to match with required Redis coding style
2014-12-14 12:25:42 +02:00
Salvatore Sanfilippo c50693d40f Merge pull request #2094 from mattsta/nosort
Fix zero-ordering SORT when called against lists
2014-12-11 15:54:39 +01:00
antirez b8a48ad5fe Regression test for issue #2175. 2014-12-03 10:38:56 +01:00
antirez 8a75ec0fca Merge remote-tracking branch 'origin/unstable' into unstable 2014-11-14 17:10:48 +01:00
Matt Stancliff ace628c792 Lua: add cmsgpack scripting tests
Basically: test to make sure we can load cmsgpack
and do some sanity checks to make sure pack/unpack works
properly.  We also have a bonus test for circular encoding
and decoding because I was curious how it worked.
2014-11-14 17:08:57 +01:00
Matt Stancliff e327c8edb9 Lua: add cjson scripting test
Two simple decode tests added mainly to check that
the 'cjson' global gets registered and is usable.
2014-11-14 17:08:22 +01:00
Matt Stancliff 6c0abc4a0e Fix zero-ordering SORT when called against lists
People mostly use SORT against lists, but our prior
behavior was pretending lists were an unordered bag
requiring a forced-sort when no sort was requested.

We can just use the native list ordering to ensure
consistency across replicaion and scripting calls.

Closes #2079
Closes #545 (again)
2014-10-29 14:57:35 -04:00
Matt Stancliff 3fecb96122 Lua: Add bitop
A few people have written custom C commands because bit
manipulation isn't exposed through Lua.  Let's give
them Mike Pall's bitop.

This adds bitop 1.0.2 (2012-05-08) from http://bitop.luajit.org/

bitop is imported as "bit" into the global namespace.

New Lua commands: bit.tobit, bit.tohex, bit.bnot, bit.band, bit.bor, bit.bxor,
bit.lshift, bit.rshift, bit.arshift, bit.rol, bit.ror, bit.bswap

Verification of working (the asserts would abort on error, so (nil) is correct):
127.0.0.1:6379> eval "assert(bit.tobit(1) == 1); assert(bit.band(1) == 1); assert(bit.bxor(1,2) == 3); assert(bit.bor(1,2,4,8,16,32,64,128) == 255)" 0
(nil)
127.0.0.1:6379> eval 'assert(0x7fffffff == 2147483647, "broken hex literals"); assert(0xffffffff == -1 or 0xffffffff == 2^32-1, "broken hex literals"); assert(tostring(-1) == "-1", "broken tostring()"); assert(tostring(0xffffffff) == "-1" or tostring(0xffffffff) == "4294967295", "broken tostring()")' 0
(nil)

Tests also integrated into the scripting tests and can be run with:
./runtest --single unit/scripting

Tests are excerpted from `bittest.lua` included in the bitop distribution.
2014-10-09 11:51:30 -04:00
Salvatore Sanfilippo 3c6f9ac37c Merge pull request #1902 from mattsta/comment-fixes
ALL comment fixes
2014-10-06 09:44:54 +02:00
antirez 389ec305b3 Test: check that INCR object sharing works as expected. 2014-10-03 12:28:56 +01:00
Matt Stancliff 1cedebb799 Remove trailing spaces from tests 2014-09-29 06:49:08 -04:00
Matt Stancliff 09cb281bc3 Fix spelling in some test cases 2014-09-29 06:49:08 -04:00
Paddy Byers a23502e5e8 Add regression test for issue #1939 2014-09-01 10:42:27 +02:00
Matt Stancliff 498ad7482b Reject MOVE to non-integer DBs
Previously, "MOVE key somestring" would move the key to
DB 0 which is just unexpected and wrong.
String as DB == error.

Test added too.

Modified by @antirez in order to use the getLongLongFromObject() API
instead of strtol().

Fixes #1428
2014-08-08 12:38:43 +02:00
Matt Stancliff 25791550e0 pubsub: Return integers for NUMSUB, not strings
Also adds test for numsub — due to tcl being tcl,
it doesn't capture the "numberness" of the fix,
but now we at least have one test case for numsub.

Closes #1561
2014-08-08 11:19:37 +02:00
Matt Stancliff 87815ab5ba Fix key extraction for SORT
We only want to use the last STORE key, but we have to record
we actually found a STORE key so we can increment the final return
key count.

Test added to prevent further regression.

Closes #1883, #1645, #1647
2014-08-07 16:14:15 +02:00
Jan-Erik Rediger 53fdfda9e3 Handle large getrange requests
Previously the end was casted to a smaller type
which resulted in a wrong check and failed
with values larger than handled by unsigned.

Closes #1847, #1844
2014-08-07 12:40:44 +02:00
Matt Stancliff f17f8521f0 scripting: no eval with negative key count
Negative key count causes segfault in Lua functions.

Fixes #1842
Closes #1843
2014-08-07 12:38:36 +02:00
antirez b9bb7e2d4a Test: check sorted set elements order after union.
This is not a regression but issue #1786 showed the need for this test.
2014-07-22 17:52:04 +02:00
antirez 509c888dfa Test: Pub/Sub PING. 2014-07-18 12:03:31 +02:00
antirez 420584a46d Test: small integer sharing depends on maxmemory policy. 2014-07-18 10:55:08 +02:00
antirez 3bf72d0d5f Test: more reliable AOF rewrite test under write load. 2014-07-10 16:42:43 +02:00
antirez a94aa39c86 LATENCY command / monitor basic tests. 2014-07-10 16:23:54 +02:00
antirez e01195e90d Test: AOF rewrite during write load. 2014-07-10 11:25:12 +02:00
antirez 1c343ec29f Test: use higher level redis.tcl proc to read replies. 2014-06-18 16:25:53 +02:00
antirez aa19fd612b Scripting: regression test for issue #1811. 2014-06-12 16:20:30 +02:00
antirez 96e0fe6232 Fix semantics of Lua calls to SELECT.
Lua scripts are executed in the context of the currently selected
database (as selected by the caller of the script).

However Lua scripts are also free to use the SELECT command in order to
affect other DBs. When SELECT is called frm Lua, the old behavior, before
this commit, was to automatically set the Lua caller selected DB to the
last DB selected by Lua. See for example the following sequence of
commands:

    SELECT 0
    SET x 10
    EVAL "redis.call('select','1')" 0
    SET x 20

Before this commit after the execution of this sequence of commands,
we'll have x=10 in DB 0, and x=20 in DB 1.

Because of the problem above, there was a bug affecting replication of
Lua scripts, because of the actual implementation of replication. It was
possible to fix the implementation of Lua scripts in order to fix the
issue, but looking closely, the bug is the consequence of the behavior
of Lua ability to set the caller's DB.

Under the old semantics, a script selecting a different DB, has no simple
ways to restore the state and select back the previously selected DB.
Moreover the script auhtor must remember that the restore is needed,
otherwise the new commands executed by the caller, will be executed in
the context of a different DB.

So this commit fixes both the replication issue, and this hard-to-use
semantics, by removing the ability of Lua, after the script execution,
to force the caller to switch to the DB selected by the Lua script.

The new behavior of the previous sequence of commadns is to just set
X=20 in DB 0. However Lua scripts are still capable of writing / reading
from different DBs if needed.

WARNING: This is a semantical change that will break programs that are
conceived to select the client selected DB via Lua scripts.

This fixes issue #1811.
2014-06-12 16:05:52 +02:00
Matt Stancliff 76efe1225f Scripting: Fix regression from #1118
The new check-for-number behavior of Lua arguments broke
users who use large strings of just integers.

The Lua number check would convert the string to a number, but
that breaks user data because
Lua numbers have limited precision compared to an arbitrarily
precise number wrapped in a string.

Regression fixed and new test added.

Fixes #1118 again.
2014-06-10 14:26:13 -04:00
Salvatore Sanfilippo c7f93143f6 Merge pull request #1669 from mattsta/blpop-internally-added-keys
Fix blocking operations from missing new lists
2014-06-09 11:37:28 +02:00
Salvatore Sanfilippo e8ebd7d0e0 Merge pull request #1789 from yoav-steinberg/fix_eval_in_tests
Fix eval usage in tests to conform with eval semantics
2014-06-06 10:37:57 +02:00
antirez 3307db49bd Regression test for issue #1118. 2014-06-04 18:51:20 +02:00
antirez 17b05afda9 Test: dump.tcl fixed for RESTORE new error msg. 2014-05-22 15:56:17 +02:00
Matt Stancliff 33f943b4cd Fix blocking operations from missing new lists
Behrad Zari discovered [1] and Josiah reported [2]: if you block
and wait for a list to exist, but the list creates from
a non-push command, the blocked client never gets notified.

This commit adds notification of blocked clients into
the DB layer and away from individual commands.

Lists can be created by [LR]PUSH, SORT..STORE, RENAME, MOVE,
and RESTORE.  Previously, blocked client notifications were
only triggered by [LR]PUSH.  Your client would never get
notified if a list were created by SORT..STORE or RENAME or
a RESTORE, etc.

Blocked client notification now happens in one unified place:
  - dbAdd() triggers notification when adding a list to the DB

Two new tests are added that fail prior to this commit.

All test pass.

Fixes #1668

[1]: https://groups.google.com/forum/#!topic/redis-db/k4oWfMkN1NU
[2]: #1668
2014-05-21 09:52:52 -04:00
antirez 7f772355f4 Regression test for issue #1764. 2014-05-20 16:20:16 +02:00
antirez a9e62ab9fa HyperLogLog regression test for issue #1762. 2014-05-19 15:44:04 +02:00
antirez 76c31d425e Scripting test: check that Lua can call commands rewirting argv.
SPOP, tested in the new test, is among the commands rewritng the
client->argv argument vector (it gets rewritten as SREM) for command
replication purposes.

Because of recent optimizations to client->argv caching in the context
of the Lua internal Redis client, it is important to test for SPOP to be
callable from Lua without bad effects to the other commands.
2014-05-07 16:12:32 +02:00
antirez 93e7a130fc Test: fixed scripting.tcl test false positive. 2014-04-24 21:44:32 +02:00
Salvatore Sanfilippo 32c917964e Merge pull request #1677 from mattsta/expire-before-delete
Check key expiration before deleting
2014-04-23 16:13:49 +02:00
yoav fdaab02347 Merge remote-tracking branch 'upstream/unstable' into unstable 2014-04-22 10:01:21 +03:00
antirez 9caa1ae96a Fuzzy test for ZREMRANGEBYLEX added. 2014-04-18 13:02:16 +02:00
antirez 85a2f2354e PFCOUNT multi-key test added. 2014-04-18 12:36:33 +02:00
antirez c0ccd4da7d Sorted set lex ranges stress tester. 2014-04-17 10:25:58 +02:00
antirez 5c48432340 Basic ZRANGEBYLEX / ZLEXCOUNT tests. 2014-04-17 00:08:11 +02:00
antirez cffeafe391 More HyperLogLog tests. 2014-04-16 09:17:38 +02:00
antirez 81ceef7d22 PFMERGE fixed to work with sparse encoding. 2014-04-14 16:09:32 +02:00
Matt Stancliff 88530804e8 Add test for deleting an expired key
Verify proper expire-before-delete behavior.

This test passes with the expire-before-delete commit and fails
without it.
2014-04-10 18:32:19 -04:00
yoav 4930d903fc Fix eval usage in tests to conform with eval semantics 2014-04-06 17:20:01 +03:00
antirez 352208ff68 Initial HyperLogLog tests. 2014-04-03 22:16:05 +02:00
antirez 8b8c1cd4c2 BITPOS fuzzy testing. 2014-02-27 15:27:05 +01:00
antirez b21f4d63de Basic BITPOS tests. 2014-02-27 15:01:45 +01:00
antirez 8d95a47408 Added two more BITCOUNT tests stressing misaligned access. 2014-02-27 10:07:29 +01:00
antirez 2a7847a3b5 BITCOUNT fuzzy test with random start/end added.
It was verified in practice that this test is able to stress much more
the implementation by introducing errors that were only trivially to
detect with different offsets but impossible to detect starting always
at zero and counting bits the full length of the string.
2014-02-27 10:00:17 +01:00
antirez f2bdf601be Test: regression for issue #1549.
It was verified that reverting the commit that fixes the bug, the test
no longer passes.
2014-02-13 12:26:38 +01:00
antirez 5d08413b13 Test: regression for issues #1483. 2014-01-09 11:19:03 +01:00
antirez a2f9947827 Test: stress events flags to/from string conversion. 2014-01-08 17:18:30 +01:00
antirez b1ba58f341 SDIFF iterator misuse bug regression test added.
See commit c00453d for more info about the bug.
2013-12-13 11:37:13 +01:00
Yossi Gottlieb 6e70c01148 Return proper error on requests with an unbalanced number of quotes. 2013-12-08 12:58:12 +02:00
antirez fcebd9b0f9 Fix false positive in memory efficiency test.
Fixes issue #1298.
2013-11-25 10:21:46 +01:00
antirez bf79c0cda2 Added tests for [SHZ]SCAN with MATCH. 2013-11-05 15:19:44 +01:00
antirez 9fba193a59 SSCAN with integer encoded object test improved. 2013-10-31 10:37:27 +01:00
antirez e6bb738b87 Regression test added for [SHZ]SCAN issue #1354. 2013-10-31 09:43:21 +01:00
antirez 0b8a0ca4bc Test: added a SCAN test trying to trigger HT resize. 2013-10-30 16:50:25 +01:00
antirez 6cb52256c9 Test: added ZSCAN test. 2013-10-30 16:25:53 +01:00
antirez 1b960378e8 Test: added HSCAN test. 2013-10-30 16:24:39 +01:00
antirez ddc80e026f Test: added SSCAN test. 2013-10-30 11:58:04 +01:00
antirez 5fdb94fd98 SCAN test keys sorting turned into more idiomatic Tcl. 2013-10-30 11:36:12 +01:00
antirez a881827b6e SCAN: tests moved to unit/scan.tcl. 2013-10-30 11:34:01 +01:00
antirez 0471b90844 SCAN: Fix test after option renamed from PATTERN to MATCH. 2013-10-25 11:55:28 +02:00
Pieter Noordhuis 7f490b197f Add SCAN command 2013-10-25 10:49:48 +02:00
antirez e9d97b453e Test: Lua stack leak regression test added. 2013-08-30 08:59:11 +02:00
antirez f79b1cb49e Test: added a memory efficiency test. 2013-08-29 16:23:57 +02:00
antirez ddccd0ed58 Test: regression test for issue #1208. 2013-07-22 23:40:48 +02:00
antirez b02bb47e67 Test: regression test for #1163. 2013-06-19 18:53:07 +02:00
antirez dfc31a1ee8 Test: Extended SET tests. 2013-03-28 16:25:24 +01:00
antirez 601cea665d Test: regression test for issue #1026. 2013-03-28 11:46:14 +01:00
antirez 1b13adf388 Test: verify that lazy-expire works. 2013-03-28 11:36:49 +01:00
antirez 252cf3052d Test: test replication of MULTI/EXEC. 2013-03-27 11:44:50 +01:00
antirez 40b692e822 Test: Restore DB back to 9 after testing MULTI/EXEC with DB 5. 2013-03-27 11:30:23 +01:00
antirez 797d98e906 Test: obuf-limits test false positive removed.
Fixes #621.
2013-03-25 11:56:34 +01:00
antirez dc24a6b132 Return a specific NOAUTH error if authentication is required. 2013-02-12 16:25:41 +01:00
antirez ac8c89cb20 Test: avoid false positives in CLIENT SETNAME closed connection test. 2013-02-12 13:27:24 +01:00
antirez d2b27f1d96 Tests for keyspace notifications. 2013-01-28 13:15:22 +01:00
antirez 2039f1a38a UNSUBSCRIBE and PUNSUBSCRIBE: always provide a reply.
UNSUBSCRIBE and PUNSUBSCRIBE commands are designed to mass-unsubscribe
the client respectively all the channels and patters if called without
arguments.

However when these functions are called without arguments, but there are
no channels or patters we are subscribed to, the old behavior was to
don't reply at all.

This behavior is broken, as every command should always reply.
Also it is possible that we are no longer subscribed to a channels but we
are subscribed to patters or the other way around, and the client should
be notified with the correct number of subscriptions.

Also it is not pretty that sometimes we did not receive a reply at all
in a redis-cli session from these commands, blocking redis-cli trying
to read the reply.

This fixes issue #714.
2013-01-21 19:02:26 +01:00
antirez 08d200baeb Slowlog: don't log EXEC but just the executed commands.
The Redis Slow Log always used to log the slow commands executed inside
a MULTI/EXEC block. However also EXEC was logged at the end, which is
perfectly useless.

Now EXEC is no longer logged and a test was added to test this behavior.

This fixes issue #759.
2013-01-19 12:53:21 +01:00
guiquanz 9d09ce3981 Fixed many typos. 2013-01-19 10:59:44 +01:00
antirez ea1f503cfe Tests for CLIENT GETNAME/SETNAME. 2013-01-15 13:34:17 +01:00
antirez a5cc063c17 Test: added regression for issue #872. 2013-01-10 11:10:31 +01:00
antirez c135b856c6 Test: regression for issue #801. 2012-12-02 20:43:11 +01:00
antirez f50e658455 SDIFF is now able to select between two algorithms for speed.
SDIFF used an algorithm that was O(N) where N is the total number
of elements of all the sets involved in the operation.

The algorithm worked like that:

ALGORITHM 1:

1) For the first set, add all the members to an auxiliary set.
2) For all the other sets, remove all the members of the set from the
auxiliary set.

So it is an O(N) algorithm where N is the total number of elements in
all the sets involved in the diff operation.

Cristobal Viedma suggested to modify the algorithm to the following:

ALGORITHM 2:

1) Iterate all the elements of the first set.
2) For every element, check if the element also exists in all the other
remaining sets.
3) Add the element to the auxiliary set only if it does not exist in any
of the other sets.

The complexity of this algorithm on the worst case is O(N*M) where N is
the size of the first set and M the total number of sets involved in the
operation.

However when there are elements in common, with this algorithm we stop
the computation for a given element as long as we find a duplicated
element into another set.

I (antirez) added an additional step to algorithm 2 to make it faster,
that is to sort the set to subtract from the biggest to the
smallest, so that it is more likely to find a duplicate in a larger sets
that are checked before the smaller ones.

WHAT IS BETTER?

None of course, for instance if the first set is much larger than the
other sets the second algorithm does a lot more work compared to the
first algorithm.

Similarly if the first set is much smaller than the other sets, the
original algorithm will less work.

So this commit makes Redis able to guess the number of operations
required by each algorithm, and select the best at runtime according
to the input received.

However, since the second algorithm has better constant times and can do
less work if there are duplicated elements, an advantage is given to the
second algorithm.
2012-11-30 16:36:42 +01:00
antirez 395d663d29 SDIFF fuzz test added. 2012-11-30 01:35:34 +01:00
antirez 925090f476 Make an EXEC test more latency proof. 2012-11-29 16:12:14 +01:00
antirez 95f68f7b0f EVALSHA is now case insensitive.
EVALSHA used to crash if the SHA1 was not lowercase (Issue #783).
Fixed using a case insensitive dictionary type for the sha -> script
map used for replication of scripts.
2012-11-22 15:50:00 +01:00
antirez 65606b3bc6 Test: MULTI state is cleared after EXECABORT error. 2012-11-22 10:32:20 +01:00
antirez 4977ab79af Test: make sure EXEC fails after previous transaction errors. 2012-11-22 10:32:16 +01:00
antirez 9c00f07897 Test: MULTI/EXEC tests moved into multi.tcl. 2012-11-22 10:32:12 +01:00
antirez a779b7e901 Merge branch 'migrate-cache' into unstable 2012-11-14 12:21:23 +01:00
antirez 989a7820ca Test: more MIGRATE tests. 2012-11-14 12:12:52 +01:00
antirez 17411f7afd Test: check if MIGRATE is caching connections. 2012-11-14 10:58:34 +01:00
antirez aa2bf6ba8b TTL API change: TTL returns -2 for non existing keys.
The previous behavior was to return -1 if:

1) Existing key but without an expire set.
2) Non existing key.

Now the second case is handled in a different, and TTL will return -2
if the key does not exist at all.

PTTL follows the same behavior as well.
2012-11-12 23:04:36 +01:00
antirez 1237d71c4e COPY and REPLACE options for MIGRATE.
With COPY now MIGRATE does not remove the key from the source instance.
With REPLACE it uses RESTORE REPLACE on the target host so that even if
the key already eixsts in the target instance it will be overwritten.

The options can be used together.
2012-11-07 15:32:27 +01:00
antirez e5b5763f56 REPLACE option for RESTORE.
The REPLACE option deletes an existing key with the same name (if any)
and materializes the new one. The default behavior without RESTORE is to
return an error if a key already exists.
2012-11-07 10:57:23 +01:00
antirez c4b0b6854e Type mismatch errors are now prefixed with WRONGTYPE.
So instead to reply with a generic error like:

-ERR ... wrong kind of value ...

now it replies with:

-WRONGTYPE ... wrong kind of value ...

This makes this particular error easy to check without resorting to
(fragile) pattern matching of the error string (however the error string
used to be consistent already).

Client libraries should return a specific exeption type for this error.

Most of the commit is about fixing unit tests.
2012-11-06 20:25:34 +01:00
antirez acfe3675e3 Differentiate SCRIPT KILL error replies.
When calling SCRIPT KILL currently you can get two errors:

* No script in timeout (busy) state.
* The script already performed a write.

It is useful to be able to distinguish the two errors, but right now both
start with "ERR" prefix, so string matching (that is fragile) must be used.

This commit introduces two different prefixes.

-NOTBUSY and -UNKILLABLE respectively to reply with an error when no
script is busy at the moment, and when the script already executed a
write operation and can not be killed.
2012-10-22 10:31:28 +02:00
antirez 9a914a632d "SORT by nosort" (skip sorting) respect sorted set ordering.
When SORT is called with the option BY set to a string constant not
inclduing the wildcard character "*", there is no way to sort the output
so any ordering is valid. This allows the SORT internals to optimize its
work and don't really sort the output at all.

However it was odd that this option was not able to retain the natural
order of a sorted set. This feature was requested by users multiple
times as sometimes to call SORT with GET against sorted sets as a way to
mass-fetch objects can be handy.

This commit introduces two things:

1) The ability of SORT to return sorted sets elements in their natural
ordering when `BY nosort` is specified, accordingly to `DESC / ASC` options.
2) The ability of SORT to optimize this case further if LIMIT is passed
as well, avoiding to really fetch the whole sorted set, but directly
obtaining the specified range.

Because in this case the sorting is always deterministic, no
post-sorting activity is performed when SORT is called from a Lua
script.

This commit fixes issue #98.
2012-10-03 14:54:43 +02:00
antirez ece77037e9 Revert "Scripting: redis.NIL to return nil bulk replies."
This reverts commit e061d797d7.

Conflicts:

	src/scripting.c
2012-10-01 10:10:31 +02:00
antirez 6dd1693c0e Scripting: redis.NIL to return nil bulk replies.
Lua arrays can't contain nil elements (see
http://www.lua.org/pil/19.1.html for more information), so Lua scripts
were not able to return a multi-bulk reply containing nil bulk
elements inside.

This commit introduces a special conversion: a table with just
a "nilbulk" field set to a boolean value is converted by Redis as a nil
bulk reply, but at the same time for Lua this type is not a "nil" so can
be used inside Lua arrays.

This type is also assigned to redis.NIL, so the following two forms
are equivalent and will be able to return a nil bulk reply as second
element of a three elements array:

    EVAL "return {1,redis.NIL,3}" 0
    EVAL "return {1,{nilbulk=true},3}" 0

The result in redis-cli will be:

    1) (integer) 1
    2) (nil)
    3) (integer) 3
2012-09-28 14:26:20 +02:00
antirez 0ee3f05518 Test for SRANDMEMBER with <count>. 2012-09-21 11:55:36 +02:00
antirez 7eb850ef0e A reimplementation of blocking operation internals.
Redis provides support for blocking operations such as BLPOP or BRPOP.
This operations are identical to normal LPOP and RPOP operations as long
as there are elements in the target list, but if the list is empty they
block waiting for new data to arrive to the list.

All the clients blocked waiting for th same list are served in a FIFO
way, so the first that blocked is the first to be served when there is
more data pushed by another client into the list.

The previous implementation of blocking operations was conceived to
serve clients in the context of push operations. For for instance:

1) There is a client "A" blocked on list "foo".
2) The client "B" performs `LPUSH foo somevalue`.
3) The client "A" is served in the context of the "B" LPUSH,
synchronously.

Processing things in a synchronous way was useful as if "A" pushes a
value that is served by "B", from the point of view of the database is a
NOP (no operation) thing, that is, nothing is replicated, nothing is
written in the AOF file, and so forth.

However later we implemented two things:

1) Variadic LPUSH that could add multiple values to a list in the
context of a single call.
2) BRPOPLPUSH that was a version of BRPOP that also provided a "PUSH"
side effect when receiving data.

This forced us to make the synchronous implementation more complex. If
client "B" is waiting for data, and "A" pushes three elemnents in a
single call, we needed to propagate an LPUSH with a missing argument
in the AOF and replication link. We also needed to make sure to
replicate the LPUSH side of BRPOPLPUSH, but only if in turn did not
happened to serve another blocking client into another list ;)

This were complex but with a few of mutually recursive functions
everything worked as expected... until one day we introduced scripting
in Redis.

Scripting + synchronous blocking operations = Issue #614.

Basically you can't "rewrite" a script to have just a partial effect on
the replicas and AOF file if the script happened to serve a few blocked
clients.

The solution to all this problems, implemented by this commit, is to
change the way we serve blocked clients. Instead of serving the blocked
clients synchronously, in the context of the command performing the PUSH
operation, it is now an asynchronous and iterative process:

1) If a key that has clients blocked waiting for data is the subject of
a list push operation, We simply mark keys as "ready" and put it into a
queue.
2) Every command pushing stuff on lists, as a variadic LPUSH, a script,
or whatever it is, is replicated verbatim without any rewriting.
3) Every time a Redis command, a MULTI/EXEC block, or a script,
completed its execution, we run the list of keys ready to serve blocked
clients (as more data arrived), and process this list serving the
blocked clients.
4) As a result of "3" maybe more keys are ready again for other clients
(as a result of BRPOPLPUSH we may have push operations), so we iterate
back to step "3" if it's needed.

The new code has a much simpler semantics, and a simpler to understand
implementation, with the disadvantage of not being able to "optmize out"
a PUSH+BPOP as a No OP.

This commit will be tested with care before the final merge, more tests
will be added likely.
2012-09-17 10:26:46 +02:00
antirez 74e57d0ece BITCOUNT regression test for #582 fixed for 32 bit target.
Bug #582 was not present in 32 bit builds of Redis as
getObjectFromLong() will return an error for overflow.

This commit makes sure that the test does not fail because of the error
returned when running against 32 bit builds.
2012-09-05 17:50:10 +02:00
Haruto Otake 749aac72ad BITCOUNT: fix segmentation fault.
remove unsafe and unnecessary cast.
until now, this cast may lead segmentation fault when end > UINT_MAX

setbit foo 0 1
bitcount  0 4294967295
=> ok
bitcount  0 4294967296
=> cause segmentation fault.

Note by @antirez: the commit was modified a bit to also change the
string length type to long, since it's guaranteed to be at max 512 MB in
size, so we can work with the same type across all the code path.

A regression test was also added.
2012-09-05 16:19:04 +02:00
antirez 36741b2c81 Scripting: Force SORT BY constant determinism inside SORT itself.
SORT is able to return (faster than when ordering) unordered output if
the "BY" clause is used with a constant value. However we try to play
well with scripting requirements of determinism providing always sorted
outputs when SORT (and other similar commands) are called by Lua
scripts.

However we used the general mechanism in place in scripting in order to
reorder SORT output, that is, if the command has the "S" flag set, the
Lua scripting engine will take an additional step when converting a
multi bulk reply to Lua value, calling a Lua sorting function.

This is suboptimal as we can do it faster inside SORT itself.
This is also broken as issue #545 shows us: basically when SORT is used
with a constant BY, and additionally also GET is used, the Lua scripting
engine was trying to order the output as a flat array, while it was
actually a list of key-value pairs.

What we do know is to recognized if the caller of SORT is the Lua client
(since we can check this using the REDIS_LUA_CLIENT flag). If so, and if
a "don't sort" condition is triggered by the BY option with a constant
string, we force the lexicographical sorting.

This commit fixes this bug and improves the performance, and at the same
time simplifies the implementation. This does not mean I'm smart today,
it means I was stupid when I committed the original implementation ;)
2012-09-05 01:17:49 +02:00
antirez 46c31a150a Scripting: require at least one argument for redis.call().
Redis used to crash with a call like the following:

    EVAL "redis.call()" 0

Now the explicit check for at least one argument prevents the problem.

This commit fixes issue #655.
2012-08-31 10:28:13 +02:00
antirez 84d9ef4f31 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 c0de45924c 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 80e808b6d6 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 51857c7e5c 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 1419406e8d 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 bc70b8e5f4 Tests modified to account for INFO fields renaming.
Commit 33e1db36fa 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 d866803818 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 fa4a5d5922 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 01d3a7e736 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 a3f2b4895b 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 348ee1a40a 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 92997d06ea Test "Turning off AOF kills the background writing child if any" is now more reliable. 2012-05-02 11:40:46 +02:00
Harmen 2ac546e00c Show problem with 'keys' command with specific command sequence. 2012-05-01 10:51:59 +02:00
antirez 5080e625d3 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 c4a4755286 Ziplist encoding now tested with negative integers as well. 2012-04-23 17:27:46 +02:00
Salvatore Sanfilippo c22e0eecd5 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 4e7cc35f1a New time limit for protocol desync test set to 30 seconds to reduce false positives. 2012-04-23 10:57:43 +02:00
antirez d3701d2714 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
antirez 47db53c3c3 New tests related to scripts max execution time. 2012-04-19 23:49:33 +02:00
antirez 5498e7bc76 Tests for scripting PRNG. 2012-04-18 23:50:16 +02:00
antirez cddfd67ed4 Test SDIFF with first set empty. 2012-04-18 18:13:31 +02:00
antirez 4264459141 Test SINTER against same integer elements, but different set encoding. 2012-04-18 18:10:48 +02:00
antirez f800942f64 Test SINTER with non existing key. 2012-04-18 18:05:02 +02:00
antirez 88f77a2b7e Added an SMOVE test where src and dest key are the same. 2012-04-18 18:00:12 +02:00
antirez e51a218aaa New hash fuzzing test. 2012-04-18 17:56:17 +02:00
antirez 79daddd5ba Explicit RPOP/LPOP tests. 2012-04-18 17:32:48 +02:00
antirez 7aa0dfd014 Test LINSERT syntax error. 2012-04-18 17:22:14 +02:00
antirez 94e5c1d7e5 Test LINDEX out of range index. 2012-04-18 17:17:53 +02:00
antirez 8ec9b03c6b More robust maxclients test. 2012-04-18 11:34:18 +02:00
Michael Schlenker 875944a23f 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 6a3f0ac68a Added test for SORT corner case: pattern ending with just "->". 2012-04-17 16:28:59 +02:00
antirez 0705ff3f04 Less false positives in maxclients test, hopefully. 2012-04-17 10:04:42 +02:00
antirez 93a74949d7 Merge branch 'strict.lua' into unstable 2012-04-13 16:16:13 +02:00
antirez 13a21caae3 New test for scripting engine: DECR_IF_GT. 2012-04-13 15:23:32 +02:00
antirez 3cd4ad267c Tests modified to match the new global protection implementation. 2012-04-13 13:40:57 +02:00
antirez 2fd7c9efde Tests for lua globals protection. 2012-04-13 11:48:45 +02:00
antirez a3af8d8e49 Test for maxclients. 2012-04-08 11:16:40 +02:00
antirez 69e7958918 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 4ce22375f4 Tests for MONITOR. 2012-04-07 11:26:24 +02:00
antirez 09f66a0be8 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 0daf7a2d16 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 15113dcd3d More MIGRATE tests. 2012-04-03 15:10:51 +02:00
antirez 06e178708e MIGRATE test modified because the implementation changed. 2012-04-02 16:38:59 +02:00
antirez ab8232d022 DUMP, RESTORE, MIGRATE tests. 2012-04-02 11:44:25 +02:00
antirez 6aa2f98938 Test for redis.sha1hex(). 2012-03-28 20:47:50 +02:00
antirez 6df450b77c CLIENT LIST test modified to reflect the new output. 2012-03-13 18:06:29 +01:00
antirez 8562798308 Merge conflicts resolved. 2012-03-09 22:07:45 +01:00
antirez fcdeb98568 even less false positive on obuf-limits test. 2012-02-22 11:25:30 +01:00
antirez d347348109 Issue #330 regression test. 2012-02-16 16:13:40 +01:00
antirez 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
antirez 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
antirez 01f75bf352 New SORT tests checking the new more deterministic behavior of SORT sorting algorithm. 2012-02-01 17:17:52 +01:00
antirez 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
antirez 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
antirez 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
Michal Kwiatkowski a0bf8d0ad8 SORT with STORE removes key if result is empty. This fixes issue #227. 2012-01-30 07:36:49 +01:00
antirez 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
antirez 7f7a13b27b Less false positives for obuf-limits.tcl tests 2012-01-26 16:08:24 +01:00
antirez da9c4cc147 Added test for client output buffer limit (soft limit). 2012-01-25 18:34:56 +01:00
antirez efc8f6c1a2 Added test for client output buffer limit (hard limit). 2012-01-25 18:11:04 +01:00
antirez 3c0602ff41 CLIENT LIST test fixed (there is a new omem field in the output) 2012-01-23 16:19:49 +01:00
antirez 06f8a473fc Regression tests for protocol desync bug related to Issue #141 2012-01-06 12:54:29 +01:00
Pieter Noordhuis ebd85e9a45 Encode small hashes with a ziplist 2012-01-02 22:14:10 -08:00
antirez 9678c37577 Added regression test for ZUNIONSTORE creating NaN (github issue #264) 2011-12-23 09:34:06 +01:00
antirez d334281c80 Merge remote-tracking branch 'origin/unstable' into unstable 2011-12-21 17:13:31 +01:00
antirez b4fb720b10 A test modified to pass with the new AOF start/stop semantics. 2011-12-21 09:24:14 +01:00
BigCat f54c299091 I found that no test will fail even if I broke the `SORT x LIMIT y z` code.
Added a naive unit test for SORT-LIMIT command.
2011-12-19 19:49:34 +08:00
antirez 3ae5a308db unit/introspection.tcl added 2011-12-19 10:21:50 +01:00
antirez 570bbcf8e0 Added tests for AOF rewrite. 2011-12-13 11:10:36 +01:00
antirez 85b69afede EXPIRE tests more tolerant to random latency while the test is running. 2011-12-07 12:44:27 +01:00
antirez 237194b760 Fixed SORT bugs (issue #224) with regression tests. 2011-12-01 16:08:05 +01:00
antirez 674df1eef5 Added regression tests for issue #209 2011-11-25 12:27:29 +01:00
antirez bf758397a1 more valgrind (and other archs) friendly testing of floating number related features. 2011-11-16 14:40:50 +01:00
antirez cd4aba36cd valgrind handles floating point numbers differently for some reason, so using "simpler" numbers to make tests happy. 2011-11-16 13:35:22 +01:00
antirez 3c5680ed9d HINCRBYFLOAT tests 2011-11-15 15:26:10 +01:00
antirez d4a3cfed9c Merge branch 'unstable' into incrbyfloat 2011-11-14 15:59:56 +01:00
antirez 70023978fd test for the new more strict behavior about number parsing 2011-11-14 15:39:55 +01:00
antirez c9df799b2c INCRBYFLOAT tests 2011-11-14 15:37:13 +01:00
antirez d93f9a8644 string to number API is now more strict not accepting spaces before or after the number. A few tests converted to match the new error messages using the word float instead of double. 2011-11-14 15:34:44 +01:00
antirez 762eea07ca Added test to make sure Redis evicts expired keys actively (and not just in a lazy fashion). 2011-11-12 11:27:38 +01:00
antirez 64c7499eb8 new tests for EXPIRE family functions, new millisecond precision, and new millisecond argument variants. 2011-11-11 15:11:50 +01:00
antirez ef23f3ac92 Script max execution time test disabled for now since it is no longer enforced. 2011-10-31 16:09:07 +01:00
antirez e5abf6ef19 SCRIPT LOAD now returns the SHA1 instead of +OK 2011-10-25 14:46:15 +02:00
antirez e8c993f0fb Fixes for the scripting refactoring and new commands. Tests for the new features. 2011-10-25 11:19:15 +02:00
antirez 9ed32ba083 Redis.call is now split into two variants of the same function. Redis.call will raise an error by default. Redis.pcall will return the error object instead. 2011-10-20 16:02:23 +02:00
antirez ab52d1f4a8 Fix for issue #132. Now AUTH raises an error if no server password is configured. 2011-10-10 22:21:17 +02:00
antirez 02a3e58258 Added two new tests for RENAME, currently both will fail because of bug #128. 2011-10-10 12:01:13 +02:00
antirez 7864ef8551 new tests for the scripting engine: not allowed commands and write commands after random commands. 2011-09-27 15:39:41 +02:00
antirez 7551e23716 regression test for bug 593 added 2011-09-12 10:53:49 +02:00
antirez f65c8f654f Merge remote-tracking branch 'origin/unstable' into unstable 2011-07-28 14:40:47 +02:00
antirez 4bb1ccc6eb Regression for a crash with blocking ops and pipelining 2011-07-28 14:40:06 +02:00
antirez 3d9704d335 Merge remote branch 'origin/unstable' into unstable 2011-07-28 12:33:17 +02:00
antirez 243b783fdc Maxmemory test 2011-07-28 12:32:52 +02:00
Pieter Noordhuis 2d7162bb1d HDEL: Abort deleting fields when hash is removed 2011-07-27 12:29:40 +02:00
antirez d50292d2cc make a scripting test more valgrind friendly 2011-07-15 18:28:24 +02:00
antirez 61fee31999 test that EVALSHA is replicated as EVAL 2011-07-15 17:41:40 +02:00
antirez 0681c5ad84 master branch merged into scripting. 2011-07-12 12:39:16 +02:00
antirez 34a8b51768 solved a slow positive in the slow log test when the test is executed slowly 2011-07-11 16:04:18 +02:00
antirez bf1379c8df fixed another timing issue when running the test over valgrind or with very slow PCs 2011-07-11 15:58:31 +02:00
antirez 0717e3aa16 fix a test timing issue when running the test over valgrind 2011-07-11 15:44:38 +02:00
antirez 121ffc85f4 better recap of failed tests. 2011-07-11 12:56:00 +02:00
antirez 04e2410d2d initial support for failed tests summary at end of the test. 2011-07-11 12:44:55 +02:00
antirez 30cf7be60c the test runs less iterations of slow tests if no --accurate is given. 2011-07-11 12:15:35 +02:00
antirez 6209797d37 list test further split into smaller units 2011-07-11 11:41:23 +02:00
antirez e46f78bd26 list test split into smaller parts 2011-07-11 11:30:46 +02:00
antirez 13566085cf Initial implementation of a client-server parallel testing system for Redis in order to speedup execution of the test suite. 2011-07-10 23:25:48 +02:00
antirez bbbf79ddb5 Added slowlog.tcl 2011-07-01 15:49:17 +02:00
antirez 994ed2bc55 unstable merge conflicts resolved 2011-06-25 12:29:24 +02:00
antirez c1c9d551da Fix for bug 561 and other related problems 2011-06-20 17:19:36 +02:00
Pieter Noordhuis b0d1d2684d SETNX regression tests. 2011-06-20 16:42:29 +02:00
antirez 0d1650f8a9 Updated to unstable 2011-06-14 18:06:39 +02:00
antirez b002546bb4 ZREM tests 2011-05-31 20:30:54 +02:00
antirez 3738ff5f32 Fix for the variadic version of SREM. Regression test added. 2011-05-31 20:14:29 +02:00
antirez faa2a80f89 disabled development test entry, tests moved in the right place 2011-05-31 18:49:12 +02:00
antirez 449286a588 Scripting tests added 2011-05-25 12:32:50 +02:00
antirez 6326c3ce73 Merge branch 'unstable' of github.com:antirez/redis into unstable 2011-05-20 11:45:05 +02:00
antirez 206d62710c Print version info before running the test 2011-05-20 11:44:54 +02:00
antirez 521ddcce14 Fix for ZUNIONSTORE bug when there is an empty set among input sets. Regression test added. 2011-05-19 17:58:52 +02:00
antirez af9aed25e4 ZINTERSTORE regressiont test with two sets, intset+hashtable 2011-05-12 20:20:40 +02:00
antirez b3a96d454e Variadic SREM 2011-04-19 17:37:03 +02:00
antirez 64a13a36e6 variadic HDEL with tests 2011-04-19 17:07:55 +02:00
antirez 271f087842 Variadic SADD tests 2011-04-15 18:28:25 +02:00
antirez 9d0a8656c1 tests for variadic list push 2011-04-15 16:52:07 +02:00
Pieter Noordhuis 100ed062c0 Test for ENCODING_SKIPLIST instead of ENCODING_RAW 2011-04-06 16:17:07 +02:00
Pieter Noordhuis 04a10b1a6d Test that sorted sets are removed when empty 2011-03-22 09:28:45 +01:00
Pieter Noordhuis 9ec4ea20a7 Test both sorted set encodings for every test 2011-03-14 10:54:37 +01:00
Pieter Noordhuis e53ca04b50 Test for empty inner range when looking for elements in range 2011-03-11 18:18:02 +01:00
Pieter Noordhuis 8e1b327706 Test for ranges where min > max 2011-03-08 10:57:39 +01:00
Pieter Noordhuis 22b9bf1594 Move logic concerned with zset ranges
This also optimizes ZREVRANGEBYSCORE for pathological cases where a
sorted set contains many elements with the same score. Previously,
it would traverse the list from back to front in such a case.
2011-03-08 10:57:24 +01:00
Pieter Noordhuis 6c682e559c Restore argc/argv in EXEC after command is executed 2011-02-23 14:37:22 +01:00
antirez 322ea972fe run both inmemory and diskstore tests. 2011-01-09 19:42:56 +01:00
antirez a5062bbab0 fixed bgsave_in_progress in INFO when BGSAVEing with diskstore enabled, don't DEBUG FLUSHCACHE when bgsave is in progress. 2011-01-09 19:25:34 +01:00
antirez 69bfffb4a7 test adapted to run with diskstore, and a few bugs fixed 2011-01-09 18:25:34 +01:00
Pieter Noordhuis 7d5f5712d9 Update tests for STRLEN 2010-12-15 11:49:39 +01:00
Pieter Noordhuis 8f8eeffec1 Disable negative offsets for SETRANGE 2010-12-15 11:30:50 +01:00
Pieter Noordhuis e983cf34be Add fuzzy test for SETBIT 2010-12-15 11:20:54 +01:00
Pieter Noordhuis 30407e1f4f Make SETBIT return original bit value 2010-12-15 00:42:32 +01:00
antirez 603e616bf4 Merge branch 'master' of github.com:antirez/redis 2010-12-14 17:42:46 +01:00
antirez 57997664ea Merge remote branch 'pietern/strrange' 2010-12-14 17:42:01 +01:00
antirez f858c11d7d Merge remote branch 'pietern/brpoplpush' 2010-12-14 16:26:37 +01:00
Pieter Noordhuis d8f160a848 Add test cases for GETRANGE against integer-encoded strings 2010-12-14 15:35:35 +01:00
Pieter Noordhuis ef11bcccca Refactor and rename SUBSTR to GETRANGE
SUBSTR is renamed to GETRANGE to have better consistency between command
names (with SETRANGE as its dual). GETRANGE is still aliased as SUBSTR.
2010-12-14 15:16:29 +01:00
Pieter Noordhuis 9f9e1ceaa0 Add SETRANGE command implementation and tests 2010-12-14 14:20:51 +01:00
Pieter Noordhuis 6f8a32d5c7 Be less verbose in testing; improve error handling 2010-12-10 16:13:21 +01:00
Pieter Noordhuis eae33c1c81 Add generic function to grow an sds value
Move logic concerned with setting a bit in an sds to the SETBIT command
instead of keeping it in sds.c. The function to grow an sds can and will
be reused for a command to set a range within a string value.
2010-12-10 11:58:21 +01:00
Pieter Noordhuis 076f88d657 Enforce maximum string value length of 512MB 2010-12-09 17:16:10 +01:00
Pieter Noordhuis 3c1bf4957e Add commands SETBIT/GETBIT 2010-12-09 16:39:33 +01:00
Pieter Noordhuis ecf9401415 Fix case and indent 2010-12-06 16:04:42 +01:00
Pieter Noordhuis 8a88c368ed Check other blocked clients when value could not be pushed 2010-12-06 16:04:10 +01:00
Michel Martens & Damian Janowski baa14ef913 Fix BRPOPLPUSH behavior for all use cases. 2010-11-29 23:52:07 -03:00
Damian Janowski & Michel Martens 7c25a43adc Handle BRPOPLPUSH inside a transaction. 2010-11-29 23:52:07 -03:00
Damian Janowski & Michel Martens ba3b474111 Refactor code for BRPOPLPUSH. 2010-11-29 23:52:07 -03:00
Damian Janowski & Michel Martens b2a7fd0cf7 BRPOPLPUSH. 2010-11-29 23:52:07 -03:00
antirez 21dbc6499a merge conflict resolved 2010-10-28 22:59:47 +02:00
antirez 73abd0a9d2 Merge remote branch 'remotes/pietern/zrevrangebyscore' 2010-10-28 14:12:25 +02:00
Pieter Noordhuis e584d82fec Return error to client on wrong type for HMGET 2010-10-26 12:33:17 +02:00
Pieter Noordhuis b19c33d48a Prevent clients from making too large multibulk requests 2010-10-15 19:15:38 +02:00
Pieter Noordhuis dc11daf3b5 Change tests to use either the inline or the multibulk protocol 2010-10-15 17:25:20 +02:00
Pieter Noordhuis 5a4f9f27e7 Add tests for OK on QUIT 2010-10-15 12:54:53 +02:00
Pieter Noordhuis 7236fdb22f Return error when min and/or max in the sorted set range spec is not a double 2010-10-13 21:59:24 +02:00
Pieter Noordhuis 91504b6cbe Make ZREMRANGEBYSCORE accept the same range spec as ZRANGEBYSCORE
This allows to use inclusive/exclusive bounds for min and max when
deleting a range of scores from a sorted set.
2010-10-13 21:43:58 +02:00
Pieter Noordhuis 26f3388d27 Merge branch 'master' into zrevrangebyscore 2010-10-13 20:29:50 +02:00
antirez 4610b0332c intset stress testing added, ziplist stress testing relocated in a more appropriate place 2010-09-24 11:15:06 +02:00
antirez ef27ba988b explicit regression test for a ziplist bug added 2010-09-24 10:37:00 +02:00
antirez 1a06bf93c4 ziplist implementation fuzzy tests 2010-09-24 10:30:15 +02:00
Pieter Noordhuis 25bb8a4452 Add ZREVRANGEBYSCORE and refactor Z*RANGEBYSCORE 2010-09-16 14:38:07 +02:00
Pieter Noordhuis 3c23ee1ba2 Fix another test that sometimes returned the swapped object instead of encoding 2010-09-13 16:59:46 +02:00
Pieter Noordhuis efc5d4cc0d Fix test that sometimes returned the swapped object instead of encoding 2010-09-07 11:49:33 +02:00
antirez f7f12a606c resolved conflict merging pietern/bpop-timeout 2010-08-31 11:23:12 +02:00
antirez 08f55b786b faster server starting in Redis tests 2010-08-31 11:17:06 +02:00
Pieter Noordhuis 1eb13e4913 Fix set tests to make sets have a deterministic encoding 2010-08-31 09:37:35 +02:00
antirez fb92ecece7 BLPOP inside MULTI/EXEC block no longer crashes, instead if the list is empty the behavior is like if the timeout is reached. This fixes Issue 285 2010-08-30 16:31:03 +02:00
antirez 452ccf7a41 SORT stress testing against bigger aggregate values 2010-08-26 17:29:13 +02:00
Pieter Noordhuis 94364d53b4 Verify that the blocking pop timeout value is a non-negative integer 2010-08-26 14:05:14 +02:00
antirez acc75bfd4f Merge remote branch 'pietern/intset-split' 2010-08-26 12:04:24 +02:00
antirez 01daeecee7 added tests for invalid bulk argument 2010-08-24 11:49:05 +02:00
Pieter Noordhuis 029e5577ff Make SORT use the hybrid set accessors to allow sorting intsets 2010-08-21 11:20:41 +02:00
Pieter Noordhuis 2b9a59471f SORT tests with hash table encoded set as input 2010-08-21 11:03:56 +02:00
Pieter Noordhuis ced6709cb9 Make SORT tests use both ziplists and linked lists as input 2010-08-21 11:02:22 +02:00
Pieter Noordhuis 5d4f3a8c85 Move SORT tests around 2010-08-21 10:55:53 +02:00
Pieter Noordhuis 87c74dfaa8 Check if stroll return value was clamped 2010-08-20 13:42:42 +02:00
Pieter Noordhuis aaada3f962 Merge branch 'master' into intset-split
Conflicts:
	src/Makefile
	src/t_set.c
2010-08-20 12:40:55 +02:00
antirez 1fb4e8def7 PERSIST: a fix and some basic test 2010-08-03 14:25:22 +02:00
antirez 2c572622fb no longer passing tests due to the new write-on-volatile semantics modified/removed 2010-08-03 13:08:32 +02:00
antirez 0c7a9dec65 Merge remote branch 'pietern/list-test' 2010-07-31 13:55:06 +02:00
Pieter Noordhuis 673e1fb7e4 Change getDoubleFromObject to fail on NaN.
Return an error when the resulting value is not a number (NaN). Fix
ZUNIONSTORE/ZINTERSTORE to clean up when a weight argument is not a
double value.
2010-07-29 23:05:01 +02:00
Pieter Noordhuis d9e28bcf00 Fix ZUNIONSTORE/ZINTERSTORE to never store a NaN score.
When +inf and -inf are added, the result is NaN. We don't want NaN
scores in a sorted set, so agreed on the result of this operation being
zero.
2010-07-29 23:03:11 +02:00
Pieter Noordhuis 715c801a07 Use a large value to consistently trigger a list encoding,
even when the list is swapped out and in again.
2010-07-29 13:56:35 +02:00
antirez db0c43a70c removed test code having bad effects... 2010-07-27 14:46:39 +02:00
antirez dd3f505ff5 Consistency test improved 2010-07-27 14:42:11 +02:00
antirez 80091bbaac STRLEN command implemented 2010-07-27 10:09:26 +02:00
antirez b7a8daef60 WATCH will now consider touched keys target of EXPIRE command after the WATCH is performed, but not before 2010-07-05 19:38:12 +02:00
Pieter Noordhuis 96ffb2fe97 merged intset code into the split files 2010-07-02 19:57:12 +02:00
antirez b8b8501d70 Merge remote branch 'pietern/zfixes' 2010-06-25 00:23:38 +02:00
Pieter Noordhuis f483ce5ffe fix unexpected behavior on an out of range end index for LRANGE and LTRIM 2010-06-24 15:12:42 -07:00
Pieter Noordhuis c2ff0e90b8 more pub/sub tests 2010-06-16 11:03:23 +02:00
Pieter Noordhuis 4589a823fd initial basic pub/sub tests 2010-06-16 11:01:42 +02:00
Pieter Noordhuis 5eedc9c65e tests for BLPOP/BRPOP via an option in the tcl client that defers reading the reply 2010-06-15 21:23:18 +02:00
Pieter Noordhuis 4774a53b24 fix behavior for out-of-range negative end index on ZREMRANGEBYRANK 2010-06-15 16:21:42 +02:00
Pieter Noordhuis 184d74abc6 more tests for zrange and zrevrange; fix behavior for out-of-range negative end index 2010-06-15 15:40:28 +02:00
Pieter Noordhuis 7e79de541a rename "list" to "linkedlist" to be more verbose 2010-06-14 10:21:23 +02:00
Pieter Noordhuis 08b5920750 change ltrim tests to cover all min/max cases and add stronger stresser 2010-06-14 09:45:34 +02:00
Pieter Noordhuis 273f616930 make sure sets have the right encoding when loaded from rdb 2010-06-13 21:42:04 +02:00
Pieter Noordhuis ab37269c38 use max number of intset entries in tests and make SUNION/SINTER/SDIFF tests use less entries 2010-06-13 21:37:46 +02:00
Pieter Noordhuis b978abbf02 small refactor of SMOVE and tests for SMOVE on sets with different encoding 2010-06-13 11:16:18 +02:00
Pieter Noordhuis d0b58d5300 intset encoding for sets, refactored set tests to test both encodings 2010-06-12 22:25:22 +02:00
Pieter Noordhuis 23d3a5feef make LINSERT return -1 when the value could not be inserted 2010-06-11 17:34:23 +02:00
Pieter Noordhuis 70b4b320ae check if the list encoding needs to be changed on LPUSHX, RPUSHX, LINSERT 2010-06-11 14:52:35 +02:00
Pieter Noordhuis 244b873b0c make sure the value to insert is string encoded 2010-06-11 13:27:21 +02:00
Robey Pointer dedff272f6 squashed merge from robey/twitter3: LINSERT BEFORE|AFTER, LPUSHX, RPUSHX 2010-06-11 10:09:46 +02:00
Pieter Noordhuis ab193fe452 generated tests for different encodings to avoid test code duplication 2010-06-04 17:05:54 +02:00
Pieter Noordhuis d4507ec615 refactor list tests to test both encodings; implemented assert functions 2010-06-04 16:31:27 +02:00
Pieter Noordhuis afbf59145a tag test with sleep() as slow 2010-06-03 00:26:39 +02:00
Pieter Noordhuis 6b6f101c27 tag more slow tests 2010-06-03 00:16:10 +02:00
Pieter Noordhuis 7a6ae0a2b2 scope res variable outside test 2010-06-03 00:06:58 +02:00
Pieter Noordhuis 7f7499eeac tags for existing tests 2010-06-02 23:22:25 +02:00
Pieter Noordhuis 6e0e5bedd9 basic support to tag tests 2010-06-02 22:53:22 +02:00
Pieter Noordhuis 9e5d2e8bd6 changed how server.tcl accepts options to support more directives without requiring more arguments to the proc 2010-06-02 22:23:52 +02:00
antirez 5fc9229c34 Fixed ZINCR Nan bugs leading to server crash and added tests 2010-05-28 12:24:47 +02:00
antirez 4ea93ad3ac new multi/exec tests 2010-05-27 16:08:44 +02:00
Josiah Carlson bc000c1db0 allow regular sets to be passed to zunionstore/zinterstore 2010-05-26 16:07:04 +02:00
antirez 9b30e1a207 WATCH is now able to detect keys removed by FLUSHALL and FLUSHDB 2010-05-25 19:30:24 +02:00
antirez c20c189db5 WATCH tests 2010-05-25 14:04:46 +02:00
antirez d6d3f92fb0 added regression for zipmap bug 2010-05-20 12:03:02 +02:00
antirez 5d373da96a ZUNION,ZINTER -> ZUNIONSTORE,ZINTERSTORE 2010-05-14 18:58:37 +02:00
antirez ab72b4833d minor fixes to the new test suite, html doc updated 2010-05-14 18:48:33 +02:00