Commit Graph

24 Commits

Author SHA1 Message Date
tidwall 46927b476f Better TEST tests 2022-09-27 08:18:17 -07:00
tidwall 9c8e7e90e1 Clean up some tests 2022-09-23 17:54:49 -07:00
tidwall 5bcef43894 Better KEYS tests 2022-09-23 16:12:32 -07:00
tidwall 295a9c45a8 Better SET/PERSIST/TTL/STATS tests 2022-09-23 15:29:46 -07:00
tidwall 960c860b3a Better RENAME/RENAMENX tests 2022-09-23 11:18:01 -07:00
tidwall ede1ce0269 Better GET/DROP tests 2022-09-23 10:42:43 -07:00
tidwall db380a4fee Better DEL/PDEL/TYPE tests 2022-09-23 09:04:01 -07:00
tidwall ef95f04aca Better coverage BOUNDS 2022-09-23 07:51:05 -07:00
tidwall d5c148ca41 Field overhaul 2022-09-19 17:47:38 -07:00
tidwall 18438e5783 Use same input args for command functions 2021-09-13 10:52:20 -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 6b08f7fa9e Code cleanup
- Removed unused functions and variables
- Wrapped client formatted errors
- Updated deprecated packages
- Changed suggested code patterns
2021-03-31 08:13:44 -07:00
tidwall d819db5f8b Added MONITOR command
closes #571
2020-08-12 12:38:52 -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 87185319b2 Fix JSET cancels expiry
issue #498
2019-10-08 09:45:46 -07:00
Alex Roitman b9e2c67933 Fix lua pool pruning 2019-08-01 11:55:52 -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 49111a4dce Add timeouts for lua scripts 2019-04-24 17:00:52 -07:00
Parham Alvani e0ddd5e6a6 Adds Server command for lua scripts. 2019-02-17 13:28:20 +03:30
Alex Roitman c849ab19ac Implement test command 2019-02-08 13:57:29 -08:00
Alex Roitman 5e215c247d Add distance_to function to the tile38 namespace in lua.
distance_to(lat_a, lon_a, lat_b, lon_b) returns distance in meters between points A and B.
2019-01-04 14:57:00 -08:00
Alex Roitman 01a7dda2a1 Add RENAME and RENAMENX commands. 2018-12-27 17:15:53 -08:00
tidwall f2c217c216 Refactor and comment command details 2018-11-23 15:53:33 -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