summaryrefslogtreecommitdiff
path: root/src/geohash.h
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-07-27 11:07:23 +0200
committerantirez <antirez@gmail.com>2016-07-27 11:34:25 +0200
commit356a6304ec77783e7fdaf00668a09dc293b810a0 (patch)
treeca7f1d239f61e1b6f731168efcda1f3c20e684cf /src/geohash.h
parent03f5b508e5e939c941fb0c456b0f48b8e7a2c657 (diff)
downloadredis-356a6304ec77783e7fdaf00668a09dc293b810a0.tar.gz
Multiple GEORADIUS bugs fixed.
By grepping the continuous integration errors log a number of GEORADIUS tests failures were detected. Fortunately when a GEORADIUS failure happens, the test suite logs enough information in order to reproduce the problem: the PRNG seed, coordinates and radius of the query. By reproducing the issues, three different bugs were discovered and fixed in this commit. This commit also improves the already good reporting of the fuzzer and adds the failure vectors as regression tests. The issues found: 1. We need larger squares around the poles in order to cover the area requested by the user. There were already checks in order to use a smaller step (larger squares) but the limit set (+/- 67 degrees) is not enough in certain edge cases, so 66 is used now. 2. Even near the equator, when the search area center is very near the edge of the square, the north, south, west or ovest square may not be able to fully cover the specified radius. Now a test is performed at the edge of the initial guessed search area, and larger squares are used in case the test fails. 3. Because of rounding errors between Redis and Tcl, sometimes the test signaled false positives. This is now addressed. Whenever possible the original code was improved a bit in other ways. A debugging example stanza was added in order to make the next debugging session simpler when the next bug is found.
Diffstat (limited to 'src/geohash.h')
-rw-r--r--src/geohash.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/geohash.h b/src/geohash.h
index c2f57bed0..ed2ef9336 100644
--- a/src/geohash.h
+++ b/src/geohash.h
@@ -95,7 +95,7 @@ typedef struct {
* -1:failed
*/
void geohashGetCoordRange(GeoHashRange *long_range, GeoHashRange *lat_range);
-int geohashEncode(GeoHashRange *long_range, GeoHashRange *lat_range,
+int geohashEncode(const GeoHashRange *long_range, const GeoHashRange *lat_range,
double longitude, double latitude, uint8_t step,
GeoHashBits *hash);
int geohashEncodeType(double longitude, double latitude,