Merge mysql-5.1 to mysql-5.5.
This commit is contained in:
commit
29e12caee8
@ -1012,45 +1012,49 @@ btr_page_alloc(
|
|||||||
|
|
||||||
/**************************************************************//**
|
/**************************************************************//**
|
||||||
Gets the number of pages in a B-tree.
|
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
|
UNIV_INTERN
|
||||||
ulint
|
ulint
|
||||||
btr_get_size(
|
btr_get_size(
|
||||||
/*=========*/
|
/*=========*/
|
||||||
dict_index_t* index, /*!< in: index */
|
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;
|
fseg_header_t* seg_header;
|
||||||
page_t* root;
|
page_t* root;
|
||||||
ulint n;
|
ulint n;
|
||||||
ulint dummy;
|
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) {
|
if (flag == BTR_N_LEAF_PAGES) {
|
||||||
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
|
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) {
|
} else if (flag == BTR_TOTAL_SIZE) {
|
||||||
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_TOP;
|
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;
|
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 {
|
} else {
|
||||||
ut_error;
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
mtr_commit(&mtr);
|
|
||||||
|
|
||||||
return(n);
|
return(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4337,16 +4337,27 @@ dict_update_statistics(
|
|||||||
(srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE
|
(srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE
|
||||||
|| (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
|
|| (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
|
||||||
&& dict_index_is_clust(index)))) {
|
&& dict_index_is_clust(index)))) {
|
||||||
|
mtr_t mtr;
|
||||||
ulint size;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
if (size == 0) {
|
mtr_commit(&mtr);
|
||||||
|
|
||||||
|
switch (size) {
|
||||||
|
case ULINT_UNDEFINED:
|
||||||
|
goto fake_statistics;
|
||||||
|
case 0:
|
||||||
/* The root node of the tree is a leaf */
|
/* The root node of the tree is a leaf */
|
||||||
size = 1;
|
size = 1;
|
||||||
}
|
}
|
||||||
@ -4363,6 +4374,7 @@ dict_update_statistics(
|
|||||||
various means, also via secondary indexes. */
|
various means, also via secondary indexes. */
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
|
fake_statistics:
|
||||||
sum_of_index_sizes++;
|
sum_of_index_sizes++;
|
||||||
index->stat_index_size = index->stat_n_leaf_pages = 1;
|
index->stat_index_size = index->stat_n_leaf_pages = 1;
|
||||||
|
|
||||||
|
@ -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
|
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
|
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.
|
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
|
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
|
this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
@ -1143,7 +1143,9 @@ ha_innobase::prepare_drop_index(
|
|||||||
goto func_exit;
|
goto func_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rw_lock_x_lock(dict_index_get_lock(index));
|
||||||
index->to_be_dropped = TRUE;
|
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
|
/* If FOREIGN_KEY_CHECKS = 1 you may not drop an index defined
|
||||||
@ -1262,7 +1264,9 @@ func_exit:
|
|||||||
= dict_table_get_first_index(prebuilt->table);
|
= dict_table_get_first_index(prebuilt->table);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
rw_lock_x_lock(dict_index_get_lock(index));
|
||||||
index->to_be_dropped = FALSE;
|
index->to_be_dropped = FALSE;
|
||||||
|
rw_lock_x_unlock(dict_index_get_lock(index));
|
||||||
index = dict_table_get_next_index(index);
|
index = dict_table_get_next_index(index);
|
||||||
} while (index);
|
} while (index);
|
||||||
}
|
}
|
||||||
@ -1322,7 +1326,9 @@ ha_innobase::final_drop_index(
|
|||||||
for (index = dict_table_get_first_index(prebuilt->table);
|
for (index = dict_table_get_first_index(prebuilt->table);
|
||||||
index; index = dict_table_get_next_index(index)) {
|
index; index = dict_table_get_next_index(index)) {
|
||||||
|
|
||||||
|
rw_lock_x_lock(dict_index_get_lock(index));
|
||||||
index->to_be_dropped = FALSE;
|
index->to_be_dropped = FALSE;
|
||||||
|
rw_lock_x_unlock(dict_index_get_lock(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
goto func_exit;
|
goto func_exit;
|
||||||
|
@ -567,13 +567,16 @@ btr_parse_page_reorganize(
|
|||||||
#ifndef UNIV_HOTBACKUP
|
#ifndef UNIV_HOTBACKUP
|
||||||
/**************************************************************//**
|
/**************************************************************//**
|
||||||
Gets the number of pages in a B-tree.
|
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
|
UNIV_INTERN
|
||||||
ulint
|
ulint
|
||||||
btr_get_size(
|
btr_get_size(
|
||||||
/*=========*/
|
/*=========*/
|
||||||
dict_index_t* index, /*!< in: index */
|
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
|
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!
|
that the caller has made the reservation for free extents!
|
||||||
|
@ -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
|
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
|
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.
|
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
|
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
|
this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
@ -1087,14 +1087,6 @@ dict_index_get_page(
|
|||||||
/*================*/
|
/*================*/
|
||||||
const dict_index_t* tree); /*!< in: index */
|
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.
|
Gets the read-write lock of the index tree.
|
||||||
@return read-write lock */
|
@return read-write lock */
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
|
@ -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
|
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
|
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.
|
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
|
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
|
this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
@ -761,21 +761,6 @@ dict_index_get_page(
|
|||||||
return(index->page);
|
return(index->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.
|
Gets the read-write lock of the index tree.
|
||||||
@return read-write lock */
|
@return read-write lock */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 1996, 2010, 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
|
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
|
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.
|
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
|
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
|
this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
@ -396,7 +396,9 @@ struct dict_index_struct{
|
|||||||
unsigned to_be_dropped:1;
|
unsigned to_be_dropped:1;
|
||||||
/*!< TRUE if this index is marked to be
|
/*!< TRUE if this index is marked to be
|
||||||
dropped in ha_innobase::prepare_drop_index(),
|
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 */
|
dict_field_t* fields; /*!< array of field descriptions */
|
||||||
#ifndef UNIV_HOTBACKUP
|
#ifndef UNIV_HOTBACKUP
|
||||||
UT_LIST_NODE_T(dict_index_t)
|
UT_LIST_NODE_T(dict_index_t)
|
||||||
|
@ -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
|
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
|
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.
|
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
|
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
|
this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
@ -3075,6 +3075,7 @@ row_drop_table_for_mysql(
|
|||||||
{
|
{
|
||||||
dict_foreign_t* foreign;
|
dict_foreign_t* foreign;
|
||||||
dict_table_t* table;
|
dict_table_t* table;
|
||||||
|
dict_index_t* index;
|
||||||
ulint space_id;
|
ulint space_id;
|
||||||
ulint err;
|
ulint err;
|
||||||
const char* table_name;
|
const char* table_name;
|
||||||
@ -3368,6 +3369,18 @@ check_next_foreign:
|
|||||||
"END;\n"
|
"END;\n"
|
||||||
, FALSE, trx);
|
, FALSE, trx);
|
||||||
|
|
||||||
|
/* 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));
|
||||||
|
}
|
||||||
|
|
||||||
switch (err) {
|
switch (err) {
|
||||||
ibool is_temp;
|
ibool is_temp;
|
||||||
const char* name_or_path;
|
const char* name_or_path;
|
||||||
@ -3447,6 +3460,17 @@ check_next_foreign:
|
|||||||
the undo log. We can directly exit here
|
the undo log. We can directly exit here
|
||||||
and return the DB_TOO_MANY_CONCURRENT_TRXS
|
and return the DB_TOO_MANY_CONCURRENT_TRXS
|
||||||
error. */
|
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;
|
break;
|
||||||
|
|
||||||
case DB_OUT_OF_FILE_SPACE:
|
case DB_OUT_OF_FILE_SPACE:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user