mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
ha_innodb.cc:
write_row(): document the ALTER TABLE tweak better, and commit every n*10000 rows, not n*10000-1 rows. sql/ha_innodb.cc: write_row(): document the ALTER TABLE tweak better, and commit every n*10000 rows, not n*10000-1 rows.
This commit is contained in:
@ -2314,10 +2314,8 @@ ha_innobase::write_row(
|
|||||||
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
|
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
|
||||||
table->timestamp_field->set_time();
|
table->timestamp_field->set_time();
|
||||||
|
|
||||||
num_write_row++;
|
|
||||||
|
|
||||||
if (user_thd->lex->sql_command == SQLCOM_ALTER_TABLE
|
if (user_thd->lex->sql_command == SQLCOM_ALTER_TABLE
|
||||||
&& num_write_row > 10000) {
|
&& num_write_row >= 10000) {
|
||||||
/* ALTER TABLE is COMMITted at every 10000 copied rows.
|
/* ALTER TABLE is COMMITted at every 10000 copied rows.
|
||||||
The IX table lock for the original table has to be re-issued.
|
The IX table lock for the original table has to be re-issued.
|
||||||
As this method will be called on a temporary table where the
|
As this method will be called on a temporary table where the
|
||||||
@ -2331,14 +2329,20 @@ ha_innobase::write_row(
|
|||||||
dict_table_t* table = lock_get_ix_table(
|
dict_table_t* table = lock_get_ix_table(
|
||||||
UT_LIST_GET_FIRST(prebuilt->trx->trx_locks));
|
UT_LIST_GET_FIRST(prebuilt->trx->trx_locks));
|
||||||
num_write_row = 0;
|
num_write_row = 0;
|
||||||
|
/* Commit the transaction. This will release the table
|
||||||
|
locks, so they have to be acquired again. */
|
||||||
innobase_commit(user_thd, prebuilt->trx);
|
innobase_commit(user_thd, prebuilt->trx);
|
||||||
|
/* Note that this transaction is still active. */
|
||||||
user_thd->transaction.all.innodb_active_trans = 1;
|
user_thd->transaction.all.innodb_active_trans = 1;
|
||||||
|
/* Re-acquire the IX table lock on the source table. */
|
||||||
row_lock_table_for_mysql(prebuilt, table);
|
row_lock_table_for_mysql(prebuilt, table);
|
||||||
goto new_trx;
|
/* We will need an IX lock on the destination table. */
|
||||||
|
prebuilt->sql_stat_start = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
num_write_row++;
|
||||||
|
|
||||||
if (last_query_id != user_thd->query_id) {
|
if (last_query_id != user_thd->query_id) {
|
||||||
new_trx:
|
|
||||||
prebuilt->sql_stat_start = TRUE;
|
prebuilt->sql_stat_start = TRUE;
|
||||||
last_query_id = user_thd->query_id;
|
last_query_id = user_thd->query_id;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user