summaryrefslogtreecommitdiff
path: root/src/geohash_helper.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix GEORADIUS edge case with huge radius.antirez2017-07-031-20/+36
| | | | | | | | | | | | | | | | | | | This commit closes issue #3698, at least for now, since the root cause was not fixed: the bounding box function, for huge radiuses, does not return a correct bounding box, there are points still within the radius that are left outside. So when using GEORADIUS queries with radiuses in the order of 5000 km or more, it was possible to see, at the edge of the area, certain points not correctly reported. Because the bounding box for now was used just as an optimization, and such huge radiuses are not common, for now the optimization is just switched off when the radius is near such magnitude. Three test cases found by the Continuous Integration test were added, so that we can easily trigger the bug again, both for regression testing and in order to properly fix it as some point in the future.
* Geo: fix computation of bounding box.antirez2016-12-051-43/+9
| | | | | | | | | | | A bug was reported in the context in issue #3631. The root cause of the bug was that certain neighbor boxes were zeroed after the "inside the bounding box or not" check, simply because the bounding box computation function was wrong. A few debugging infos where enhanced and moved in other parts of the code. A check to avoid steps=0 was added, but is unrelated to this issue and I did not verified it was an actual bug in practice.
* Multiple GEORADIUS bugs fixed.antirez2016-07-271-15/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove dead code from geohash_helper.c.antirez2016-07-061-6/+0
| | | | | The function removed also had potential bugs related to signess of the expression, and is not used anyway.
* Fix signess issue in geohashEstimateStepsByRadius().antirez2016-07-061-1/+2
|
* Fix definition of M_PI in geohash_helper.c.antirez2016-07-061-0/+2
| | | | Without the right feature macros M_PI is not defined in math.h.
* geohash.c and geohash_helper.c are part of Redis.antirez2016-07-061-0/+197
They were under /deps since they originate from a different source tree, however at this point they are very modified and we took ownership of both the files making changes, fixing bugs, so there is no upgrade path from the original code tree. Given that, better to move the code under /src with proper dependencies and with a more simpler editing experience.