Commit Graph

34 Commits

Author SHA1 Message Date
tidwall 66af8ab094 Fix tile38-cli from freezing with non-quoted geojson
This commit addresses an issue that began on 1.19 where the
deprecated tile38 native line protocol was removed in favor of
the more robust resp protocol. In turn the tile38 cli required
that all args are quoteless or quote escaped.

The commit ensures that the server returns the correct error
message and also loosens the strictness of the need for quoted
arguments in the tile38-cli.

fixes #513
2019-12-11 11:08:33 -07:00
tidwall 23b016d192 Fix excessive memory usage for objects with TTLs
This commit fixes an issue where Tile38 was using lots of extra
memory to track objects that are marked to expire. This was
creating problems with applications that set big TTLs.

How it worked before:

Every collection had a unique hashmap that stores expiration
timestamps for every object in that collection. Along with
the hashmaps, there's also one big server-wide list that gets
appended every time a new SET+EX is performed.

From a background routine, this list is looped over at least
10 times per second and is randomly searched for potential
candidates that might need expiring. The routine then removes
those entries from the list and tests if the objects matching
the entries have actually expired. If so, these objects are
deleted them from the database. When at least 25% of
the 20 candidates are deleted the loop is immediately
continued, otherwise the loop backs off with a 100ms pause.

Why this was a problem.

The list grows one entry for every SET+EX. When TTLs are long,
like 24-hours or more, it would take at least that much time
before the entry is removed. So for databased that have objects
that use TTLs and are updated often this could lead to a very
large list.

How it was fixed.

The list was removed and the hashmap is now search randomly. This
required a new hashmap implementation, as the built-in Go map
does not provide an operation for randomly geting entries. The
chosen implementation is a robinhood-hash because it provides
open-addressing, which makes for simple random bucket selections.

Issue #502
2019-10-29 11:19:33 -07:00
tidwall 87185319b2 Fix JSET cancels expiry
issue #498
2019-10-08 09:45:46 -07:00
tidwall 639f6e2deb Replaced boxtree for rbang 2019-09-12 18:42:53 -07:00
tidwall 2571ce5106 Minimize AOF buffer releases 2019-09-03 17:01:26 -07:00
tidwall 3ae59274e3 Removed evio option 2019-04-26 11:50:49 -07:00
Alex Roitman cbf10b7472 Rework timeouts to allow prepending any command with the TIMEOUT seconds 2019-04-25 14:15:53 -07:00
Alex Roitman 31525487c3 Add timeout tests. Fix a bug. 2019-04-24 13:20:57 -07:00
Alex Roitman e514a0287f Add timeout subcommand to scan/search commands.
Use per-query timeout for those commands, if it was given.
2019-04-24 12:02:39 -07:00
tidwall 0aecef6a5c Added TIMEOUT command 2019-04-24 05:09:41 -07:00
tidwall 762607dc0a Added geofence delivery counter 2019-03-14 11:23:23 -07:00
tidwall 5333fab870 Recycle aof buffer 2019-03-10 10:48:14 -07:00
Josh Baker 6fffa75b58
Merge pull request #409 from rshura/test_cmd
Test command
2019-02-12 05:05:50 -07:00
tidwall 92c1ce8ef9 Update tinybtree dep 2019-02-11 13:39:29 -07:00
Alex Roitman c849ab19ac Implement test command 2019-02-08 13:57:29 -08:00
Steven Wolfe 79c902efbf Adding more replication data to INFO response 2019-01-18 14:51:20 -07:00
Steven Wolfe 4ad2e920f5 Merge branch 'sl/requirevalid' of https://github.com/stevelacy/tile38 into stevelacy-sl/requirevalid 2019-01-10 12:49:48 -07:00
Steve Lacy 1a8993feaf
Add RequireValid env variable and parse options 2019-01-10 09:36:58 -07:00
Alex Roitman 01a7dda2a1 Add RENAME and RENAMENX commands. 2018-12-27 17:15:53 -08:00
tidwall 8b29e98359 Optimized spatial index for fences 2018-11-23 18:15:14 -07:00
tidwall f2c217c216 Refactor and comment command details 2018-11-23 15:53:33 -07:00
tidwall 8906d8e65a Refactor and consolidate variables 2018-11-23 02:14:26 -07:00
tidwall 37531f9350 Removed unused atomics 2018-11-23 01:39:04 -07:00
tidwall 669823950a Fix script load issue 2018-11-20 10:25:48 -08:00
tidwall 737561fa8b Fix version not being set at build, close #386 2018-11-15 13:45:55 -07:00
tidwall 6616b86eda Default numloops to number goprocs 2018-11-11 09:29:07 -07:00
tidwall 7cc9154eb8 Correct threads equals cpu 2018-11-11 09:05:26 -07:00
tidwall d065b979da net prewrite optimization 2018-11-11 09:05:26 -07:00
tidwall 464c193d73 Prewrite optimization flag 2018-11-11 09:05:26 -07:00
tidwall 3bf91077d9 Hang on to lower command 2018-11-11 09:05:26 -07:00
tidwall 161c6faff9 Added evio flag 2018-11-11 09:03:47 -07:00
tidwall 933f243c6c Code cleanup 2018-11-11 09:03:47 -07:00
tidwall 555e47036c Replaced net package with evio
- Added threads startup flag
- Replaced net package with evio
- Refactored controller into server
2018-10-28 15:51:47 -07:00
tidwall 6257ddba78 Faster point in polygon / GeoJSON updates
The big change is that the GeoJSON package has been completely
rewritten to fix a few of geometry calculation bugs, increase
performance, and to better follow the GeoJSON spec RFC 7946.

GeoJSON updates

- A LineString now requires at least two points.
- All json members, even foreign, now persist with the object.
- The bbox member persists too but is no longer used for geometry
  calculations. This is change in behavior. Previously Tile38 would
  treat the bbox as the object's physical rectangle.
- Corrections to geometry intersects and within calculations.

Faster spatial queries

- The performance of Point-in-polygon and object intersect operations
  are greatly improved for complex polygons and line strings. It went
  from O(n) to roughly O(log n).
- The same for all collection types with many children, including
  FeatureCollection, GeometryCollection, MultiPoint, MultiLineString,
  and MultiPolygon.

Codebase changes

- The pkg directory has been renamed to internal
- The GeoJSON internal package has been moved to a seperate repo at
  https://github.com/tidwall/geojson. It's now vendored.

Please look out for higher memory usage for datasets using complex
shapes. A complex shape is one that has 64 or more points. For these
shapes it's expected that there will be increase of least 54 bytes per
point.
2018-10-13 04:30:48 -07:00