From a07770a3df067c1e129d224257c6d34202806f70 Mon Sep 17 00:00:00 2001 From: martinsumner Date: Sat, 11 Mar 2017 00:03:55 +0000 Subject: [PATCH] Unit tets of lookup over-size issue A mistake meant resetting to lookup on a skipped key would cause issues if the skipped key ocurred under a no_lookup slot after the ?SLOT_SIZE had been reached. This caused the slot to switch to lookup, but beyond the maximum size --- src/leveled_sst.erl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/leveled_sst.erl b/src/leveled_sst.erl index d398937..4914f40 100644 --- a/src/leveled_sst.erl +++ b/src/leveled_sst.erl @@ -1334,6 +1334,18 @@ generate_indexkeys(Count, IndexList) -> generate_indexkeys(Count - 1, IndexList ++ Changes). +form_slot_test() -> + % If a skip key happens, mustn't switch to loookup by accident as could be + % over the expected size + SkippingKV = {{o, "B1", "K9999", null}, {9999, tomb, 1234567, {}}}, + Slot = [{{o, "B1", "K5", null}, {5, active, 99234567, {}}}], + R1 = form_slot([SkippingKV], [], + {true, 99999999}, + no_lookup, + ?SLOT_SIZE + 1, + Slot), + ?assertMatch({[], [], {no_lookup, Slot}}, R1). + indexed_list_test() -> io:format(user, "~nIndexed list timing test:~n", []), N = 150,