diff options
author | Marko Mäkelä <marko.makela@oracle.com> | 2010-06-30 12:52:41 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@oracle.com> | 2010-06-30 12:52:41 +0300 |
commit | 533d430d2ce4c749e4671665d540cf0302afda6b (patch) | |
tree | 6b76957187a3cfdc024d03276e2983d537e93755 /storage | |
parent | 6cb46973dce62beaf2afb5a0feacfb025890f6f3 (diff) | |
download | mariadb-git-533d430d2ce4c749e4671665d540cf0302afda6b.tar.gz |
Merge Bug #54358 comment corrections from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3533
revision-id: marko.makela@oracle.com-20100630093149-wmc37t128gic933v
parent: marko.makela@oracle.com-20100629131219-pjbkpk5rsqztmw27
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Wed 2010-06-30 12:31:49 +0300
message:
Correct some comments that were added in the fix of Bug #54358
(READ UNCOMMITTED access failure of off-page DYNAMIC or COMPRESSED columns).
Records that lack incompletely written externally stored columns may
be accessed by READ UNCOMMITTED transaction even without involving a
crash during an INSERT or UPDATE operation. I verified this as follows.
(1) added a delay after the mini-transaction for writing the clustered
index 'stub' record was committed (patch attached)
(2) started mysqld in gdb, setting breakpoints to the where the
assertions about READ UNCOMMITTED were added in the bug fix
(3) invoked ibtest3 --create-options=key_block_size=2
to create BLOBs in a COMPRESSED table
(4) invoked the following:
yes 'set transaction isolation level read uncommitted;
checksum table blobt3;select sleep(1);'|mysql -uroot test
(5) noted that one of the breakpoints was triggered
(return(NULL) in btr_rec_copy_externally_stored_field())
=== modified file 'storage/innodb_plugin/row/row0ins.c'
--- storage/innodb_plugin/row/row0ins.c 2010-06-30 08:17:25 +0000
+++ storage/innodb_plugin/row/row0ins.c 2010-06-30 08:17:25 +0000
@@ -2120,6 +2120,7 @@ function_exit:
rec_t* rec;
ulint* offsets;
mtr_start(&mtr);
+ os_thread_sleep(5000000);
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
BTR_MODIFY_TREE, &cursor, 0,
=== modified file 'storage/innodb_plugin/row/row0upd.c'
--- storage/innodb_plugin/row/row0upd.c 2010-06-30 08:11:55 +0000
+++ storage/innodb_plugin/row/row0upd.c 2010-06-30 08:11:55 +0000
@@ -1763,6 +1763,7 @@ row_upd_clust_rec(
rec_offs_init(offsets_);
mtr_start(mtr);
+ os_thread_sleep(5000000);
ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
rec = btr_cur_get_rec(btr_cur);
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/btr/btr0cur.c | 14 | ||||
-rw-r--r-- | storage/innobase/row/row0sel.c | 53 |
2 files changed, 19 insertions, 48 deletions
diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index 90dfba7e151..537d5f51184 100644 --- a/storage/innobase/btr/btr0cur.c +++ b/storage/innobase/btr/btr0cur.c @@ -4969,20 +4969,10 @@ btr_rec_copy_externally_stored_field( if (UNIV_UNLIKELY (!memcmp(data + local_len - BTR_EXTERN_FIELD_REF_SIZE, field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE))) { - /* The externally stored field was not written - yet. This is only a valid condition when the server - crashed after the time a record stub was freshly - inserted but before all its columns were written. This - record should only be seen by + /* The externally stored field was not written yet. + This record should only be seen by recv_recovery_rollback_active() or any TRX_ISO_READ_UNCOMMITTED transactions. */ - - /* TODO: assert that there is an owner_trx with - owner_trx->id == DB_TRX_ID and owner_trx->is_recovered */ - - /* TODO: assert that for the current transaction trx, - either (trx == owner_trx && trx_is_recv(trx)) or - trx->isolation_level == TRX_ISO_READ_UNCOMMITTED. */ return(NULL); } diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 13c867dc4c3..3d435965949 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -425,11 +425,7 @@ row_sel_fetch_columns( /* data == NULL means that the externally stored field was not - written yet. This is only a valid - condition when the server crashed - after the time a record stub was - freshly inserted but before all its - columns were written. This record + written yet. This record should only be seen by recv_recovery_rollback_active() or any TRX_ISO_READ_UNCOMMITTED @@ -2736,12 +2732,7 @@ row_sel_store_mysql_rec( if (UNIV_UNLIKELY(!data)) { /* The externally stored field - was not written yet. This is - only a valid condition when - the server crashed after the - time a record stub was freshly - inserted but before all its - columns were written. This + was not written yet. This record should only be seen by recv_recovery_rollback_active() or any TRX_ISO_READ_UNCOMMITTED @@ -3615,8 +3606,7 @@ row_search_for_mysql( if (!row_sel_store_mysql_rec(buf, prebuilt, rec, offsets)) { - /* Only fresh inserts at - server crash time may contain + /* Only fresh inserts may contain incomplete externally stored columns. Pretend that such records do not exist. Such @@ -3628,10 +3618,6 @@ row_search_for_mysql( at a lower level, not here. */ ut_a(trx->isolation_level == TRX_ISO_READ_UNCOMMITTED); - /* TODO: assert that there is - an owner_trx with - owner_trx->id == DB_TRX_ID and - owner_trx->is_recovered */ err = DB_TOO_BIG_RECORD; @@ -4414,16 +4400,14 @@ requires_clust_rec: if (!row_sel_push_cache_row_for_mysql(prebuilt, result_rec, offsets)) { - /* Only fresh inserts at server crash time may contain - incomplete externally stored columns. Pretend that - such records do not exist. Such records may only be - accessed at the READ UNCOMMITTED isolation level or - when rolling back a recovered transaction. Rollback - happens at a lower level, not here. */ + /* Only fresh inserts may contain incomplete + externally stored columns. Pretend that such + records do not exist. Such records may only be + accessed at the READ UNCOMMITTED isolation + level or when rolling back a recovered + transaction. Rollback happens at a lower + level, not here. */ ut_a(trx->isolation_level == TRX_ISO_READ_UNCOMMITTED); - /* TODO: assert that there is an owner_trx - with owner_trx->id == DB_TRX_ID and - owner_trx->is_recovered */ } else if (prebuilt->n_fetch_cached == MYSQL_FETCH_CACHE_SIZE) { @@ -4441,19 +4425,16 @@ requires_clust_rec: } else { if (!row_sel_store_mysql_rec(buf, prebuilt, result_rec, offsets)) { - /* Only fresh inserts at server crash - time may contain incomplete externally - stored columns. Pretend that such - records do not exist. Such records may - only be accessed at the READ UNCOMMITTED + /* Only fresh inserts may contain + incomplete externally stored + columns. Pretend that such records do + not exist. Such records may only be + accessed at the READ UNCOMMITTED isolation level or when rolling back a - recovered transaction. Rollback happens - at a lower level, not here. */ + recovered transaction. Rollback + happens at a lower level, not here. */ ut_a(trx->isolation_level == TRX_ISO_READ_UNCOMMITTED); - /* TODO: assert that there is an owner_trx - with owner_trx->id == DB_TRX_ID and - owner_trx->is_recovered */ goto next_rec; } } |