summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2012-03-08 17:16:53 +0200
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2012-03-08 17:16:53 +0200
commit8232d9a6eee5a624290f23198dd745ddae0e247d (patch)
tree4bbe43dd74715c56302429c8ac587047633cbb58 /storage
parent930a5b918d36ee7190d973eab45c6fcd031865a7 (diff)
parent76e064e209247bef208c119bd7a1d01965f06149 (diff)
downloadmariadb-git-8232d9a6eee5a624290f23198dd745ddae0e247d.tar.gz
merge mysql-5.1->mysql-5.1-security
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/btr/btr0pcur.c70
-rw-r--r--storage/innodb_plugin/ChangeLog13
-rw-r--r--storage/innodb_plugin/btr/btr0btr.c26
-rw-r--r--storage/innodb_plugin/btr/btr0pcur.c70
-rw-r--r--storage/innodb_plugin/dict/dict0dict.c22
-rw-r--r--storage/innodb_plugin/handler/handler0alter.cc12
-rw-r--r--storage/innodb_plugin/include/btr0btr.h7
-rw-r--r--storage/innodb_plugin/include/dict0dict.h14
-rw-r--r--storage/innodb_plugin/include/dict0dict.ic21
-rw-r--r--storage/innodb_plugin/include/dict0mem.h10
-rw-r--r--storage/innodb_plugin/row/row0mysql.c30
-rw-r--r--storage/innodb_plugin/row/row0row.c14
12 files changed, 200 insertions, 109 deletions
diff --git a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c
index 8d473794243..439ab3093b2 100644
--- a/storage/innobase/btr/btr0pcur.c
+++ b/storage/innobase/btr/btr0pcur.c
@@ -291,13 +291,20 @@ btr_pcur_restore_position(
/* Save the old search mode of the cursor */
old_mode = cursor->search_mode;
- if (UNIV_LIKELY(cursor->rel_pos == BTR_PCUR_ON)) {
+ switch (cursor->rel_pos) {
+ case BTR_PCUR_ON:
mode = PAGE_CUR_LE;
- } else if (cursor->rel_pos == BTR_PCUR_AFTER) {
+ break;
+ case BTR_PCUR_AFTER:
mode = PAGE_CUR_G;
- } else {
- ut_ad(cursor->rel_pos == BTR_PCUR_BEFORE);
+ break;
+ case BTR_PCUR_BEFORE:
mode = PAGE_CUR_L;
+ break;
+#ifdef UNIV_DEBUG
+ default:
+ ut_error;
+#endif /* UNIV_DEBUG */
}
btr_pcur_open_with_no_init(index, tuple, mode, latch_mode,
@@ -306,26 +313,45 @@ btr_pcur_restore_position(
/* Restore the old search mode */
cursor->search_mode = old_mode;
- if (cursor->rel_pos == BTR_PCUR_ON
- && btr_pcur_is_on_user_rec(cursor, mtr)
- && 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
- rec_get_offsets(
- btr_pcur_get_rec(cursor), index,
- NULL, ULINT_UNDEFINED, &heap))) {
-
- /* We have to store the NEW value for the modify clock, since
- the cursor can now be on a different page! But we can retain
- the value of old_rec */
-
- cursor->block_when_stored = buf_block_align(
- btr_pcur_get_page(cursor));
- cursor->modify_clock = buf_block_get_modify_clock(
- cursor->block_when_stored);
- cursor->old_stored = BTR_PCUR_OLD_STORED;
+ if (btr_pcur_is_on_user_rec(cursor, mtr)) {
+ switch (cursor->rel_pos) {
+ case BTR_PCUR_ON:
+ if (!cmp_dtuple_rec(
+ tuple, btr_pcur_get_rec(cursor),
+ rec_get_offsets(btr_pcur_get_rec(cursor),
+ index, NULL,
+ ULINT_UNDEFINED, &heap))) {
+
+ /* We have to store the NEW value for
+ the modify clock, since the cursor can
+ now be on a different page! But we can
+ retain the value of old_rec */
+
+ cursor->block_when_stored =
+ buf_block_align(
+ btr_pcur_get_page(cursor));
+ cursor->modify_clock =
+ buf_block_get_modify_clock(
+ cursor->block_when_stored);
+ cursor->old_stored = BTR_PCUR_OLD_STORED;
- mem_heap_free(heap);
+ mem_heap_free(heap);
- return(TRUE);
+ return(TRUE);
+ }
+
+ break;
+ case BTR_PCUR_BEFORE:
+ page_cur_move_to_next(btr_pcur_get_page_cur(cursor));
+ break;
+ case BTR_PCUR_AFTER:
+ page_cur_move_to_prev(btr_pcur_get_page_cur(cursor));
+ break;
+#ifdef UNIV_DEBUG
+ default:
+ ut_error;
+#endif /* UNIV_DEBUG */
+ }
}
mem_heap_free(heap);
diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog
index e1b241a5018..c7d09e0c2a1 100644
--- a/storage/innodb_plugin/ChangeLog
+++ b/storage/innodb_plugin/ChangeLog
@@ -1,3 +1,16 @@
+2012-03-08 The InnoDB Team
+
+ * btr/btr0pcur.c:
+ Fix Bug#13807811 BTR_PCUR_RESTORE_POSITION() CAN SKIP A RECORD
+
+2012-02-28 The InnoDB Team
+
+ * btr/btr0btr.c, dict/dict0dict.c, include/btr0btr.h,
+ include/dict0dict.h, include/dict0dict.ic, include/dict0mem.h,
+ handler/handler0alter.cc, row/row0mysql.c:
+ Fix Bug#12861864 RACE CONDITION IN BTR_GET_SIZE() AND
+ DROP INDEX/TABLE/DATABASE
+
2012-02-15 The InnoDB Team
* btr/btr0btr.c, btr/btr0cur.c, fsp/fsp0fsp.c, ibuf/ibuf0ibuf.c,
diff --git a/storage/innodb_plugin/btr/btr0btr.c b/storage/innodb_plugin/btr/btr0btr.c
index 20eb30588fa..05723c26e2f 100644
--- a/storage/innodb_plugin/btr/btr0btr.c
+++ b/storage/innodb_plugin/btr/btr0btr.c
@@ -991,45 +991,49 @@ btr_page_alloc(
/**************************************************************//**
Gets the number of pages in a B-tree.
-@return number of pages */
+@return number of pages, or ULINT_UNDEFINED if the index is unavailable */
UNIV_INTERN
ulint
btr_get_size(
/*=========*/
dict_index_t* index, /*!< in: index */
- ulint flag) /*!< in: BTR_N_LEAF_PAGES or BTR_TOTAL_SIZE */
+ ulint flag, /*!< in: BTR_N_LEAF_PAGES or BTR_TOTAL_SIZE */
+ mtr_t* mtr) /*!< in/out: mini-transaction where index
+ is s-latched */
{
fseg_header_t* seg_header;
page_t* root;
ulint n;
ulint dummy;
- mtr_t mtr;
- mtr_start(&mtr);
+ ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
+ MTR_MEMO_S_LOCK));
- mtr_s_lock(dict_index_get_lock(index), &mtr);
+ if (index->page == FIL_NULL
+ || index->to_be_dropped
+ || *index->name == TEMP_INDEX_PREFIX) {
+ return(ULINT_UNDEFINED);
+ }
- root = btr_root_get(index, &mtr);
+ root = btr_root_get(index, mtr);
if (flag == BTR_N_LEAF_PAGES) {
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
- fseg_n_reserved_pages(seg_header, &n, &mtr);
+ fseg_n_reserved_pages(seg_header, &n, mtr);
} else if (flag == BTR_TOTAL_SIZE) {
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_TOP;
- n = fseg_n_reserved_pages(seg_header, &dummy, &mtr);
+ n = fseg_n_reserved_pages(seg_header, &dummy, mtr);
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
- n += fseg_n_reserved_pages(seg_header, &dummy, &mtr);
+ n += fseg_n_reserved_pages(seg_header, &dummy, mtr);
} else {
ut_error;
}
- mtr_commit(&mtr);
-
return(n);
}
diff --git a/storage/innodb_plugin/btr/btr0pcur.c b/storage/innodb_plugin/btr/btr0pcur.c
index 57d9752649f..6cbfd8a64b7 100644
--- a/storage/innodb_plugin/btr/btr0pcur.c
+++ b/storage/innodb_plugin/btr/btr0pcur.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -121,6 +121,8 @@ btr_pcur_store_position(
ut_a(btr_page_get_next(page, mtr) == FIL_NULL);
ut_a(btr_page_get_prev(page, mtr) == FIL_NULL);
+ ut_ad(page_is_leaf(page));
+ ut_ad(page_get_page_no(page) == index->page);
cursor->old_stored = BTR_PCUR_OLD_STORED;
@@ -313,13 +315,20 @@ btr_pcur_restore_position_func(
/* Save the old search mode of the cursor */
old_mode = cursor->search_mode;
- if (UNIV_LIKELY(cursor->rel_pos == BTR_PCUR_ON)) {
+ switch (cursor->rel_pos) {
+ case BTR_PCUR_ON:
mode = PAGE_CUR_LE;
- } else if (cursor->rel_pos == BTR_PCUR_AFTER) {
+ break;
+ case BTR_PCUR_AFTER:
mode = PAGE_CUR_G;
- } else {
- ut_ad(cursor->rel_pos == BTR_PCUR_BEFORE);
+ break;
+ case BTR_PCUR_BEFORE:
mode = PAGE_CUR_L;
+ break;
+#ifdef UNIV_DEBUG
+ default:
+ ut_error;
+#endif /* UNIV_DEBUG */
}
btr_pcur_open_with_no_init_func(index, tuple, mode, latch_mode,
@@ -328,25 +337,44 @@ btr_pcur_restore_position_func(
/* Restore the old search mode */
cursor->search_mode = old_mode;
- if (cursor->rel_pos == BTR_PCUR_ON
- && btr_pcur_is_on_user_rec(cursor)
- && 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
- rec_get_offsets(
- btr_pcur_get_rec(cursor), index,
- NULL, ULINT_UNDEFINED, &heap))) {
+ if (btr_pcur_is_on_user_rec(cursor)) {
+ switch (cursor->rel_pos) {
+ case BTR_PCUR_ON:
+ if (!cmp_dtuple_rec(
+ tuple, btr_pcur_get_rec(cursor),
+ rec_get_offsets(btr_pcur_get_rec(cursor),
+ index, NULL,
+ ULINT_UNDEFINED, &heap))) {
+
+ /* We have to store the NEW value for
+ the modify clock, since the cursor can
+ now be on a different page! But we can
+ retain the value of old_rec */
+
+ cursor->block_when_stored =
+ btr_pcur_get_block(cursor);
+ cursor->modify_clock =
+ buf_block_get_modify_clock(
+ cursor->block_when_stored);
+ cursor->old_stored = BTR_PCUR_OLD_STORED;
- /* We have to store the NEW value for the modify clock, since
- the cursor can now be on a different page! But we can retain
- the value of old_rec */
-
- cursor->block_when_stored = btr_pcur_get_block(cursor);
- cursor->modify_clock = buf_block_get_modify_clock(
- cursor->block_when_stored);
- cursor->old_stored = BTR_PCUR_OLD_STORED;
+ mem_heap_free(heap);
- mem_heap_free(heap);
+ return(TRUE);
+ }
- return(TRUE);
+ break;
+ case BTR_PCUR_BEFORE:
+ page_cur_move_to_next(btr_pcur_get_page_cur(cursor));
+ break;
+ case BTR_PCUR_AFTER:
+ page_cur_move_to_prev(btr_pcur_get_page_cur(cursor));
+ break;
+#ifdef UNIV_DEBUG
+ default:
+ ut_error;
+#endif /* UNIV_DEBUG */
+ }
}
mem_heap_free(heap);
diff --git a/storage/innodb_plugin/dict/dict0dict.c b/storage/innodb_plugin/dict/dict0dict.c
index b70d5929f53..df7ac85681c 100644
--- a/storage/innodb_plugin/dict/dict0dict.c
+++ b/storage/innodb_plugin/dict/dict0dict.c
@@ -4271,16 +4271,27 @@ dict_update_statistics(
(srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE
|| (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
&& dict_index_is_clust(index)))) {
+ mtr_t mtr;
ulint size;
- size = btr_get_size(index, BTR_TOTAL_SIZE);
- index->stat_index_size = size;
+ mtr_start(&mtr);
+ mtr_s_lock(dict_index_get_lock(index), &mtr);
- sum_of_index_sizes += size;
+ size = btr_get_size(index, BTR_TOTAL_SIZE, &mtr);
- size = btr_get_size(index, BTR_N_LEAF_PAGES);
+ if (size != ULINT_UNDEFINED) {
+ sum_of_index_sizes += size;
+ index->stat_index_size = size;
+ size = btr_get_size(
+ index, BTR_N_LEAF_PAGES, &mtr);
+ }
+
+ mtr_commit(&mtr);
- if (size == 0) {
+ switch (size) {
+ case ULINT_UNDEFINED:
+ goto fake_statistics;
+ case 0:
/* The root node of the tree is a leaf */
size = 1;
}
@@ -4297,6 +4308,7 @@ dict_update_statistics(
various means, also via secondary indexes. */
ulint i;
+fake_statistics:
sum_of_index_sizes++;
index->stat_index_size = index->stat_n_leaf_pages = 1;
diff --git a/storage/innodb_plugin/handler/handler0alter.cc b/storage/innodb_plugin/handler/handler0alter.cc
index 485e03737e3..e2702b157af 100644
--- a/storage/innodb_plugin/handler/handler0alter.cc
+++ b/storage/innodb_plugin/handler/handler0alter.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 2005, 2012, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -1010,7 +1010,9 @@ ha_innobase::prepare_drop_index(
goto func_exit;
}
+ rw_lock_x_lock(dict_index_get_lock(index));
index->to_be_dropped = TRUE;
+ rw_lock_x_unlock(dict_index_get_lock(index));
}
/* If FOREIGN_KEY_CHECKS = 1 you may not drop an index defined
@@ -1129,7 +1131,9 @@ func_exit:
= dict_table_get_first_index(prebuilt->table);
do {
+ rw_lock_x_lock(dict_index_get_lock(index));
index->to_be_dropped = FALSE;
+ rw_lock_x_unlock(dict_index_get_lock(index));
index = dict_table_get_next_index(index);
} while (index);
}
@@ -1189,7 +1193,9 @@ ha_innobase::final_drop_index(
for (index = dict_table_get_first_index(prebuilt->table);
index; index = dict_table_get_next_index(index)) {
+ rw_lock_x_lock(dict_index_get_lock(index));
index->to_be_dropped = FALSE;
+ rw_lock_x_unlock(dict_index_get_lock(index));
}
goto func_exit;
diff --git a/storage/innodb_plugin/include/btr0btr.h b/storage/innodb_plugin/include/btr0btr.h
index 6e7bb8fc61e..793fbc76f3e 100644
--- a/storage/innodb_plugin/include/btr0btr.h
+++ b/storage/innodb_plugin/include/btr0btr.h
@@ -536,13 +536,16 @@ btr_parse_page_reorganize(
#ifndef UNIV_HOTBACKUP
/**************************************************************//**
Gets the number of pages in a B-tree.
-@return number of pages */
+@return number of pages, or ULINT_UNDEFINED if the index is unavailable */
UNIV_INTERN
ulint
btr_get_size(
/*=========*/
dict_index_t* index, /*!< in: index */
- ulint flag); /*!< in: BTR_N_LEAF_PAGES or BTR_TOTAL_SIZE */
+ ulint flag, /*!< in: BTR_N_LEAF_PAGES or BTR_TOTAL_SIZE */
+ mtr_t* mtr) /*!< in/out: mini-transaction where index
+ is s-latched */
+ __attribute__((nonnull, warn_unused_result));
/**************************************************************//**
Allocates a new file page to be used in an index tree. NOTE: we assume
that the caller has made the reservation for free extents!
diff --git a/storage/innodb_plugin/include/dict0dict.h b/storage/innodb_plugin/include/dict0dict.h
index fdb3bd5d50c..e728c78b9c0 100644
--- a/storage/innodb_plugin/include/dict0dict.h
+++ b/storage/innodb_plugin/include/dict0dict.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -1018,14 +1018,6 @@ dict_index_get_page(
/*================*/
const dict_index_t* tree); /*!< in: index */
/*********************************************************************//**
-Sets the page number of the root of index tree. */
-UNIV_INLINE
-void
-dict_index_set_page(
-/*================*/
- dict_index_t* index, /*!< in/out: index */
- ulint page); /*!< in: page number */
-/*********************************************************************//**
Gets the read-write lock of the index tree.
@return read-write lock */
UNIV_INLINE
diff --git a/storage/innodb_plugin/include/dict0dict.ic b/storage/innodb_plugin/include/dict0dict.ic
index 1704e9c2d71..f3d73b09bdb 100644
--- a/storage/innodb_plugin/include/dict0dict.ic
+++ b/storage/innodb_plugin/include/dict0dict.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -723,21 +723,6 @@ dict_index_get_page(
}
/*********************************************************************//**
-Sets the page number of the root of index tree. */
-UNIV_INLINE
-void
-dict_index_set_page(
-/*================*/
- dict_index_t* index, /*!< in/out: index */
- ulint page) /*!< in: page number */
-{
- ut_ad(index);
- ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
-
- index->page = page;
-}
-
-/*********************************************************************//**
Gets the read-write lock of the index tree.
@return read-write lock */
UNIV_INLINE
diff --git a/storage/innodb_plugin/include/dict0mem.h b/storage/innodb_plugin/include/dict0mem.h
index bd32a239cfd..1b26aea38c9 100644
--- a/storage/innodb_plugin/include/dict0mem.h
+++ b/storage/innodb_plugin/include/dict0mem.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -305,7 +305,9 @@ struct dict_index_struct{
unsigned to_be_dropped:1;
/*!< TRUE if this index is marked to be
dropped in ha_innobase::prepare_drop_index(),
- otherwise FALSE */
+ otherwise FALSE. Protected by
+ dict_sys->mutex, dict_operation_lock and
+ index->lock.*/
dict_field_t* fields; /*!< array of field descriptions */
#ifndef UNIV_HOTBACKUP
UT_LIST_NODE_T(dict_index_t)
diff --git a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c
index b7df3479a3c..974d67893a3 100644
--- a/storage/innodb_plugin/row/row0mysql.c
+++ b/storage/innodb_plugin/row/row0mysql.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2012, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -3023,6 +3023,7 @@ row_drop_table_for_mysql(
{
dict_foreign_t* foreign;
dict_table_t* table;
+ dict_index_t* index;
ulint space_id;
ulint err;
const char* table_name;
@@ -3229,6 +3230,18 @@ check_next_foreign:
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
trx->table_id = table->id;
+ /* Mark all indexes unavailable in the data dictionary cache
+ before starting to drop the table. */
+
+ for (index = dict_table_get_first_index(table);
+ index != NULL;
+ index = dict_table_get_next_index(index)) {
+ rw_lock_x_lock(dict_index_get_lock(index));
+ ut_ad(!index->to_be_dropped);
+ index->to_be_dropped = TRUE;
+ rw_lock_x_unlock(dict_index_get_lock(index));
+ }
+
/* We use the private SQL parser of Innobase to generate the
query graphs needed in deleting the dictionary data from system
tables in Innobase. Deleting a row from SYS_INDEXES table also
@@ -3394,6 +3407,17 @@ check_next_foreign:
the undo log. We can directly exit here
and return the DB_TOO_MANY_CONCURRENT_TRXS
error. */
+
+ /* Mark all indexes available in the data dictionary
+ cache again. */
+
+ for (index = dict_table_get_first_index(table);
+ index != NULL;
+ index = dict_table_get_next_index(index)) {
+ rw_lock_x_lock(dict_index_get_lock(index));
+ index->to_be_dropped = FALSE;
+ rw_lock_x_unlock(dict_index_get_lock(index));
+ }
break;
case DB_OUT_OF_FILE_SPACE:
diff --git a/storage/innodb_plugin/row/row0row.c b/storage/innodb_plugin/row/row0row.c
index 7ec05f01821..c1f39fb68cb 100644
--- a/storage/innodb_plugin/row/row0row.c
+++ b/storage/innodb_plugin/row/row0row.c
@@ -245,15 +245,11 @@ row_build(
#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
if (rec_offs_any_null_extern(rec, offsets)) {
/* This condition can occur during crash recovery
- before trx_rollback_active() has completed execution.
-
- This condition is possible if the server crashed
- during an insert or update-by-delete-and-insert before
- btr_store_big_rec_extern_fields() did mtr_commit() all
- BLOB pointers to the freshly inserted clustered index
- record. */
- ut_a(trx_assert_recovered(
- row_get_rec_trx_id(rec, index, offsets)));
+ before trx_rollback_active() has completed execution,
+ or when a concurrently executing
+ row_ins_index_entry_low() has committed the B-tree
+ mini-transaction but has not yet managed to restore
+ the cursor position for writing the big_rec. */
ut_a(trx_undo_roll_ptr_is_insert(
row_get_rec_roll_ptr(rec, index, offsets)));
}