diff options
author | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-06-01 22:53:50 +0500 |
---|---|---|
committer | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-06-01 22:53:50 +0500 |
commit | 55aa43e2f52acfe88c633f6aeec3089ef68b0e19 (patch) | |
tree | 30239ffe559f16c908d9d4b3076a8151f8b9ec63 /sql/sql_table.cc | |
parent | eab7e4d4e4375aa68996908ab391d3fd6b621ff3 (diff) | |
download | mariadb-git-55aa43e2f52acfe88c633f6aeec3089ef68b0e19.tar.gz |
Fix for bug #28652: MySQL (with-debug=full) asserts when alter table operations
Problem: we may create a deadlock committing changes in the mysql_alter_table() when
LOCK_open is set. Moreover, "in some variants of the ALTER TABLE commit
happens earlier, outside of LOCK_open, in other later - inside. It's no good, a storage
engine code that is called in between could expect a consistency - either there is a
transaction or there is not".
Fix: move the commit to happen earlier and outside of the LOCK_open.
mysql-test/r/innodb_mysql.result:
Fix for bug #28652: MySQL (with-debug=full) asserts when alter table operations
- test result.
mysql-test/t/innodb_mysql.test:
Fix for bug #28652: MySQL (with-debug=full) asserts when alter table operations
- test case.
sql/sql_table.cc:
Fix for bug #28652: MySQL (with-debug=full) asserts when alter table operations
- commit moved to happen earlier in the mysql_alter_table(),
now we commit changes at the same time as in case when a temporary
table is used.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 079cc0d6456..27d049e2d06 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3776,6 +3776,9 @@ view_err: alter_info->keys_onoff); table->file->external_lock(thd, F_UNLCK); VOID(pthread_mutex_unlock(&LOCK_open)); + error= ha_commit_stmt(thd); + if (ha_commit(thd)) + error= 1; } thd->last_insert_id=next_insert_id; // Needed for correct log @@ -3946,16 +3949,6 @@ view_err: goto err; } } - /* The ALTER TABLE is always in its own transaction */ - error = ha_commit_stmt(thd); - if (ha_commit(thd)) - error=1; - if (error) - { - VOID(pthread_mutex_unlock(&LOCK_open)); - broadcast_refresh(); - goto err; - } thd->proc_info="end"; if (mysql_bin_log.is_open()) { @@ -4165,8 +4158,12 @@ copy_data_between_tables(TABLE *from,TABLE *to, } to->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); - ha_enable_transaction(thd,TRUE); - + if (ha_enable_transaction(thd, TRUE)) + { + error= 1; + goto err; + } + /* Ensure that the new table is saved properly to disk so that we can do a rename |