Validate master data inside transaction
The insertion and subsequent read of the data into the master in `generate_traffic_and_check` will now be done inside a transaction. This keeps the behavior consistent with the `check` function that only inserts one row.
This commit is contained in:
@ -147,13 +147,16 @@ bool generate_traffic_and_check(TestConnections& test, MYSQL* conn, int insert_c
|
|||||||
timespec short_sleep;
|
timespec short_sleep;
|
||||||
short_sleep.tv_sec = 0;
|
short_sleep.tv_sec = 0;
|
||||||
short_sleep.tv_nsec = 100000000;
|
short_sleep.tv_nsec = 100000000;
|
||||||
|
|
||||||
|
mysql_query(conn, "BEGIN");
|
||||||
|
|
||||||
for (int i = 0; i < insert_count; i++)
|
for (int i = 0; i < insert_count; i++)
|
||||||
{
|
{
|
||||||
test.try_query(conn, INSERT, inserts++);
|
test.try_query(conn, INSERT, inserts++);
|
||||||
nanosleep(&short_sleep, NULL);
|
nanosleep(&short_sleep, NULL);
|
||||||
}
|
}
|
||||||
sleep(1);
|
|
||||||
bool rval = false;
|
bool rval = false;
|
||||||
|
|
||||||
mysql_query(conn, SELECT);
|
mysql_query(conn, SELECT);
|
||||||
MYSQL_RES *res = mysql_store_result(conn);
|
MYSQL_RES *res = mysql_store_result(conn);
|
||||||
test.assert(res != NULL, "Query did not return a result set");
|
test.assert(res != NULL, "Query did not return a result set");
|
||||||
@ -184,6 +187,7 @@ bool generate_traffic_and_check(TestConnections& test, MYSQL* conn, int insert_c
|
|||||||
}
|
}
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
}
|
}
|
||||||
|
mysql_query(conn, "COMMIT");
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user