Skip to content

Commit d4520f5

Browse files
author
VadimTk
committed
fix sync load again
1 parent 8a54c70 commit d4520f5

File tree

1 file changed

+2
-41
lines changed

1 file changed

+2
-41
lines changed

tpcc_common.lua

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -76,54 +76,18 @@ function cmd_prepare()
7676

7777
if drv:name() == "mysql" then
7878
con:query("SET FOREIGN_KEY_CHECKS=0")
79-
query = string.format([[
80-
CREATE TABLE IF NOT EXISTS aux_sync (
81-
table_id int not null,
82-
active smallint not null default 1 ,
83-
primary key (table_id)
84-
)]])
85-
86-
con:query(query)
8779
end
8880

8981
-- create tables in parallel table per thread
9082
for i = sysbench.tid % sysbench.opt.threads + 1, sysbench.opt.tables,
9183
sysbench.opt.threads do
92-
if drv:name() == "mysql" then
93-
con:query("INSERT INTO aux_sync (table_id) VALUES ("..i..") ON DUPLICATE KEY UPDATE active=1")
94-
end
9584
create_tables(drv, con, i)
9685
end
9786

9887
-- make sure all tables are created before we load data
9988

100-
print("Waiting on tables\n")
101-
102-
if drv:name() == "mysql" then
103-
104-
local aux_cnt
105-
local aux_active
106-
while (true)
107-
do
108-
aux_cnt, aux_active= con:query_row("SELECT COUNT(*), SUM(active) FROM aux_sync")
109-
ffi.C.usleep(10000)
110-
--print(sysbench.tid..": got "..aux_cnt.." and "..aux_active.."\n")
111-
if (tonumber(aux_active) == 0 and tonumber(aux_cnt)==sysbench.opt.tables) then
112-
-- print ("!!!!!!!!!!!!!!!")
113-
break
114-
end
115-
end
116-
117-
end
118-
119-
if drv:name() == "pgsql" then
120-
show_query="select * from pg_catalog.pg_indexes where schemaname != 'information_schema' and schemaname != 'pg_catalog'"
121-
122-
repeat
123-
rs= con:query(show_query)
124-
ffi.C.usleep(1000)
125-
until rs.nrows == sysbench.opt.tables * 14
126-
end
89+
print("Waiting on tables 10 sec\n")
90+
sleep(10)
12791

12892
for i = sysbench.tid % sysbench.opt.threads + 1, sysbench.opt.scale,
12993
sysbench.opt.threads do
@@ -386,9 +350,6 @@ function create_tables(drv, con, table_num)
386350
con:query("ALTER TABLE stock"..i.." ADD CONSTRAINT fkey_stock_2_"..table_num.." FOREIGN KEY(s_i_id) REFERENCES item"..i.."(i_id)")
387351
end
388352

389-
if drv:name() == "mysql" then
390-
con:query("UPDATE aux_sync SET active=0 WHERE table_id="..table_num)
391-
end
392353
end
393354

394355

0 commit comments

Comments
 (0)