From eb9066faeccc7ac7cef3ee1cc5a2ad3221b97333 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja@tarantool.org> Date: Tue, 27 Jun 2017 17:16:32 +0300 Subject: [PATCH] vinyl: update gh-2520 test case to the new statistics API --- test/vinyl/upsert.result | 39 +++++++++++++++++++++++++++++++------- test/vinyl/upsert.test.lua | 17 ++++++++++++----- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/test/vinyl/upsert.result b/test/vinyl/upsert.result index f6adff435e..27f6725164 100644 --- a/test/vinyl/upsert.result +++ b/test/vinyl/upsert.result @@ -697,7 +697,10 @@ s:select() --both upserts are ignored due to primary key change -- -- gh-2520 use cache as a hint when applying upserts. -- -old_stat = box.info.vinyl().performance["iterator"].run.lookup_count +old_stat = box.info.vinyl().performance +--- +... +old_disk_lookup_count = s.index.test:info().disk.iterator.lookup --- ... -- insert the first upsert @@ -715,16 +718,27 @@ s:get{100} - [100] ... -- a lookup in a run was done to populate the cache -new_stat = box.info.vinyl().performance["iterator"].run.lookup_count +new_stat = box.info.vinyl().performance --- ... -new_stat - old_stat +new_disk_lookup_count = s.index.test:info().disk.iterator.lookup --- -- 1 +... +upsert_stat_diff(new_stat, old_stat) +--- +- squashed: 0 + applied: 1 ... old_stat = new_stat --- ... +new_disk_lookup_count - old_disk_lookup_count +--- +- 1 +... +old_disk_lookup_count = new_disk_lookup_count +--- +... -- Add another upsert: the cached REPLACE will be used and the upsert will -- be applied immediately s:upsert({100}, {{'=', 2, 300}}) @@ -745,16 +759,27 @@ s:get{100} -- go no further than the latest dump to locate the latest -- value of the key -- -new_stat = box.info.vinyl().performance["iterator"].run.lookup_count +new_stat = box.info.vinyl().performance --- ... -new_stat - old_stat +new_disk_lookup_count = s.index.test:info().disk.iterator.lookup --- -- 1 +... +upsert_stat_diff(new_stat, old_stat) +--- +- squashed: 0 + applied: 0 ... old_stat = new_stat --- ... +new_disk_lookup_count - old_disk_lookup_count +--- +- 1 +... +old_disk_lookup_count = new_disk_lookup_count +--- +... s:drop() --- ... diff --git a/test/vinyl/upsert.test.lua b/test/vinyl/upsert.test.lua index a1a8cccfd0..5200402c7f 100644 --- a/test/vinyl/upsert.test.lua +++ b/test/vinyl/upsert.test.lua @@ -283,7 +283,8 @@ s:select() --both upserts are ignored due to primary key change -- -- gh-2520 use cache as a hint when applying upserts. -- -old_stat = box.info.vinyl().performance["iterator"].run.lookup_count +old_stat = box.info.vinyl().performance +old_disk_lookup_count = s.index.test:info().disk.iterator.lookup -- insert the first upsert s:upsert({100}, {{'=', 2, 200}}) -- force a dump, the inserted upsert is now on disk @@ -291,9 +292,12 @@ box.snapshot() -- populate the cache s:get{100} -- a lookup in a run was done to populate the cache -new_stat = box.info.vinyl().performance["iterator"].run.lookup_count -new_stat - old_stat +new_stat = box.info.vinyl().performance +new_disk_lookup_count = s.index.test:info().disk.iterator.lookup +upsert_stat_diff(new_stat, old_stat) old_stat = new_stat +new_disk_lookup_count - old_disk_lookup_count +old_disk_lookup_count = new_disk_lookup_count -- Add another upsert: the cached REPLACE will be used and the upsert will -- be applied immediately s:upsert({100}, {{'=', 2, 300}}) @@ -306,8 +310,11 @@ s:get{100} -- go no further than the latest dump to locate the latest -- value of the key -- -new_stat = box.info.vinyl().performance["iterator"].run.lookup_count -new_stat - old_stat +new_stat = box.info.vinyl().performance +new_disk_lookup_count = s.index.test:info().disk.iterator.lookup +upsert_stat_diff(new_stat, old_stat) old_stat = new_stat +new_disk_lookup_count - old_disk_lookup_count +old_disk_lookup_count = new_disk_lookup_count s:drop() -- GitLab