mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
Fix for bug#31704
Just had to put in the removal of the autocommit, and make sure the commit occurred at the propper time.
This commit is contained in:
parent
571200d487
commit
f9046eafbf
2 changed files with 23 additions and 7 deletions
|
@ -546,7 +546,7 @@ static struct my_option my_long_options[] =
|
|||
"Number of rows to insert to used in read and write loads (default is 100).\n",
|
||||
(uchar**) &auto_generate_sql_number, (uchar**) &auto_generate_sql_number,
|
||||
0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0},
|
||||
{"commit", OPT_SLAP_COMMIT, "Commit records after X number of statements.",
|
||||
{"commit", OPT_SLAP_COMMIT, "Commit records every X number of statements.",
|
||||
(uchar**) &commit_rate, (uchar**) &commit_rate, 0, GET_UINT, REQUIRED_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
{"compress", 'C', "Use compression in server/client protocol.",
|
||||
|
@ -577,7 +577,7 @@ static struct my_option my_long_options[] =
|
|||
"Delimiter to use in SQL statements supplied in file or command line.",
|
||||
(uchar**) &delimiter, (uchar**) &delimiter, 0, GET_STR, REQUIRED_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
{"detach", OPT_SLAP_DETACH, "Detach connections after X number of requests.",
|
||||
{"detach", OPT_SLAP_DETACH, "Detach connections every X number of requests.",
|
||||
(uchar**) &detach_rate, (uchar**) &detach_rate, 0, GET_UINT, REQUIRED_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
{"engine", 'e', "Storage engine to use for creating the table.",
|
||||
|
@ -1766,7 +1766,8 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
|
|||
pthread_handler_t run_task(void *p)
|
||||
{
|
||||
ulonglong counter= 0, queries;
|
||||
ulonglong trans_counter;
|
||||
ulonglong detach_counter;
|
||||
unsigned int commit_counter;
|
||||
MYSQL *mysql;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
@ -1810,12 +1811,16 @@ pthread_handler_t run_task(void *p)
|
|||
printf("connected!\n");
|
||||
queries= 0;
|
||||
|
||||
commit_counter= 0;
|
||||
if (commit_rate)
|
||||
run_query(mysql, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
|
||||
|
||||
limit_not_met:
|
||||
for (ptr= con->stmt, trans_counter= 0;
|
||||
for (ptr= con->stmt, detach_counter= 0;
|
||||
ptr && ptr->length;
|
||||
ptr= ptr->next, trans_counter++)
|
||||
ptr= ptr->next, detach_counter++)
|
||||
{
|
||||
if (!opt_only_print && detach_rate && !(trans_counter % detach_rate))
|
||||
if (!opt_only_print && detach_rate && !(detach_counter % detach_rate))
|
||||
{
|
||||
mysql_close(mysql);
|
||||
|
||||
|
@ -1886,8 +1891,11 @@ limit_not_met:
|
|||
}
|
||||
queries++;
|
||||
|
||||
if (commit_rate && commit_rate <= trans_counter)
|
||||
if (commit_rate && (++commit_counter == commit_rate))
|
||||
{
|
||||
commit_counter= 0;
|
||||
run_query(mysql, "COMMIT", strlen("COMMIT"));
|
||||
}
|
||||
|
||||
if (con->limit && queries == con->limit)
|
||||
goto end;
|
||||
|
|
|
@ -177,13 +177,17 @@ INSERT INTO t1 VALUES (1, 'This is a test');
|
|||
insert into t2 values ('test', 'test2');
|
||||
SET AUTOCOMMIT=0;
|
||||
SHOW TABLES;
|
||||
SET AUTOCOMMIT=0;
|
||||
select * from t1;
|
||||
COMMIT;
|
||||
select * from t2;
|
||||
COMMIT;
|
||||
select * from t1;
|
||||
COMMIT;
|
||||
select * from t2;
|
||||
COMMIT;
|
||||
select * from t1;
|
||||
COMMIT;
|
||||
select * from t2;
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
|
@ -199,13 +203,17 @@ INSERT INTO t1 VALUES (1, 'This is a test');
|
|||
insert into t2 values ('test', 'test2');
|
||||
SET AUTOCOMMIT=0;
|
||||
SHOW TABLES;
|
||||
SET AUTOCOMMIT=0;
|
||||
select * from t1;
|
||||
COMMIT;
|
||||
select * from t2;
|
||||
COMMIT;
|
||||
select * from t1;
|
||||
COMMIT;
|
||||
select * from t2;
|
||||
COMMIT;
|
||||
select * from t1;
|
||||
COMMIT;
|
||||
select * from t2;
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
|
|
Loading…
Add table
Reference in a new issue