@@ -76,54 +76,18 @@ function cmd_prepare()
76
76
77
77
if drv :name () == " mysql" then
78
78
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 )
87
79
end
88
80
89
81
-- create tables in parallel table per thread
90
82
for i = sysbench .tid % sysbench .opt .threads + 1 , sysbench .opt .tables ,
91
83
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
95
84
create_tables (drv , con , i )
96
85
end
97
86
98
87
-- make sure all tables are created before we load data
99
88
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 )
127
91
128
92
for i = sysbench .tid % sysbench .opt .threads + 1 , sysbench .opt .scale ,
129
93
sysbench .opt .threads do
@@ -386,9 +350,6 @@ function create_tables(drv, con, table_num)
386
350
con :query (" ALTER TABLE stock" .. i .. " ADD CONSTRAINT fkey_stock_2_" .. table_num .. " FOREIGN KEY(s_i_id) REFERENCES item" .. i .. " (i_id)" )
387
351
end
388
352
389
- if drv :name () == " mysql" then
390
- con :query (" UPDATE aux_sync SET active=0 WHERE table_id=" .. table_num )
391
- end
392
353
end
393
354
394
355
0 commit comments