3912 Marko Mäkelä 2012-05-30
WL#6255 bogus assertion fix.
row_log_table_apply_update() can specify BTR_KEEP_POS_FLAG with all the
usual online flags. Allow it in the assertions in btr0cur.cc.
modified:
storage/innobase/btr/btr0cur.cc
3911 Marko Mäkelä 2012-05-30
WL#6255 MVCC bug fix: Ensure that older transactions are denied access
to a table that has been rebuilt, whether or not it happened in-place
(ALGORITHM=INPLACE) or in the old way (ALGORITHM=COPY).
When a table is created, we record the trx_id of the creating data
dictionary transaction in each index of the table in the data dictionary
cache. In this way, transactions that were started before the table
creation (or copying) can be denied access to the new table.
To be exact, there are two transactions involved in DDL. One is the
user transaction associated with the MySQL client connection. For
InnoDB data dictionary operations, we create a data dictionary transaction.
Theoretically, other transactions could start between the prebuilt->trx
and the dictionary trx. However, the table cannot be modified during this
time frame, thanks to a meta-data lock (MDL). In CREATE TABLE, the table
does not exist before InnoDB returns, and in ALTER TABLE, other transactions
are blocked from accessing the table while the table copy is being set up.
dict_create_index_step(): Initialize index->trx_id, so that older
transactions will be denied access to a newly created table.
ha_innobase::commit_inplace_alter_table(): Remove the adjustment of
index->trx_id for ALGORITHM=INPLACE.
modified:
mysql-test/suite/innodb/r/innodb-index.result
mysql-test/suite/innodb/t/innodb-index.test
storage/innobase/dict/dict0crea.cc
storage/innobase/handler/handler0alter.cc
=== modified file 'storage/innobase/btr/btr0cur.cc'
--- a/storage/innobase/btr/btr0cur.cc revid:marko.makela@stripped20120530194837-18ttnm2mooe7dl2p
+++ b/storage/innobase/btr/btr0cur.cc revid:marko.makela@stripped-3htb1n1958c593cc
@@ -1889,8 +1889,9 @@ btr_cur_update_in_place(
ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG)
|| dict_index_is_clust(index));
ut_ad(!thr || thr_get_trx(thr)->id == trx_id);
- ut_ad(thr || flags == (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG
- | BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG));
+ ut_ad(thr || (flags & ~BTR_KEEP_POS_FLAG)
+ == (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG
+ | BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG));
#ifdef UNIV_DEBUG
if (btr_cur_print_record_ops) {
@@ -2031,8 +2032,9 @@ btr_cur_optimistic_update(
ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG)
|| dict_index_is_clust(index));
ut_ad(!thr || thr_get_trx(thr)->id == trx_id);
- ut_ad(thr || flags == (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG
- | BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG));
+ ut_ad(thr || (flags & ~BTR_KEEP_POS_FLAG)
+ == (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG
+ | BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG));
*offsets = rec_get_offsets(rec, index, *offsets,
ULINT_UNDEFINED, heap);
@@ -2305,8 +2307,9 @@ btr_cur_pessimistic_update(
ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG)
|| dict_index_is_clust(index));
ut_ad(!thr || thr_get_trx(thr)->id == trx_id);
- ut_ad(thr || flags == (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG
- | BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG));
+ ut_ad(thr || (flags & ~BTR_KEEP_POS_FLAG)
+ == (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG
+ | BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG));
optim_err = btr_cur_optimistic_update(
flags, cursor, offsets, offsets_heap, update,
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-trunk-wl6255 branch (marko.makela:3911 to 3912) WL#6255 | marko.makela | 31 May |