Commit Graph

251 Commits

Author SHA1 Message Date
tidwall a1cc8e6e46 Fix eof error for incomplete commands.
This commit fixes an issue where Tile38 will fail to start
because the AOF file contains a partially written command, which
is caused by the server not having enough disk space to complete
the previous write.

This was discovered and reported by a Theresa D on the Tile38
Slack channel.
2022-04-12 15:43:55 -07:00
tidwall fc39090e94 Workaround for lettuce handshake to work.
Issue #636
2022-03-10 12:44:40 -07:00
tidwall 10f85640c0 Added option to "not found" for DEL 2022-03-08 15:58:23 -07:00
tidwall b6833a2dba Auto assign server_id for bootstrapped config files.
This commit fixes an issue where the server may start up without
a "server_id" assigned, which in turn will cause a follower to
be unable to connect.

This issues is caused by including a pre-generated "data/config"
file that does not include the "server_id" field.
2022-01-04 05:13:16 -07:00
tidwall 517bc57e9c Ensure inlined logs
Move the LogJSON check into the log function so that the caller
function can be inlined. This is helpful for hot functions like
`log.Debug` where it's likely that the `-vv` flag is not set thus
the to avoid the extra function call.
2021-12-28 16:33:46 -07:00
Benjamin Ramser bd5f8ddccd fix: disable caller 2021-12-28 11:18:44 +01:00
Benjamin Ramser 407fd4c71c refactor: set log encoding early 2021-12-27 12:20:14 +01:00
Benjamin Ramser 20cc624918 feat: add option to cmd, add default config
feat: add zap logger

test: add additional

refactor: dont export logger, use set/get/build

fix: getter and benchmark

feat: extend server config with log configuration

fix: log config write

fix: log
2021-12-26 16:06:34 +01: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 29a6d05f3f Minor refactor 2021-12-09 09:24:26 -07:00
Simon Tuohy 4454995e06 Azure EventHub hook support 2021-10-15 15:22:41 +01:00
tidwall 9e552c3629 Allow some basic client commands before AOF data loads
This commit accepts incoming connections even before the AOF
dataset has been loaded into memory. Though only a very limited
command set is allowed.

Allowed commands:
  PING, ECHO, OUTPUT, QUIT

All other commands will return:
  LOADING Tile38 is loading the dataset in memory

This is useful for establishing connections for the purpose of
checking process and network state.
2021-10-01 17:18:07 -07:00
tidwall a3c808e97f Increase verbosity for warning messages 2021-10-01 07:45:37 -07:00
tidwall 6174c6434d Fix aofshrink panic
fixes #624
2021-09-29 11:15:53 -07:00
tidwall de59d23ac4 Fixed Z not matching on where clause Feature points.
This issues fixes an issue where a search command with a where
clause using the "z" field would not match correctly for point
that where contained inside a GeoJSON Feature type.

Tile38 now extracts the Z coordinate from Point and Feature/Point
types.

fixes #622
2021-09-29 07:19:00 -07:00
tidwall 19deea10c0 Use same input args for command functions 2021-09-29 07:19:00 -07:00
tidwall 7ff0d18868 Change hooks collection type from hashmap to btree
This commit changes the collection type that holds all of the
hooks from a hashmap to a btree. This allows for better
flexibility for operations that need to perform range searches
and scanning of the collection.
2021-09-29 07:19:00 -07:00
tidwall decafae2d7 Update hook expiration logic 2021-09-29 07:19:00 -07:00
tidwall 7e10a80319 Return hook ttl with HOOKS request 2021-09-29 07:19:00 -07:00
tidwall d38aed4d2b Increase the precision of TIMEOUT
This commit ensures that the TIMEOUT is always checked prior to
returning data to the client, and that the elapsed command time
cannot be greater than the timeout value.
2021-09-29 07:19:00 -07:00
tidwall 9b760ffdd5 Add unix socket support 2021-09-29 07:19:00 -07:00
tidwall f9e6f74753 Use struct for server options 2021-09-29 07:19:00 -07: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 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