152 Commits

Author SHA1 Message Date
tidwall
7fa2dc4419 Better FSET tests
Execute oom check immediately after setting maxmemory
2022-09-23 12:42:39 -07:00
tidwall
d7ad01e593 Better FLUSHDB/EXPIRES tests 2022-09-23 11:40:48 -07:00
tidwall
960c860b3a Better RENAME/RENAMENX tests 2022-09-23 11:18:01 -07:00
tidwall
ede1ce0269 Better GET/DROP tests 2022-09-23 10:42:43 -07:00
tidwall
db380a4fee Better DEL/PDEL/TYPE tests 2022-09-23 09:04:01 -07:00
tidwall
ef95f04aca Better coverage BOUNDS 2022-09-23 07:51:05 -07:00
tidwall
d61f0bc6c8 wip - better tests 2022-09-23 07:30:03 -07:00
tidwall
2c643996e7 Immutable Object type 2022-09-20 14:20:53 -07:00
tidwall
ba9a767988 Changed the collection rectangle dimension type
Previously used float64s, now using float32s.
Saving about 15% on rectangle memory.
Uses the Roundoff trick from Sqlite.
2022-09-19 17:51:14 -07:00
tidwall
d5c148ca41 Field overhaul 2022-09-19 17:47:38 -07:00
Benjamin Ramser
33e8e28a83 feat: add distance to NEARBY IDS response 2022-09-17 11:02:20 +02:00
tidwall
3011b6ec45 Upgrade geojson dependency 2022-09-14 08:14:29 -07:00
tidwall
498bbe23ff Updated btree and rtree
This commit updates to the latest btree and rtree.

The rtree algorithm has been modified in `tidwall/rtree@v1.7`
which now keeps internal and leaf rect sorted by the min-x
coordinate. This make for much faster (up to 50%) faster
searches and replacements, but slightly slower inserts.

Because of the R-tree update, the tests needed to be updated to
account for the change in order for undeterministic WITHIN and
INTERSECTS commands.
2022-09-11 14:31:00 -07:00
tidwall
f24c251ee6 Allow for multiple MATCH patterns
Each MATCH is inclusive OR, thus

    WITHIN fleet MATCH train* truck* BOUNDS 33 -112 34 -113

will find all trains and trucks that within the provides bounds.
2022-09-01 19:43:30 -07:00
tidwall
8e61f8163e Fix test on Apple silicon
The returned distance value for the kNN test was failing on a
Apple M1 machine. The test expected a hardcoded value.

amd64: 13053.885940801563
apple: 13053.885940801567

Not sure why the difference between the two cpus but I changed
the test to not compare for exact equality.
2022-06-16 16:02:37 -07:00
tidwall
241117c7ba Added BUFFER option for Within and Intersects
This commit allows for buffering any GeoJSON object.

For example:

    INTERSECTS fleet BUFFER 1000 OBJECT {...LineString...}

This will buffer add a 1 kilometer buffer to a linesting and
search the 'fleet' collection for all objects that
intersect the buffered linestring.

This commit also allows for performing INTERSECTS with a POINT
type. Thus allowing for a polygon-over-point operation, which is
an inverted point-in-polygon.
2021-12-09 18:14:50 -07:00
tidwall
f9e6f74753 Use struct for server options 2021-09-29 07:19:00 -07:00
Benjamin Ramser
c87fd4836e test: add more tests 2021-09-05 12:56:45 +02:00
Benjamin Ramser
6eb1cca78c fix: point -> circle fallthrough 2021-09-05 12:05:33 +02:00
Benjamin Ramser
bc62edb692 feat: add sector 2021-09-05 11:48:34 +02:00
tidwall
694ad1fb62 Update btree/buntdb 2021-07-31 07:42:58 -07:00
tidwall
401670e621 Fix NEARBY with SPARSE returning too many results
fixes #618
2021-07-22 08:39:57 -07:00
tidwall
9e68703841 Update expiration logic
This commit changes the logic for managing the expiration of
objects in the database.

Before: There was a server-wide hashmap that stored the
collection key, id, and expiration timestamp for all objects
that had a TTL. The hashmap was occasionally probed at 20
random positions, looking for objects that have expired. Those
expired objects were immediately deleted, and if there was 5
or more objects deleted, then the probe happened again, with
no delay. If the number of objects was less than 5 then the
there was a 1/10th of a second delay before the next probe.

Now: Rather than a server-wide hashmap, each collection has
its own ordered priority queue that stores objects with TTLs.
Rather than probing, there is a background routine that
executes every 1/10th of a second, which pops the expired
objects from the collection queues, and deletes them.

The collection/queue method is a more stable approach than
the hashmap/probing method. With probing, we can run into
major cache misses for some cases where there is wide
TTL duration, such as in the hours or days. This may cause
the system to occasionally fall behind, leaving should-be
expired objects in memory. Using a queue, there is no
cache misses, all objects that should be expired will be
right away, regardless of the TTL durations.

Fixes #616
2021-07-12 13:37:50 -07:00
tidwall
3c699183e0 Additional KNN test 2021-07-11 14:49:23 -07:00
tidwall
579a41abae Merge branch 'housecanary-fix-knn' 2021-07-11 10:02:59 -07:00
tidwall
0d83b1ca53 Merge branch 'rshura-optimize-field-match' 2021-07-10 17:59:22 -07:00
Josh
1467cba769
Merge pull request #552 from rshura/clip-by
Add CLIPBY subcommand to INTERSECTS/WITHIN
2021-07-10 09:24:57 -07:00
Oliver
56a0ad70c6 fix tests 2021-05-13 21:14:06 -04:00
Oliver
de055384f9 add tests 2021-05-13 21:14:06 -04:00
Oliver
6b0282d960 add more metrics, add metrics index page 2021-05-13 21:14:05 -04:00
Oliver
7ec4d58392 cleanup / fix tests 2021-05-13 21:14:05 -04:00
Oliver
c78415e26e go fmt 2021-05-13 21:12:49 -04:00
Benjamin Ramser
2a8b98778b fix: distance if point and object have the same coordinates 2021-03-19 09:42:38 +01:00
tidwall
4f4954020f enable fence tests 2020-11-03 14:56:31 -07:00
tidwall
4504ea75ac Updated Github Action files
Disabled some fence tests due to them hanging and
timing out in the Github Actions workflow, which is
something that did not happen with Travis CI.

I suspect that there's something up with Go routines
and or num of CPUs in the GH virtual environment.

Tests pass locally though
2020-11-03 14:36:07 -07:00
tidwall
100be7be3c Added tests 2020-10-23 09:50:51 -07:00
tidwall
b1dc463c41 Updated dependencies 2020-09-22 16:43:58 -07:00
Alex Roitman
25579a052c Fix a bug in WHEREIN -- 0 values would always match, incorrectly. 2020-04-12 16:06:10 -07:00
Mike Poindexter
fe6e3863ba Add bench tests for knn 2020-04-08 11:36:37 -07:00
Alex Roitman
34cb2affdc Add clipby subcommand to INTERSECTS/WITHIN 2020-04-03 16:49:06 -07:00
tidwall
ff48054d3d Fixed a missing faraway event for roaming geofences
This commit fixes a case where a roaming geofence will not fire
a "faraway" event when it's supposed to.

The fix required rewriting the nearby/faraway detection logic. It
is now much more accurate and takes overall less memory, but it's
also a little slower per operation because each object proximity
is checked twice per update. Once to compare the old object's
surrounding, and once to evaulated the new object. The two lists
are then used to generate accurate "nearby" and "faraway" results.
2020-03-22 11:54:56 -07:00
Josh Baker
90c2474e3d
Merge pull request #501 from JordanArmstrong/strict-jset-numbers
Strictly check if values passed to JSET are numbers
2019-10-29 15:28:40 -07:00
Josh Baker
df477bf3f4
Merge pull request #464 from rshura/area-expression
Add area expressions.
2019-10-28 13:45:10 -07:00
Jordan Armstrong
41fb410e2e Strictly check if values to JSET are numbers
Fixes #493
2019-10-26 23:37:48 -03:00
tidwall
f7888c1edf Fixed malformed json for chans command
Mentioned by ds2xor on Slack
2019-08-03 10:10:28 -07:00
Alex Roitman
dd09ffbe13 Fix parser for multiple negations. 2019-06-14 10:02:26 -07:00
Alex Roitman
2d83e18934 Add expression errors test. Make parser stricter. 2019-06-13 13:10:47 -07:00
Alex Roitman
0c3a5d02ca Fixes 2019-06-13 12:04:04 -07:00
Alex Roitman
496ace25d3 Refactoring/cleanup/fixes. 2019-06-11 17:13:33 -07:00
Alex Roitman
d0ca579f5c Add area expressions.
Add parser.
Hook up to test command.
Add tests for expressions in test command.
2019-06-10 14:47:42 -07:00