Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/quick-check.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: quick_check

on:
push:
pull_request:
repository_dispatch:
workflow_dispatch:

Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Install tarantool build prerequisites
run: |
sudo apt-get install -y patch ccache luarocks libmsgpuck-dev libluajit-5.1-dev
sudo apt-get install -y patch ccache luarocks libmsgpuck-dev libluajit-5.1-dev libunwind-dev

# by some odd reason we can't use
# working-directory: $GITHUB_WORKSPACE/tarantool/build
Expand Down
28 changes: 26 additions & 2 deletions create_table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ local mem_size = 10 * 1024^3

local function config(portN, memSz)
box.cfg{ listen = tonumber(portN), memtx_memory = tonumber(memSz) }
local fiber = require('fiber')
fiber.set_max_slice(60 * 60) -- "1 hour should be enough for everybody"
end

local function show_usage()
Expand Down Expand Up @@ -165,13 +167,18 @@ local tables = {
'region', 'nation', 'part', 'supplier',
'partsupp', 'customer', 'orders', 'lineitem'
}

for _, tblname in ipairs(tables) do
local f = assert(io.open(string.format("tpch-dbgen/%s.tbl", tblname), 'rb'))
print (tblname)
box.begin()
local sql_table = tblname:upper()
local lines = 0
print ('Loading: ', tblname)

while true do
local line = f:read('*line')
if not line then break end
lines = lines + 1

local t = {}
for s in string.gmatch(line, '[^|]+') do
Expand All @@ -193,9 +200,26 @@ for _, tblname in ipairs(tables) do
end
local tuple = box.tuple.new(t)

box.space[tblname:upper()]:insert(tuple)
local rc, msg = pcall(box.space[sql_table].insert, box.space[sql_table], tuple)
if not rc then
print(('database %s failed to insert tuple %s: %s'):
format(sql_table, require'json'.encode(tuple), msg))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines seem rather strange to me, since something is wrong with the indentation, and it seems strange to me to move the method to the next line. It might be worth changing it to something like:

            local str = 'database %s failed to insert tuple %s: %s'
            print(str:format(sql_table, require'json'.encode(tuple), msg))

end
end
f:close()
box.commit()
-- sanity check - assume we have successfully inserted all tuples

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we throw here an error if not all tuples were inserted successfully? Also, is there a way to add tests to TPCH?

local check_lines = box.execute(('select count(*) from %s'):format(sql_table))
if not check_lines then
error(('database %s is not existing'):format(sql_table))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message looks rather strange. Can we change it to database %s does not exist?

end
local count = check_lines.rows[1][1]
if count ~= lines then
error(('database %s contains %d rows, but expected %d'):
format(sql_table, count, lines))
else
print(('.... %d rows loaded'):format(lines))
end
end

box.snapshot()
Expand Down
2 changes: 2 additions & 0 deletions execute_query.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ io.stdout:setvbuf 'no'
local function config(portN, memSz)
if not dryrun then
box.cfg{ listen = tonumber(portN), memtx_memory = tonumber(memSz) }
local fiber = require('fiber')
fiber.set_max_slice(60 * 60) -- "1 hour should be enough for everybody"
end
end

Expand Down