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

Add a scenario of old truncate implementation to the test suite. (gh-438)

parent 730631f2
No related branches found
No related tags found
No related merge requests found
......@@ -481,6 +481,40 @@ space:replace{1, 1}
space:drop()
---
...
-- test deletion of data one by one
space = box.schema.space.create('test')
---
...
space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true })
---
...
space:create_index('second', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true })
---
...
--# setopt delimiter ';'
for i = 1, 100 do
v = tostring(i)
space:insert{v, string.rep(v, 2) , string.rep(v, 3)}
end;
---
...
local pk = space.index[0]
while pk:len() > 0 do
local state, t
for state, t in pk:pairs() do
local key = {}
for _k2, parts in ipairs(pk.parts) do
table.insert(key, t[parts.fieldno])
end
space:delete(key)
end
end;
---
...
--# setopt delimiter ''
space:drop()
---
...
space = nil
---
...
......@@ -168,4 +168,27 @@ space:replace{1, 1}
space:drop()
-- test deletion of data one by one
space = box.schema.space.create('test')
space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true })
space:create_index('second', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true })
--# setopt delimiter ';'
for i = 1, 100 do
v = tostring(i)
space:insert{v, string.rep(v, 2) , string.rep(v, 3)}
end;
local pk = space.index[0]
while pk:len() > 0 do
local state, t
for state, t in pk:pairs() do
local key = {}
for _k2, parts in ipairs(pk.parts) do
table.insert(key, t[parts.fieldno])
end
space:delete(key)
end
end;
--# setopt delimiter ''
space:drop()
space = nil
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