Skip to content
Snippets Groups Projects
Commit da3d067b authored by Vladislav Shpilevoy's avatar Vladislav Shpilevoy Committed by Konstantin Osipov
Browse files

test: add test on upserts not used cache

When an UPSERT is prepared, it can use a cached statement to be
turned into REPLACE. But now it doesn't use the cache.

Test for #2520
parent 43bc7c4d
No related branches found
No related tags found
No related merge requests found
......@@ -673,7 +673,7 @@ space:drop()
s = box.schema.space.create('test', {engine = 'vinyl'})
---
...
i = s:create_index('test')
i = s:create_index('test', { run_count_per_level = 20 })
---
...
s:replace({1, 1})
......@@ -694,6 +694,56 @@ s:select() --both upserts are ignored due to primary key change
---
- - [1, 1]
...
-- gh-2520 use cache as a hint for upserts applying.
old_stat = box.info.vinyl().performance["iterator"].run.lookup_count
---
...
s:upsert({100}, {{'=', 2, 200}})
---
...
box.snapshot()
---
- ok
...
s:get{100}
---
- [100]
...
new_stat = box.info.vinyl().performance["iterator"].run.lookup_count
---
...
new_stat - old_stat
---
- 1
...
old_stat = new_stat
---
...
box.snapshot()
---
- ok
...
s:upsert({100}, {{'=', 2, 300}})
---
...
box.snapshot()
---
- ok
...
s:get{100}
---
- [100, 300]
...
new_stat = box.info.vinyl().performance["iterator"].run.lookup_count
---
...
new_stat - old_stat
---
- 2
...
old_stat = new_stat
---
...
s:drop()
---
...
......@@ -272,7 +272,7 @@ space:drop()
-- fix behaviour after https://github.com/tarantool/tarantool/issues/2104
s = box.schema.space.create('test', {engine = 'vinyl'})
i = s:create_index('test')
i = s:create_index('test', { run_count_per_level = 20 })
s:replace({1, 1})
box.snapshot()
......@@ -280,4 +280,20 @@ 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.
old_stat = box.info.vinyl().performance["iterator"].run.lookup_count
s:upsert({100}, {{'=', 2, 200}})
box.snapshot()
s:get{100}
new_stat = box.info.vinyl().performance["iterator"].run.lookup_count
new_stat - old_stat
old_stat = new_stat
box.snapshot()
s:upsert({100}, {{'=', 2, 300}})
box.snapshot()
s:get{100}
new_stat = box.info.vinyl().performance["iterator"].run.lookup_count
new_stat - old_stat
old_stat = new_stat
s:drop()
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