Skip to content
Snippets Groups Projects
Commit 60c72e78 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

test: add comments to vinyl/upsert.test, remove an extra box.snapshot()

gh-2520: add comments explaining the test case for gh-2520 (upsert
caching).
parent d3a2e815
No related branches found
No related tags found
No related merge requests found
......@@ -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
---
...
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment