tile38/tests
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
..
107 cleanup / fix tests 2021-05-13 21:14:05 -04:00
616 Update expiration logic 2021-07-12 13:37:50 -07:00
README.md Fix nearby with match query invalid results 2019-03-01 06:55:26 -07:00
client_test.go Removed elapsed member for json testing 2019-05-28 09:22:15 -07:00
fence_roaming_test.go Fixed a missing faraway event for roaming geofences 2020-03-22 11:54:56 -07:00
fence_test.go enable fence tests 2020-11-03 14:56:31 -07:00
json_test.go Updated dependencies 2020-09-22 16:43:58 -07:00
keys_search_test.go Additional KNN test 2021-07-11 14:49:23 -07:00
keys_test.go Fix a bug in WHEREIN -- 0 values would always match, incorrectly. 2020-04-12 16:06:10 -07:00
metrics_test.go fix tests 2021-05-13 21:14:06 -04:00
mock_test.go Merge branch 'housecanary-fix-knn' 2021-07-11 10:02:59 -07:00
scripts_test.go Add distance_to function to the tile38 namespace in lua. 2019-01-04 14:57:00 -08:00
stats_test.go Testing for valid INFO and CLIENT Json output 2019-01-15 11:08:19 -07:00
testcmd_test.go go fmt 2021-05-13 21:12:49 -04:00
tests_test.go Merge branch 'housecanary-fix-knn' 2021-07-11 10:02:59 -07:00
timeout_test.go Rework timeouts to allow prepending any command with the TIMEOUT seconds 2019-04-25 14:15:53 -07:00

README.md

Tile38 Integation Testing

  • Uses Redis protocol
  • The Tile38 data is flushed before every DoBatch

A basic test operation looks something like:

func keys_SET_test(mc *mockServer) error {
	return mc.DoBatch([][]interface{}{
        {"SET", "fleet", "truck1", "POINT", 33.0001, -112.0001}, {"OK"},
        {"GET", "fleet", "truck1", "POINT"}, {"[33.0001 -112.0001]"},
    }
}

Using a custom function:

func keys_MATCH_test(mc *mockServer) error {
	return mc.DoBatch([][]interface{}{
        {"SET", "fleet", "truck1", "POINT", 33.0001, -112.0001}, {
            func(v interface{}) (resp, expect interface{}) {
                // v is the value as strings or slices of strings
                // test will pass as long as `resp` and `expect` are the same.
                return v, "OK"
            },
		},
    }
}