Commit f2be61f5 authored by unknown's avatar unknown

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.
parent d07f96cf
......@@ -2314,10 +2314,8 @@ ha_innobase::write_row(
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
num_write_row++;
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.
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
......@@ -2331,14 +2329,20 @@ ha_innobase::write_row(
dict_table_t* table = lock_get_ix_table(
UT_LIST_GET_FIRST(prebuilt->trx->trx_locks));
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);
/* Note that this transaction is still active. */
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);
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) {
new_trx:
prebuilt->sql_stat_start = TRUE;
last_query_id = user_thd->query_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment