Commit Graph

1268 Commits

Author SHA1 Message Date
tidwall 813772f2c6 1.19.0 2019-11-02 15:36:08 -07:00
Josh Baker c7b4712c4e
Merge pull request #505 from tidwall/travis-go-1.13
Update travis-ci to Go 1.13
2019-11-02 15:34:04 -07:00
tidwall d675758e58 Update travis-ci to Go 1.13 2019-11-02 15:28:47 -07:00
tidwall c084aeedc2 Code cleanup
This commit cleans up various Go code in the internal directory.
- Ensures comments on exported functions
- Changes all *Server receiver in all files to be "s", instead
  of mixed "c", "s", "server", etc.
- Silenced Go warnings for if/else with returns.
- Cleaned up import ordering.
2019-10-30 10:17:59 -07:00
tidwall feba00040e Added TLS support for Nats webhook provider
Use the `tls=1` and the set the the `tlscert` and `tlskey` query
string params. The cert and key files must be on the tile38
server and the Nats server must be started using the same files.

nats://54.12.34.121:4222/fleet?tls=1&tlscert=cert.crt&tlskey=cert.key
2019-10-30 08:17:40 -07:00
Josh Baker 981d9ece42
Merge pull request #503 from JordanArmstrong/fix-stats-cpu
Fix fprintf type error in stats_cpu.go for non-linux/darwin builds
2019-10-29 15:29:38 -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
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
Jordan Armstrong 324b3b06d9 Fix go vet error in stats_cpu.go for non-linux/darwin builds 2019-10-28 22:39:27 -03:00
Jordan Armstrong e0eca0d55e Replace isJsonNumber with version from gjson 2019-10-28 22:35:44 -03:00
Josh Baker df477bf3f4
Merge pull request #464 from rshura/area-expression
Add area expressions.
2019-10-28 13:45:10 -07:00
tidwall f9ea3f1e13 Fixed tile38-cli not propertly handling quotes
closes #500
2019-10-28 13:25:08 -07:00
tidwall 10f7bfc445 Fix invalid pubsub format for json output
This commit fixes a bug that causes bad formatting for geofence
notifications when a client's output is set to JSON.

closes #499
2019-10-28 12:51:44 -07:00
Jordan Armstrong 41fb410e2e Strictly check if values to JSET are numbers
Fixes #493
2019-10-26 23:37:48 -03:00
tidwall d2cfb87c89 1.18.0 2019-10-09 11:57:43 -07:00
tidwall b092cea0d2 Use WaitTimeout for MQTT 2019-10-08 11:13:18 -07:00
tidwall 6b2025ab0c Merge branch 'neterror-master' 2019-10-08 11:10:37 -07:00
tidwall 3d9915e055 Merge branch 'master' of https://github.com/neterror/tile38 into neterror-master 2019-10-08 11:10:16 -07:00
Plamen Todorov 6b82fd94eb randomize mqtt client id with math/rand
Cryptographic randomizer is not required for mqtt clientIds. They
should be unique only among currently selected clients.
2019-10-08 20:24:31 +03:00
tidwall 87185319b2 Fix JSET cancels expiry
issue #498
2019-10-08 09:45:46 -07:00
tidwall 13c206fe05 Fixed data race for hooks with ttls
issue #497
2019-10-08 09:26:55 -07:00
Plamen Todorov c3b9a689bb Use uuid as mqtt clientId
Use crypto/random to generate unique mqtt client id. The tile38 prefix
makes the connections easily identifiable in the mqtt broker logs.
2019-10-08 09:34:31 +03:00
Plamen Todorov fb2aef2ce6 MQTT clientId should be unique
Each mqtt hook establishes separate connection to the MQTT broker. If
their clientIds are all equal the MQTT broker will disconnect the clients - the
protocol does not allow 2 connected clients with the same name
2019-10-06 22:15:06 +03:00
tidwall 5abadd72a3 Updated geoindex 2019-09-19 11:30:49 -07:00
tidwall 639f6e2deb Replaced boxtree for rbang 2019-09-12 18:42:53 -07:00
tidwall 93cf63f1bd 1.17.6 2019-09-04 13:01:30 -07:00
tidwall 3d96b17258 GC pauses be gone 2019-09-04 12:47:30 -07:00
tidwall 2571ce5106 Minimize AOF buffer releases 2019-09-03 17:01:26 -07:00
tidwall 4bd6b4b838 Moved ReadMemStats into a background polling function
This will keep profile commands such as SERVER and STATS from
stopping the world.
2019-09-03 16:57:49 -07:00
tidwall e167e88e8f removed diag 2019-09-03 16:39:51 -07:00
tidwall b6884fce63 diagnostics 2019-09-03 16:35:42 -07:00
tidwall e6a2c163f4 1.17.5 2019-08-22 16:00:07 -07:00
tidwall aedd972516 Fixed invalid count for nearby queries
closes #489
2019-08-22 15:53:37 -07:00
tidwall 54f14d8b03 Updated gjson library 2019-08-15 06:08:38 -07:00
Josh Baker 42c3ec047e
Delete CONTRIBUTING.md 2019-08-11 17:35:26 -07:00
tidwall d663383bdc 1.17.4 2019-08-09 09:50:33 -07:00
Josh Baker 047d2dcbff
Merge pull request #486 from saltatory/master
Added RLock on connections map
2019-08-09 09:45:52 -07:00
saltatory ec5a5342a2 Added RLock on connections map 2019-08-09 08:48:23 -07:00
tidwall 815d7bc43d 1.17.3 2019-08-03 10:17:34 -07:00
tidwall f7888c1edf Fixed malformed json for chans command
Mentioned by ds2xor on Slack
2019-08-03 10:10:28 -07:00
Josh Baker 544c414972
Merge pull request #483 from rshura/lua-pool-prune-fix
Fix lua pool pruning
2019-08-01 16:53:04 -07:00
Alex Roitman b9e2c67933 Fix lua pool pruning 2019-08-01 11:55:52 -07:00
tidwall 6e98f52769 1.17.2 2019-06-28 10:47:25 -07:00
Josh Baker 0abaeca1c4
Merge pull request #472 from tidwall/updated-geojson
Updated geojson
2019-06-28 10:41:40 -07:00
tidwall 8c9f2f10bd Updated geojson version 2019-06-28 10:31:49 -07:00
tidwall 85b70e0d26 Updated geojson package 2019-06-28 10:01:12 -07:00
Alex Roitman dd09ffbe13 Fix parser for multiple negations. 2019-06-14 10:02:26 -07:00
Alex Roitman 7c541949b1 Unnecessary code. 2019-06-13 14:12:42 -07:00
Alex Roitman eb214cb889 Better naming and comments. 2019-06-13 13:33:07 -07:00
Alex Roitman 2d83e18934 Add expression errors test. Make parser stricter. 2019-06-13 13:10:47 -07:00