diff --git a/test/vinyl/upsert.result b/test/vinyl/upsert.result index 0d11b71db4fb652d4ec7c68d93891c47fc8602ea..f6adff435ebf4ad2b6a34062a4b5d8aacd249360 100644 --- a/test/vinyl/upsert.result +++ b/test/vinyl/upsert.result @@ -694,21 +694,27 @@ s:select() --both upserts are ignored due to primary key change --- - - [1, 1] ... --- gh-2520 use cache as a hint for upserts applying. +-- +-- gh-2520 use cache as a hint when applying upserts. +-- old_stat = box.info.vinyl().performance["iterator"].run.lookup_count --- ... +-- insert the first upsert s:upsert({100}, {{'=', 2, 200}}) --- ... +-- force a dump, the inserted upsert is now on disk box.snapshot() --- - ok ... +-- populate the cache 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 --- ... @@ -719,21 +725,26 @@ new_stat - old_stat old_stat = new_stat --- ... -box.snapshot() ---- -- ok -... +-- Add another upsert: the cached REPLACE will be used and the upsert will +-- be applied immediately s:upsert({100}, {{'=', 2, 300}}) --- ... +-- force a new dump box.snapshot() --- - ok ... +-- lookup the key s:get{100} --- - [100, 300] ... +-- +-- since we converted upsert to replace on insert, we had to +-- 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 --- ... diff --git a/test/vinyl/upsert.test.lua b/test/vinyl/upsert.test.lua index 1a73be48dabdd77619a6cd22a16425776d6dabb3..a1a8cccfd0f568a8db0c80ddbb9b76cbc5cbbe6c 100644 --- a/test/vinyl/upsert.test.lua +++ b/test/vinyl/upsert.test.lua @@ -280,18 +280,32 @@ s:upsert({1, 1}, {{'+', 1, 1}}) s:upsert({1, 1}, {{'+', 2, 1}}) s:select() --both upserts are ignored due to primary key change --- gh-2520 use cache as a hint for upserts applying. +-- +-- gh-2520 use cache as a hint when applying upserts. +-- old_stat = box.info.vinyl().performance["iterator"].run.lookup_count +-- insert the first upsert s:upsert({100}, {{'=', 2, 200}}) +-- force a dump, the inserted upsert is now on disk 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 old_stat = new_stat -box.snapshot() +-- Add another upsert: the cached REPLACE will be used and the upsert will +-- be applied immediately s:upsert({100}, {{'=', 2, 300}}) +-- force a new dump box.snapshot() +-- lookup the key s:get{100} +-- +-- since we converted upsert to replace on insert, we had to +-- 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 old_stat = new_stat