diff options
author | unknown <karen.langford@oracle.com> | 2010-10-11 22:13:47 +0200 |
---|---|---|
committer | Karen Langford <karen.langford@oracle.com> | 2010-10-11 22:13:47 +0200 |
commit | 498ee6bd19eabc85dcbd9abebc9cf6aeb79d1985 (patch) | |
tree | 2661daa32857e606d955263f4edd93a22f36b792 | |
parent | cf2c8701b48417bde08dd6fdc58d9da735d53481 (diff) | |
download | mariadb-git-498ee6bd19eabc85dcbd9abebc9cf6aeb79d1985.tar.gz |
Fix bug #57345
-rw-r--r-- | storage/innobase/row/row0sel.c | 14 | ||||
-rw-r--r-- | storage/innodb_plugin/ChangeLog | 6 | ||||
-rw-r--r-- | storage/innodb_plugin/row/row0sel.c | 14 |
3 files changed, 31 insertions, 3 deletions
diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index a64dd3151ee..ecb2c492706 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -3259,6 +3259,7 @@ row_search_for_mysql( mem_heap_t* heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint* offsets = offsets_; + ibool table_lock_waited = FALSE; *offsets_ = (sizeof offsets_) / sizeof *offsets_; @@ -3622,13 +3623,15 @@ shortcut_fails_too_big_rec: trx_assign_read_view(trx); prebuilt->sql_stat_start = FALSE; } else { +wait_table_again: err = lock_table(0, index->table, prebuilt->select_lock_type == LOCK_S ? LOCK_IS : LOCK_IX, thr); if (err != DB_SUCCESS) { - goto lock_wait_or_error; + table_lock_waited = TRUE; + goto lock_table_wait; } prebuilt->sql_stat_start = FALSE; } @@ -4408,6 +4411,7 @@ lock_wait_or_error: btr_pcur_store_position(pcur, &mtr); +lock_table_wait: mtr_commit(&mtr); mtr_has_extra_clust_latch = FALSE; @@ -4425,6 +4429,14 @@ lock_wait_or_error: thr->lock_state = QUE_THR_LOCK_NOLOCK; mtr_start(&mtr); + /* Table lock waited, go try to obtain table lock + again */ + if (table_lock_waited) { + table_lock_waited = FALSE; + + goto wait_table_again; + } + sel_restore_position_for_mysql(&same_user_rec, BTR_SEARCH_LEAF, pcur, moves_up, &mtr); diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 342e3e32bc1..c185215e65f 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,8 @@ +2010-10-11 The InnoDB Team + * row/row0sel.c + Fix Bug #57345 btr_pcur_store_position abort for load with + concurrent lock/unlock tables + 2010-10-06 The InnoDB Team * row/row0mysql.c, innodb_bug57255.result, innodb_bug57255.test Fix Bug #Cascade Delete results in "Got error -1 from storage engine" @@ -40,7 +45,6 @@ * handler/ha_innodb.cc Fix Bug #55382 Assignment with SELECT expressions takes unexpected S locks in READ COMMITTED ->>>>>>> MERGE-SOURCE 2010-07-27 The InnoDB Team diff --git a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c index 8b17bdc6ad3..cc7a7a6fe9b 100644 --- a/storage/innodb_plugin/row/row0sel.c +++ b/storage/innodb_plugin/row/row0sel.c @@ -3356,6 +3356,7 @@ row_search_for_mysql( mem_heap_t* heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint* offsets = offsets_; + ibool table_lock_waited = FALSE; rec_offs_init(offsets_); @@ -3742,13 +3743,15 @@ release_search_latch_if_needed: trx_assign_read_view(trx); prebuilt->sql_stat_start = FALSE; } else { +wait_table_again: err = lock_table(0, index->table, prebuilt->select_lock_type == LOCK_S ? LOCK_IS : LOCK_IX, thr); if (err != DB_SUCCESS) { - goto lock_wait_or_error; + table_lock_waited = TRUE; + goto lock_table_wait; } prebuilt->sql_stat_start = FALSE; } @@ -4559,6 +4562,7 @@ lock_wait_or_error: btr_pcur_store_position(pcur, &mtr); +lock_table_wait: mtr_commit(&mtr); mtr_has_extra_clust_latch = FALSE; @@ -4576,6 +4580,14 @@ lock_wait_or_error: thr->lock_state = QUE_THR_LOCK_NOLOCK; mtr_start(&mtr); + /* Table lock waited, go try to obtain table lock + again */ + if (table_lock_waited) { + table_lock_waited = FALSE; + + goto wait_table_again; + } + sel_restore_position_for_mysql(&same_user_rec, BTR_SEARCH_LEAF, pcur, moves_up, &mtr); |