Commit Graph

229 Commits

Author SHA1 Message Date
tidwall a737a78d6f Add unix socket support 2021-09-07 05:51:15 -07:00
tidwall fc4a627aa6 Use struct for server options 2021-09-06 08:55:13 -07:00
tidwall c8389fe52c Fix memory leak with group id
This commit fixes a memory leak that was being caused by hooks
hanging on to the geofence group ids past the life of the object.
2021-08-20 05:00:14 -07:00
Josh Baker 148d581dcf
Merge pull request #620 from iwpnd/master
kafka authentication methods
2021-08-04 14:31:04 -07:00
Benjamin Ramser 9ee91ca5c3 refactor: kafka auth 2021-08-03 14:46:40 +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 dd4d31ae1b Fix last merge 2021-07-11 10:09:51 -07:00
tidwall 579a41abae Merge branch 'housecanary-fix-knn' 2021-07-11 10:02:59 -07:00
tidwall 991963268a Fix last merge 2021-07-10 19:32:21 -07:00
tidwall f2bbf10c36 Merge branch 'mpoindexter-optimize-field-value-access' 2021-07-10 19:26:29 -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
tidwall d2f747933f clear linter messages 2021-07-10 03:59:27 -07:00
Josh d3d4694691
Merge pull request #504 from tidwall/nats-tls
Added TLS support for Nats webhook provider
2021-07-08 07:42:54 -07:00
tidwall e60cbac7cf Merge distance updates 2021-07-08 07:03:36 -07:00
tidwall aea7d77de5 Fix Memory Leak in Kafka Producer
This commit addresses an issue where the sarama kafka library
leaks memory when a connection closes unless the metrics
configuration that was passed to new connection is also closed.

Fixes #613
2021-07-08 06:46:58 -07:00
tidwall 1497663b6d Close follower files before finishing aofshrink
fixes #449
2021-07-08 06:46:58 -07:00
Benjamin Ramser bb2253204c Add option to select sha function 2021-07-08 06:46:57 -07:00
Benjamin Ramser 6dfcf896d4 Leave ClientID default untouched 2021-07-08 06:46:57 -07:00
Benjamin Ramser e4b03ca174 Add endpoint option for sasl 2021-07-08 06:46:57 -07:00
Mathieu 55e503c378 Add sasl 2021-07-08 06:46:57 -07:00
tidwall f067e3ba67 Fix invalid healthz output 2021-07-08 06:46:57 -07:00
tidwall 87702b3e29 Always OK for leader 2021-07-08 06:46:57 -07:00
tidwall 5a37198602 Added HEALTHZ command
Returns 'ok' if the server is the leader or a follower with
a 'caught up' log.

This is mainly for HTTP connections that are using an
orchestration environment like kubernetes, but will work as a
general RESP command.

For HTTP a '200 OK' for 'caught up' and
'500 Internal Server Error' otherwise.

See #608
2021-07-08 06:46:57 -07:00
Oliver fc0ff42297 add more metrics, add metrics index page 2021-07-08 06:46:57 -07:00
Oliver f448599e72 cleanup / fix tests 2021-07-08 06:46:57 -07:00
Oliver a233aaa66e don't rely on stats code for new metrics if we can avoid it 2021-07-08 06:46:57 -07:00
tidwall 5b3aeb5db7 add prometheus metrics endpoint 2021-07-08 06:46:52 -07:00
tidwall 0b8254e7c2 Change 255 to 256 2021-07-08 06:46:13 -07:00
tidwall 5cf6c4e9f4 Add comment 2021-07-08 06:46:13 -07:00
tidwall b5691f7dd5 Allow for all command types for roaming event
Prior to this commit roaming geofences only registered changes to
the SET command. Now it will work for SET/DEL/FSET, just like
non-roaming geofences.

To opt out of these events, explicitly choose which event you
would like to register when you create the geofences.

For example:

  NEARBY fleet FENCE COMMANDS set,del ROAM fleet * 5000

Will only fire off events from SET and DEL command.

Closes #597
2021-07-08 06:46:13 -07:00
tidwall 6bb9f8f54c Remove deprecated function
Go recommends not calling BuildNameToCertificate and to allow
for the names to be selected automatically.
2021-07-08 06:46:12 -07:00
tidwall 58221adccb Code cleanup
- Removed unused functions and variables
- Wrapped client formatted errors
- Updated deprecated packages
- Changed suggested code patterns
2021-07-08 06:46:08 -07:00
tidwall 6a55c8de8f fix: distance if point and object have the same coordinates 2021-07-08 06:45:31 -07:00
tidwall 901919c4e3 Include "distance" to output when user specifically requests
fixes #599
2021-07-08 06:36:45 -07:00
Benjamin Ramser 8234f6dc6d refactor: dont set client id 2021-07-08 06:36:10 -07:00
tidwall b64c87004f Expose log output writer 2021-07-08 06:36:10 -07:00
Benjamin Ramser 248c3d8b72 add kafka tls config
fix endpoint, add logging to tlsconfig creation

add logging if log.Level > 2
2021-07-08 06:36:10 -07:00
tidwall 60678020fa Updated dependencies 2021-07-08 06:36:10 -07:00
tidwall 094d35757c Various updates
- Updated all dependencies
- Updated geoindex Box api
2021-07-08 06:36:05 -07:00
tidwall f44bae43ca Replace tinybtree 2021-07-08 06:35:15 -07:00
tidwall 67f443dbbd Fixed fields being shuffled after AOFSHRINK 2021-07-08 06:35:06 -07:00
tidwall 07dc10262a Added ENV var for 500 http errors 2021-07-08 06:35:06 -07:00
tidwall 076cd4b009 Updated btree deps 2021-07-08 06:35:01 -07:00
tidwall 9d9c2b9aeb Optimization for non-cross geofence detection
This commit fixes a performance issue with the algorithm that
determines with geofences are potential candidates for
notifications following a SET operation.

Details

Prior to commit b471873 (10 commits ago) there was a bug where
the "cross" detection was not firing in all cases. This happened
because when looking for candidates for "cross" due to a SET
operation, only the geofences that overlapped the previous
position of the object and the geofences that overlapped the new
position where searched. But, in fac, all of the geofences that
overlapped the union rectangle of the old and new position should
have been searched.

That commit fixed the problem by searching a union rect of the
old and new positions. While this is an accurate solution, it
caused a slowdown on systems that have big/wild position changes
that might cross a huge number of geofences, even when those
geofences did not need actually need "cross" detection.

The fix

With this commit the geofences that have a "cross" detection
are stored in a seperated tree from those that do not. This
allows for a hybrid of the functionality prior and post b471873.

Fixes #583
2021-07-08 06:34:47 -07:00
tidwall 2eb6da5f21 Truncate trailing zeros from AOF at startup
This commit addresses issue #230, where an AOF file will sometimes
not load due to the file being padded with trailing zeros. It's
uncertain what is causing this corruption, but it appears to be
coming from outside of the tile38-server process. I suspect it's
due to some block store layer in Kubernetes/Docker cloud
environments.

This fix allows for Tile38 to start up by discovering the trailing
zeros while loading the AOF and safely truncating the file as to
not include the zeros in the future.
2021-07-08 06:34:47 -07:00
tidwall 6aab7ee309 Fix "cross" detection on firing in some cases
Fixes #578
2021-07-08 06:34:15 -07:00
tidwall 3d7242d06c Added MONITOR command
closes #571
2021-07-08 06:34:15 -07:00