summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorAnil Toshniwal <anil.toshniwal@oracle.com>2013-10-17 18:09:04 +0530
committerAnil Toshniwal <anil.toshniwal@oracle.com>2013-10-17 18:09:04 +0530
commitccfd3a0e750664b68fd229bfa22910bf9a68aeb0 (patch)
tree0325a35bb64806c53b6dcd11aca164adea2882aa /storage
parentb3d390959bf6269a6e9572816400b18f735835d7 (diff)
downloadmariadb-git-ccfd3a0e750664b68fd229bfa22910bf9a68aeb0.tar.gz
Bug#17513737 INTRODUCE CHECK TABLE...QUICK
--Implemented CHECK TABLE...QUICK. Introduce CHECK TABLE...QUICK that would skip the btr_validate_index() and btr_search_validate() call, and count the no. of records in each index. Approved by Marko and Kevin. (rb#3567).
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/dict/dict0dict.c2
-rw-r--r--storage/innobase/handler/ha_innodb.cc68
-rw-r--r--storage/innobase/include/btr0sea.h2
3 files changed, 42 insertions, 30 deletions
diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
index 1fe7000f718..546794be26c 100644
--- a/storage/innobase/dict/dict0dict.c
+++ b/storage/innobase/dict/dict0dict.c
@@ -4485,6 +4485,8 @@ dict_update_statistics(
dict_index_t* index;
ulint sum_of_index_sizes = 0;
+ DBUG_EXECUTE_IF("skip_innodb_statistics", return;);
+
if (table->ibd_file_missing) {
ut_print_timestamp(stderr);
fprintf(stderr,
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 7d0a363be69..546b0b8905b 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -53,6 +53,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include <mysql/innodb_priv.h>
#include <mysql/psi/psi.h>
#include <my_sys.h>
+#include <my_check_opt.h>
/** @file ha_innodb.cc */
@@ -8466,8 +8467,7 @@ int
ha_innobase::check(
/*===============*/
THD* thd, /*!< in: user thread handle */
- HA_CHECK_OPT* check_opt) /*!< in: check options, currently
- ignored */
+ HA_CHECK_OPT* check_opt) /*!< in: check options */
{
dict_index_t* index;
ulint n_rows;
@@ -8524,11 +8524,6 @@ ha_innobase::check(
do additional check */
prebuilt->table->corrupted = FALSE;
- /* Enlarge the fatal lock wait timeout during CHECK TABLE. */
- mutex_enter(&kernel_mutex);
- srv_fatal_semaphore_wait_threshold += SRV_SEMAPHORE_WAIT_EXTENSION;
- mutex_exit(&kernel_mutex);
-
for (index = dict_table_get_first_index(prebuilt->table);
index != NULL;
index = dict_table_get_next_index(index)) {
@@ -8541,20 +8536,41 @@ ha_innobase::check(
/* If this is an index being created, break */
if (*index->name == TEMP_INDEX_PREFIX) {
- break;
- } else if (!btr_validate_index(index, prebuilt->trx)) {
- is_ok = FALSE;
+ continue;
+ }
+ if (!(check_opt->flags & T_QUICK)) {
+ /* Enlarge the fatal lock wait timeout during
+ CHECK TABLE. */
+ mutex_enter(&kernel_mutex);
+ srv_fatal_semaphore_wait_threshold +=
+ SRV_SEMAPHORE_WAIT_EXTENSION;
+ mutex_exit(&kernel_mutex);
+
+ ibool valid = TRUE;
+ valid = btr_validate_index(index, prebuilt->trx);
+
+ /* Restore the fatal lock wait timeout after
+ CHECK TABLE. */
+ mutex_enter(&kernel_mutex);
+ srv_fatal_semaphore_wait_threshold -=
+ SRV_SEMAPHORE_WAIT_EXTENSION;
+ mutex_exit(&kernel_mutex);
+
+ if (!valid) {
+ is_ok = FALSE;
- innobase_format_name(
- index_name, sizeof index_name,
- prebuilt->index->name, TRUE);
+ innobase_format_name(
+ index_name, sizeof index_name,
+ index->name, TRUE);
+ push_warning_printf(thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_NOT_KEYFILE,
+ "InnoDB: The B-tree of"
+ " index %s is corrupted.",
+ index_name);
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_NOT_KEYFILE,
- "InnoDB: The B-tree of"
- " index %s is corrupted.",
- index_name);
- continue;
+ continue;
+ }
}
/* Instead of invoking change_active_index(), set up
@@ -8658,21 +8674,17 @@ ha_innobase::check(
/* Restore the original isolation level */
prebuilt->trx->isolation_level = old_isolation_level;
- /* We validate also the whole adaptive hash index for all tables
- at every CHECK TABLE */
+#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
+ /* We validate the whole adaptive hash index for all tables
+ at every CHECK TABLE only when QUICK flag is not present. */
- if (!btr_search_validate()) {
+ if (!(check_opt->flags & T_QUICK) && !btr_search_validate()) {
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_NOT_KEYFILE,
"InnoDB: The adaptive hash index is corrupted.");
is_ok = FALSE;
}
-
- /* Restore the fatal lock wait timeout after CHECK TABLE. */
- mutex_enter(&kernel_mutex);
- srv_fatal_semaphore_wait_threshold -= SRV_SEMAPHORE_WAIT_EXTENSION;
- mutex_exit(&kernel_mutex);
-
+#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
prebuilt->trx->op_info = "";
if (thd_killed(user_thd)) {
my_error(ER_QUERY_INTERRUPTED, MYF(0));
diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h
index 0ee68101ee7..081dc88435e 100644
--- a/storage/innobase/include/btr0sea.h
+++ b/storage/innobase/include/btr0sea.h
@@ -188,8 +188,6 @@ UNIV_INTERN
ibool
btr_search_validate(void);
/*======================*/
-#else
-# define btr_search_validate() TRUE
#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
/** The search info struct in an index */