Commit Graph

69 Commits

Author SHA1 Message Date
Josh Baker 11b42c020b Add flags to disable AOF or to use a custom path
New server flags:
  --appendonly     yes/no
  --appendfilename path

Please note that leaders that have disabled AOF cannot be followed.
2018-04-11 10:53:36 -07:00
Josh Baker c62975b505 clear expires on reset, #258 2018-01-30 10:30:03 -07:00
Alex Roitman f572b14a2e Support script_load and script_flush as separate tokens too. 2017-10-12 16:57:28 -07:00
Alex Roitman bfa4bbe237 Lua (#225)
* Add periodic pruning of the lua state pool
2017-10-05 14:13:02 -07:00
Alex Roitman b55300b729 Lua scripting feature. (#224)
* Start on lua scripting

* Implement evalsha, script load, script exists, and script flush

* Type conversions from lua to resp/json.
Refactor to make luastate and luascripts persistent in the controller.

* Change controller.command and all underlying commands to return resp.Value.
Serialize only during the ouput.

* First stab at tile38 call from lua

* Change tile38 into tile38.call in Lua

* Property return errors from scripts

* Minor refactoring.  No locking on script run

* Cleanup/refactoring

* Create a pool of 5 lua states, allow for more as needed. Refactor.

* Use safe map for scripts.  Add a limit for max number of lua states.  Refactor.

* Refactor

* Refactor script commands into atomic, read-only, and non-atomic classes.
Proper locking for all three classes.
Add tests for scripts

* More tests for scripts

* Properly escape newlines in lua-produced errors

* Better test for readonly failure

* Correctly convert ok/err messages between lua and resp.
Add pcall, sha1hex, error_reply, status_reply functions to tile38 namespace in lua.

* Add pcall test. Change writeErr to work with string argument

* Make sure eval/evalsha never attempt to write AOF

* Add eval-set and eval-get to benchmarks

* Fix eval benchmark tests, add more

* Improve benchmarks

* Optimizations and refactoring.

* Add lua memtest

* Typo

* Add dependency

* golint fixes

* gofmt fixes

* Add scripting commands to the core/commands.json

* Use ARGV for args inside lua
2017-10-05 08:20:40 -07:00
Josh Baker d817814200 Optimized pipelining
Performance gains for pipelining commands over the network.
Using tile38-benchmark and the -P flag it's possible to see 2x-10x boost
in requests per second.
2017-09-30 19:34:25 -07:00
Josh Baker 1780badf1b isolated expires list mutex 2017-09-30 11:06:10 -07:00
Josh Baker a99613fe23 removed locks from memory bg operations 2017-09-30 08:16:34 -07:00
Josh Baker 4a3800596e added dev sleep command 2017-09-30 08:11:10 -07:00
Josh Baker 770c6ad322 atomic clients 2017-09-30 08:00:29 -07:00
Josh Baker 0db57db1f1 moved follow counter to atomic 2017-09-30 07:34:08 -07:00
Josh Baker 920dc3adb6 atomic ints/bools 2017-09-30 07:29:03 -07:00
Josh Baker 99307da6ea isolated config locks 2017-09-30 06:56:52 -07:00
Josh Baker d8f11354df wip config 2017-09-29 18:11:05 -07:00
Josh Baker cb062bded4 allow reads on disconnected followers (#121) 2017-08-04 05:28:35 -07:00
Josh Baker 1ccaf71375 add echo command (#201) 2017-07-27 09:10:33 -07:00
Josh Baker f9fa48db21 use redis-style expires
Updated the Tile38 expires to match the Redis implmentation at
https://redis.io/commands/expire#how-redis-expires-keys.

It now supports passive and active expires with sub-millisecond
accuracy.

This addresses issue #156
2017-03-29 12:50:04 -07:00
Josh Baker 56e0bac24c TCP Keepalives
Enabled TCP keepalive packets to determine if the connection is still
valid, and terminate if needed. It also helps with maintaining idle
connections.

Default to 300 seconds and can be changed by:

    CONFIG SET keepalive 300

addresses #145: clients not being cleaned up properly
2017-02-09 10:01:59 -07:00
Josh Baker 49e1fcce7a Added CLIENT command
CLIENT LIST
CLIENT SETNAME name
CLIENT GETNAME
CLIENT KILL [ip:port] [ID client-id] [ADDR ip:port]

The CLIENT LIST command returns

  One client connection per line (separated by LF)
  Each line is composed of a succession of property=value
  fields separated by a space character.

  id: an unique 64-bit client ID
  addr: address/port of the clien
  age: total duration of the connection in seconds
  idle: idle time of the connection in seconds
  name: the name of the client

Suggested by @UriHendler, closes #139
2017-01-30 11:35:42 -07:00
Josh Baker 6b92d923d8 added debug log 2017-01-21 17:10:43 -07:00
w1n2k 69b62e97e3 Lock refactoring 2017-01-20 12:09:39 +03:00
w1n2k f0fb28c68d Implemented hot swap of autogc 2017-01-19 19:00:14 +03:00
w1n2k e65e5842f4 Implementing autogc configuration support 2017-01-19 11:23:42 +03:00
Josh Baker cadf6cb851 Added http-transport to SERVER call
* fixed index out of range error when --http-transport provided
  without value.
2017-01-13 08:53:01 -07:00
Pavel Makarenko a4e5d38461 Disable HTTP & WebSocket transports on demand. (#128)
* Added .idea folder into .gitignore

* Added --http-transport flag

* Fixed test & Removed some dumps

* Added support of yes/no
2017-01-13 08:45:28 -07:00
Josh Baker c02609ad44 Fixed missing response in TTL json command
Using the tile38-cli, the TTL command omitted the ttl value from the
json response.

For example:

    127.0.0.1:9851> TTL my ufo
    {"ok":true,"elapsed":"5.57µs"}

Is now fixed to show
    127.0.0.1:9851> TTL my ufo
    {"ok":true,"ttl":-1,"elapsed":"5.57µs"}

Where "ttl" is the remaining time before the object is is deleted.
The value -1 means that the object is available, but does not have
an expiration.

Thanks @phulst for finding this bug. closes #116
2017-01-07 09:27:36 -07:00
Josh Baker 73fd3cf7de Added PDEL command
PDEL key pattern

Removes all objects where the id matches the pattern

Thanks to @GameFreedom for the suggestion. closes #104
2016-12-29 07:53:01 -07:00
Josh Baker 5d378b8ec9 debug.FreeOSMemory 2016-12-22 14:52:37 -07:00
Josh Baker 44cf149325 added JSET, JGET, JDEL commands
JSET key id path value [RAW]
JGET key id path [RAW]
JDEL key id path

Allows for working with JSON strings, for example:

  JSET user 901 name Tom
  JGET user 901
  > '{"name":"Tom"}'
  JSET user 901 name.first Tom
  JSET user 901 name.last Anderson
  > '{"name":{"first":"Tom","last":"Anderson"}'
  JDEL user 901 name.last
  > '{"name":{"first":"Tom"}'

All commands use the GJSON path syntax, for more information:

  Setting JSON: https://github.com/tidwall/sjson
  Getting JSON: https://github.com/tidwall/gjson
2016-12-12 10:33:28 -07:00
Josh Baker 0afdf67c90 fix to aof corruption during aofshrink command.
This addresses an issue #73 that @huangpeizhi discovered while using
Tile38 in production where AOFSHRINK sometimes corrupts the database
causing the server to not start the next time.
2016-12-05 16:24:26 -07:00
Josh Baker 3b99a6276e grpc support 2016-09-11 21:25:09 -07:00
Josh Baker 89cfedeb08 added PDELHOOKS 2016-09-11 19:28:54 -07:00
Josh Baker a0872036d4 persistent endpoints 2016-09-11 19:28:54 -07:00
Josh Baker 3862f70cac refactor hooks and endpoints 2016-09-11 19:28:34 -07:00
Josh Baker 6d944ada32 fixed #49. fragmented pipeline requests. 2016-09-08 16:11:53 -07:00
Josh Baker adef76af22 type command 2016-08-26 13:42:52 -07:00
Josh Baker c81883a629 info command 2016-08-26 12:54:19 -07:00
Josh Baker c68e60ed2f write http response as three chunks 2016-08-26 07:35:19 -07:00
Josh Baker b73cc35749 fixed http response charset 2016-08-26 07:31:09 -07:00
Josh Baker 7b8c2dae85 http auth fixes #36 2016-08-25 05:25:20 -07:00
Josh Baker 1d427c849f Added BOUNDS command
It's now possible to get the combined minimum bounding rectangle for all
objects in a key by issuing the command "BOUNDS key".
2016-08-19 08:33:58 -07:00
Josh Baker 7455c52cb5 expires 2016-07-15 12:22:48 -07:00
Josh Baker b08c686c64 SEARCH command 2016-07-12 21:11:02 -06:00
Josh Baker 02ff2a70bf basic string support 2016-07-10 22:40:18 -06:00
Josh Baker 8d89198eaf wip. adding string value type. 2016-07-09 19:44:28 -07:00
Josh Baker 13626db762 added maxmemory setting fixes #15 2016-05-23 19:44:25 -07:00
Josh Baker 6b9468d01b lint cleanup 2016-04-02 19:16:36 -07:00
Josh Baker a3725c7a2a async hooks 2016-04-02 07:20:30 -07:00
Josh Baker cdc2bbee73 fence detect option 2016-04-01 12:46:39 -07:00
Josh Baker d9103d9dd6 kill aof conns after shrink 2016-03-31 18:20:42 -07:00