785 Commits

Author SHA1 Message Date
antirez
3ba00aae8e GEORADIUS: Don't report duplicates when radius is huge.
Georadius works by computing the center + neighbors squares covering all
the area of the specified position and radius. Then a distance filter is
used to remove elements which are actually outside the range.

When a huge radius is used, like 5000 km or more, adjacent neighbors may
collide and be the same, leading to the reporting of the same element
multiple times. This only happens in the edge case of huge radius but is
not ideal.

A robust but slow solution would involve qsorting the range to remove
all the duplicates. However since the collisions are only in adjacent
boxes, for the way they are ordered in the code, it is much faster to
just check if the current box is the same as the previous one processed.

This commit adds a regression test for the bug.

Fixes #2767.
2015-09-14 23:10:50 +02:00
antirez
f2a7d445c6 Test: MOVE expire test improved.
Related to #2765.
2015-09-14 12:35:55 +02:00
antirez
13dff381b3 MOVE now can move TTL metadata as well.
MOVE was not able to move the TTL: when a key was moved into a different
database number, it became persistent like if PERSIST was used.

In some incredible way (I guess almost nobody uses Redis MOVE) this bug
remained unnoticed inside Redis internals for many years.
Finally Andy Grunwald discovered it and opened an issue.

This commit fixes the bug and adds a regression test.

Close #2765.
2015-09-14 12:30:00 +02:00
antirez
e8bee5c796 Test: print info on HSTRLEN test failure.
This additional info may provide more clues about the test randomly
failing from time to time. Probably the failure is due to some previous
test that overwrites the logical content in the Tcl variable, but this
will make the problem more obvious.
2015-09-07 11:14:52 +02:00
Sebastian Waisbrot
7be8687677 Fix race condition in unit/introspection
Make sure monitor is attached in one connection before issuing commands to be monitored in another one
2015-08-11 22:56:17 -07:00
antirez
dc69b7ab01 Fix RDB encoding test for new csvdump format. 2015-08-05 14:05:43 +02:00
antirez
0aa35539c6 Test: csvdump now scans all DBs. 2015-08-05 12:27:15 +02:00
antirez
2ef570a4c3 PSYNC test: also test the vanilla SYNC. 2015-08-05 09:18:54 +02:00
antirez
05cf0f0948 Test PSYNC with diskless replication.
Thanks to Oran Agra from Redis Labs for providing this patch.
2015-08-04 13:14:25 +02:00
antirez
a2482feaa5 GEOENCODE / GEODECODE commands removed.
Rationale:

1. The commands look like internals exposed without a real strong use
case.
2. Whatever there is an use case, the client would implement the
commands client side instead of paying RTT just to use a simple to
reimplement library.
3. They add complexity to an otherwise quite straightforward API.

So for now KILLED ;-)
2015-07-09 17:42:59 +02:00
antirez
f7922b6db7 Geo: GEODIST and tests. 2015-06-29 12:44:34 +02:00
antirez
ac7f59fac5 Geo: GEOPOS command and tests. 2015-06-29 10:47:07 +02:00
antirez
665099cb02 Geo: GEORADIUS COUNT tests. 2015-06-29 09:52:23 +02:00
antirez
e1db8275e9 Geo: GEOENCODE test fixed for new return value. 2015-06-29 09:46:58 +02:00
antirez
3085fa0070 Geo: only one way to specify any given option. 2015-06-27 09:43:47 +02:00
antirez
9049156d53 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
830adf117e Geo: GEOHASH command test. 2015-06-24 16:34:20 +02:00
antirez
50b8511f43 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
d1fcac62ea Geo: test GEOADD with wrong input coordinates 2015-06-23 10:20:15 +02:00
antirez
0550e667ef Geo: fix tests after distance precision change 2015-06-22 15:00:37 +02:00
antirez
248ed2d3f1 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
b9136b5aee [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
e5c00e6d3a Test: ZADD CH tests 2015-05-29 11:34:43 +02:00
antirez
1372f1fb0f Test: ZADD INCR test 2015-05-29 11:28:52 +02:00
antirez
034d1b5046 Test: ZADD NX and XX options tests 2015-05-29 11:23:49 +02:00
antirez
d18079ef5e Merge branch 'sentinel-32' into unstable 2015-05-19 12:26:57 +02:00
antirez
c27fc1eea1 Sentinel: CKQUORUM tests 2015-05-19 12:26:09 +02:00
Glenn Nethercutt
d8390522cb 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
2684b76b66 Test: be more patient waiting for servers to exit.
This should likely fix a false positive when running with the --valgrind
option.
2015-03-31 23:43:38 +02:00
antirez
01a41c0d9c Sentinel / Cluster test: exit with non-zero error code on failures. 2015-03-30 14:29:01 +02:00
antirez
7701a4cc7e Test: regression for issue #2473. 2015-03-27 12:10:46 +01:00
antirez
d42c13f955 Cluster: unit 10 modified to leave cluster in proper state. 2015-03-22 22:58:53 +01:00
antirez
b2820bcb61 Cluster: CLUSTER FAILOVER TAKEOVER tests. 2015-03-22 22:44:23 +01:00
antirez
c56bb0d161 Cluster: more tests for manual failover + FORCE. 2015-03-22 22:44:02 +01:00
antirez
88fb2e3ce6 Cluster: new tests1 for manual failover and scripts replication. 2015-03-22 22:25:05 +01:00
antirez
7e0ea8b30d Test: fix SPOP replication test count.
If count is 0 SADD is called without element arguments, which is
currently invalid.
2015-03-13 17:30:13 +01:00
antirez
5f6292f980 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
d4a13bd2f4 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
261b9d1b0f Merge pull request #2415 from landmime/unstable
added a new hvstrlen command
2015-02-27 15:24:04 +01:00
antirez
d5efd018cf Test: fixes a few tests after basic unit refactoring. 2015-02-25 10:37:52 +01:00
antirez
5b562e64a0 Test: split basic unit into string, incr, keyspace units. 2015-02-25 10:33:29 +01:00
antirez
fa8fcff3f0 Change RENAME behavior when src and dst keys are the same.
Fixes issue #2392.
2015-02-23 11:24:24 +01:00
Jason Roth
6cc1d51719 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
45a1c66553 SPOP replication tests. 2015-02-11 10:52:28 +01:00
antirez
b842565acb SPOP explicit tests for the three different code paths. 2015-02-11 10:52:28 +01:00
antirez
38afac7752 alsoPropagate: handle REDIS_CALL_PROPAGATE and AOF loading. 2015-02-11 10:52:28 +01:00
antirez
ce54260321 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
antirez
41d0e80ec3 Added regression test for issue #2371. 2015-02-10 14:40:27 +01:00
antirez
d7d689e5cf Fix RDB corruption test after server behavior change. 2015-02-04 11:53:19 +01:00
antirez
a301cd0de4 Avoid duplicated instance execution code in Cluster test. 2015-01-22 18:59:39 +01:00