[patches] [PATCH 1/1] test: ensure the vy_cache_iterator stops on not existing keys

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Mon Feb 12 23:03:18 MSK 2018


Closes #2789

Signed-off-by: Vladislav Shpilevoy <v.shpilevoy at tarantool.org>
---
 test/vinyl/cache.result   | 70 +++++++++++++++++++++++++++++++++++++++++++++++
 test/vinyl/cache.test.lua | 24 ++++++++++++++++
 2 files changed, 94 insertions(+)

diff --git a/test/vinyl/cache.result b/test/vinyl/cache.result
index 576c949b0..117eff052 100644
--- a/test/vinyl/cache.result
+++ b/test/vinyl/cache.result
@@ -942,3 +942,73 @@ sk:select('key1')
 s:drop()
 ---
 ...
+--
+-- gh-2789: vy_cache_iterator must stop iteration, if a sought
+-- statement does not exist and is between chained statements.
+--
+s = box.schema.create_space('test', {engine = 'vinyl'})
+---
+...
+pk = s:create_index('pk')
+---
+...
+s:replace{1}
+---
+- [1]
+...
+s:replace{2}
+---
+- [2]
+...
+s:replace{4}
+---
+- [4]
+...
+s:replace{5}
+---
+- [5]
+...
+box.snapshot()
+---
+- ok
+...
+-- Cache is not updated in autocommit mode.
+box.begin() s:select{} box.commit()
+---
+...
+info = pk:info().cache
+---
+...
+info.lookup
+---
+- 1
+...
+info.get.rows
+---
+- 0
+...
+pk:info().disk.iterator.lookup
+---
+- 1
+...
+s:get{3}
+---
+...
+info = pk:info().cache
+---
+...
+info.lookup
+---
+- 2
+...
+info.get.rows
+---
+- 0
+...
+pk:info().disk.iterator.lookup
+---
+- 1
+...
+s:drop()
+---
+...
diff --git a/test/vinyl/cache.test.lua b/test/vinyl/cache.test.lua
index 19693bf92..9478a442e 100644
--- a/test/vinyl/cache.test.lua
+++ b/test/vinyl/cache.test.lua
@@ -334,3 +334,27 @@ sk:select('key2')
 s:insert{5, 'key1'}
 sk:select('key1')
 s:drop()
+
+--
+-- gh-2789: vy_cache_iterator must stop iteration, if a sought
+-- statement does not exist and is between chained statements.
+--
+s = box.schema.create_space('test', {engine = 'vinyl'})
+pk = s:create_index('pk')
+s:replace{1}
+s:replace{2}
+s:replace{4}
+s:replace{5}
+box.snapshot()
+-- Cache is not updated in autocommit mode.
+box.begin() s:select{} box.commit()
+info = pk:info().cache
+info.lookup
+info.get.rows
+pk:info().disk.iterator.lookup
+s:get{3}
+info = pk:info().cache
+info.lookup
+info.get.rows
+pk:info().disk.iterator.lookup
+s:drop()
-- 
2.14.3 (Apple Git-98)




More information about the Tarantool-patches mailing list