commit - 2b23725a385f878276a23699568e72394b5210a4
commit + f9dc7b16e0dd935c3c795f9bf5831a368cccef2d
blob - c528da1ab5c627cbecde83280e9a5a79a1dbdaa9
blob + 747c9b4309074ab682789179fcb41c52c80f706f
--- tarantool-tools/vinyl.lua
+++ tarantool-tools/vinyl.lua
end
end
-local function setup(spaces)
+local function setup()
log.info("SETUP")
-- TODO: https://www.tarantool.io/en/doc/2.3/reference/configuration/
box.cfg{
}
log.info('FINISH BOX.CFG')
- for i = 1, NUM_SP do
- log.info('create space ' .. tostring(i))
- local space = box.schema.space.create('test' .. i, { engine = 'vinyl' })
- -- TODO: replace with function create_index.
- space:create_index('pk', { type = 'tree', parts = {{1, 'uint'}},
- run_count_per_level = 100,
- page_size = 128,
- range_size = 1024 })
- -- TODO: replace with function create_index.
- space:create_index('secondary', { unique = false, parts = { 2, 'unsigned' }})
- init_space(space)
- spaces[i] = space
- end
+ log.info('create a space')
+ local space = box.schema.space.create('test', { engine = 'vinyl' })
+ -- TODO: replace with function create_index.
+ space:create_index('pk', { type = 'tree', parts = {{1, 'uint'}},
+ run_count_per_level = 100,
+ page_size = 128,
+ range_size = 1024 })
+ -- TODO: replace with function create_index.
+ space:create_index('secondary', { unique = false, parts = { 2, 'unsigned' }})
+ init_space(space)
log.info('FINISH SETUP')
+ return space
end
local function cleanup()
os.execute('rm -rf *.snap *.xlog *.vylog 51*')
end
-local function teardown(spaces)
+local function teardown(space)
log.info("TEARDOWN")
- for i = 1, NUM_SP do
- spaces[i]:drop()
- end
+ space:drop()
cleanup()
end
end
-- https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_stat/vinyl/
-local function print_stat(spaces)
+local function print_stat(space)
log.info("PRINT STATISTICS")
local stat = box.stat.vinyl()
log.info(string.format('STATISTICS: transactions: %d, tx memory: %d',
stat.tx.transactions, stat.memory.tx))
- for i = 1, NUM_SP do
- stat = spaces[i].index.secondary:stat()
- log.info(string.format('STATISTICS: memory rows %d bytes %d',
- stat.memory.rows, stat.memory.bytes))
- end
+
+ stat = space.index.secondary:stat()
+ log.info(string.format('STATISTICS: memory rows %d bytes %d',
+ stat.memory.rows, stat.memory.bytes))
end
local function main()
- local spaces = {}
local fibers = {}
cleanup()
- setup(spaces)
+ local space = setup()
local f
for i = 1, NUM_SP do
log.info('START DML ' .. i)
local start = os.clock()
while os.clock() - start < TEST_DURATION do
- generate_dml(spaces[i])
- fiber.sleep(0.1)
+ generate_dml(space)
+ fiber.sleep(0.1)
end
end)
f:set_joinable(true)
log.info('START TX ' .. i)
local start = os.clock()
while os.clock() - start < TEST_DURATION do
- local ok, err = pcall(generate_tx, spaces[i])
+ local ok, err = pcall(generate_tx, space)
if ok ~= true then
log.info('TX: ' .. err)
end
- fiber.sleep(0.1)
+ fiber.sleep(0.1)
end
end)
f:set_joinable(true)
log.info('START DDL ' .. i)
local start = os.clock()
while os.clock() - start < TEST_DURATION do
- generate_ddl(spaces[i])
- fiber.sleep(0.1)
+ generate_ddl(space)
+ fiber.sleep(0.1)
end
end)
f:set_joinable(true)
local ok, err = pcall(box.snapshot)
if ok ~= true then
log.info('BOX SNAPSHOT: ' .. err)
- end;
- fiber.sleep(math.random(30, 60))
+ end
+ fiber.sleep(math.random(30, 60))
end
end)
f:set_joinable(true)
local start = os.clock()
while os.clock() - start < TEST_DURATION do
set_err_injection()
- fiber.sleep(math.random(30, 60))
+ fiber.sleep(math.random(30, 60))
end
end)
f:set_joinable(true)
f = fiber.new(function()
local start = os.clock()
while os.clock() - start < TEST_DURATION do
- print_stat(spaces)
- fiber.sleep(60)
+ print_stat(space)
+ fiber.sleep(60)
end
end)
f:set_joinable(true)
assert(ok, true)
end
- teardown(spaces)
+ teardown(space)
end
main()