Commit 3bb32e86 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-10509: Remove excessive server error logging on InnoDB ALTER TABLE

Disable the output that was added in MDEV-6812 if log_warnings=2 or less.
Also, remove some redundant messages.

TODO: Implement MDEV-12512 to supercede MDEV-6812 and properly report
the progress of ALTER TABLE…ALGORITHM=INPLACE.
parent 16b2b1ea
/*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2017, MariaDB Corporation.
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
......@@ -25,6 +26,7 @@ Completed by Sunny Bains and Marko Makela
*******************************************************/
#include <my_config.h>
#include <log.h>
#include <sql_class.h>
#include "row0merge.h"
#include "row0ext.h"
......@@ -2628,7 +2630,11 @@ row_merge_sort(
}
#endif /* UNIV_SOLARIS */
sql_print_information("InnoDB: Online DDL : merge-sorting has estimated %lu runs", num_runs);
if (global_system_variables.log_warnings > 2) {
sql_print_information("InnoDB: Online DDL : merge-sorting"
" has estimated " ULINTPF " runs",
num_runs);
}
/* Merge the runs until we have one big run */
do {
......@@ -4057,9 +4063,11 @@ row_merge_build_indexes(
duplicate keys. */
innobase_rec_reset(table);
sql_print_information("InnoDB: Online DDL : Start");
sql_print_information("InnoDB: Online DDL : Start reading clustered "
"index of the table and create temporary files");
if (global_system_variables.log_warnings > 2) {
sql_print_information("InnoDB: Online DDL : Start reading"
" clustered index of the table"
" and create temporary files");
}
pct_cost = COST_READ_CLUSTERED_INDEX * 100 / (total_static_cost + total_dynamic_cost);
......@@ -4086,8 +4094,11 @@ row_merge_build_indexes(
pct_progress += pct_cost;
sql_print_information("InnoDB: Online DDL : End of reading "
"clustered index of the table and create temporary files");
if (global_system_variables.log_warnings > 2) {
sql_print_information("InnoDB: Online DDL : End of reading "
"clustered index of the table"
" and create temporary files");
}
for (i = 0; i < n_indexes; i++) {
total_index_blocks += merge_files[i].offset;
......@@ -4183,8 +4194,7 @@ row_merge_build_indexes(
DEBUG_FTS_SORT_PRINT("FTS_SORT: Complete Insert\n");
#endif
} else if (merge_files[i].fd != -1) {
char buf[3 * NAME_LEN];
char *bufend;
char buf[NAME_LEN + 1];
row_merge_dup_t dup = {
sort_idx, table, col_map, 0};
......@@ -4193,18 +4203,25 @@ row_merge_build_indexes(
total_index_blocks)) /
(total_static_cost + total_dynamic_cost)
* PCT_COST_MERGESORT_INDEX * 100;
bufend = innobase_convert_name(
char* bufend = innobase_convert_name(
buf, sizeof buf,
indexes[i]->name, strlen(indexes[i]->name),
indexes[i]->name,
strlen(indexes[i]->name),
trx->mysql_thd,
FALSE);
buf[bufend - buf]='\0';
sql_print_information("InnoDB: Online DDL : Start merge-sorting"
" index %s (%lu / %lu), estimated cost : %2.4f",
buf, (i+1), n_indexes, pct_cost);
if (global_system_variables.log_warnings > 2) {
sql_print_information("InnoDB: Online DDL :"
" Start merge-sorting"
" index %s"
" (" ULINTPF
" / " ULINTPF "),"
" estimated cost :"
" %2.4f",
buf, i + 1, n_indexes,
pct_cost);
}
error = row_merge_sort(
trx, &dup, &merge_files[i],
......@@ -4214,9 +4231,14 @@ row_merge_build_indexes(
pct_progress += pct_cost;
sql_print_information("InnoDB: Online DDL : End of "
" merge-sorting index %s (%lu / %lu)",
buf, (i+1), n_indexes);
if (global_system_variables.log_warnings > 2) {
sql_print_information("InnoDB: Online DDL :"
" End of "
" merge-sorting index %s"
" (" ULINTPF
" / " ULINTPF ")",
buf, i + 1, n_indexes);
}
DBUG_EXECUTE_IF(
"ib_merge_wait_after_sort",
......@@ -4229,10 +4251,15 @@ row_merge_build_indexes(
(total_static_cost + total_dynamic_cost) *
PCT_COST_INSERT_INDEX * 100;
sql_print_information("InnoDB: Online DDL : Start "
"building index %s (%lu / %lu), estimated "
"cost : %2.4f", buf, (i+1),
n_indexes, pct_cost);
if (global_system_variables.log_warnings > 2) {
sql_print_information(
"InnoDB: Online DDL : Start "
"building index %s"
" (" ULINTPF
" / " ULINTPF "), estimated "
"cost : %2.4f", buf, i + 1,
n_indexes, pct_cost);
}
error = row_merge_insert_index_tuples(
trx->id, sort_idx, old_table,
......@@ -4241,9 +4268,13 @@ row_merge_build_indexes(
crypt_data, crypt_block, new_table->space);
pct_progress += pct_cost;
sql_print_information("InnoDB: Online DDL : "
"End of building index %s (%lu / %lu)",
buf, (i+1), n_indexes);
if (global_system_variables.log_warnings > 2) {
sql_print_information(
"InnoDB: Online DDL : "
"End of building index %s"
" (" ULINTPF " / " ULINTPF ")",
buf, i + 1, n_indexes);
}
}
}
......@@ -4260,15 +4291,16 @@ row_merge_build_indexes(
ut_ad(sort_idx->online_status
== ONLINE_INDEX_COMPLETE);
} else {
sql_print_information("InnoDB: Online DDL : Start applying row log");
if (global_system_variables.log_warnings > 2) {
sql_print_information(
"InnoDB: Online DDL : Applying"
" log to index");
}
DEBUG_SYNC_C("row_log_apply_before");
error = row_log_apply(trx, sort_idx, table);
DEBUG_SYNC_C("row_log_apply_after");
sql_print_information("InnoDB: Online DDL : End of applying row log");
}
sql_print_information("InnoDB: Online DDL : Completed");
if (error != DB_SUCCESS) {
trx->error_key_num = key_numbers[i];
goto func_exit;
......
/*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2014, 2017, MariaDB Corporation.
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
......@@ -26,6 +26,7 @@ Completed by Sunny Bains and Marko Makela
*******************************************************/
#include <my_config.h>
#include <log.h>
#include <sql_class.h>
#include "row0merge.h"
#include "row0ext.h"
......@@ -2635,7 +2636,11 @@ row_merge_sort(
thd_progress_init(trx->mysql_thd, 1);
}
sql_print_information("InnoDB: Online DDL : merge-sorting has estimated %lu runs", num_runs);
if (global_system_variables.log_warnings > 2) {
sql_print_information("InnoDB: Online DDL : merge-sorting"
" has estimated " ULINTPF " runs",
num_runs);
}
/* Merge the runs until we have one big run */
do {
......@@ -4060,9 +4065,11 @@ row_merge_build_indexes(
duplicate keys. */
innobase_rec_reset(table);
sql_print_information("InnoDB: Online DDL : Start");
sql_print_information("InnoDB: Online DDL : Start reading clustered "
"index of the table and create temporary files");
if (global_system_variables.log_warnings > 2) {
sql_print_information("InnoDB: Online DDL : Start reading"
" clustered index of the table"
" and create temporary files");
}
pct_cost = COST_READ_CLUSTERED_INDEX * 100 / (total_static_cost + total_dynamic_cost);
......@@ -4089,8 +4096,11 @@ row_merge_build_indexes(
pct_progress += pct_cost;
sql_print_information("InnoDB: Online DDL : End of reading "
"clustered index of the table and create temporary files");
if (global_system_variables.log_warnings > 2) {
sql_print_information("InnoDB: Online DDL : End of reading "
"clustered index of the table"
" and create temporary files");
}
for (i = 0; i < n_indexes; i++) {
total_index_blocks += merge_files[i].offset;
......@@ -4186,8 +4196,7 @@ row_merge_build_indexes(
DEBUG_FTS_SORT_PRINT("FTS_SORT: Complete Insert\n");
#endif
} else if (merge_files[i].fd != -1) {
char buf[3 * NAME_LEN];
char *bufend;
char buf[NAME_LEN + 1];
row_merge_dup_t dup = {
sort_idx, table, col_map, 0};
......@@ -4196,18 +4205,25 @@ row_merge_build_indexes(
total_index_blocks)) /
(total_static_cost + total_dynamic_cost)
* PCT_COST_MERGESORT_INDEX * 100;
bufend = innobase_convert_name(
char* bufend = innobase_convert_name(
buf, sizeof buf,
indexes[i]->name, strlen(indexes[i]->name),
indexes[i]->name,
strlen(indexes[i]->name),
trx->mysql_thd,
FALSE);
buf[bufend - buf]='\0';
sql_print_information("InnoDB: Online DDL : Start merge-sorting"
" index %s (%lu / %lu), estimated cost : %2.4f",
buf, (i+1), n_indexes, pct_cost);
if (global_system_variables.log_warnings > 2) {
sql_print_information("InnoDB: Online DDL :"
" Start merge-sorting"
" index %s"
" (" ULINTPF
" / " ULINTPF "),"
" estimated cost :"
" %2.4f",
buf, i + 1, n_indexes,
pct_cost);
}
error = row_merge_sort(
trx, &dup, &merge_files[i],
......@@ -4217,9 +4233,14 @@ row_merge_build_indexes(
pct_progress += pct_cost;
sql_print_information("InnoDB: Online DDL : End of "
" merge-sorting index %s (%lu / %lu)",
buf, (i+1), n_indexes);
if (global_system_variables.log_warnings > 2) {
sql_print_information("InnoDB: Online DDL :"
" End of "
" merge-sorting index %s"
" (" ULINTPF
" / " ULINTPF ")",
buf, i + 1, n_indexes);
}
DBUG_EXECUTE_IF(
"ib_merge_wait_after_sort",
......@@ -4232,10 +4253,15 @@ row_merge_build_indexes(
(total_static_cost + total_dynamic_cost) *
PCT_COST_INSERT_INDEX * 100;
sql_print_information("InnoDB: Online DDL : Start "
"building index %s (%lu / %lu), estimated "
"cost : %2.4f", buf, (i+1),
n_indexes, pct_cost);
if (global_system_variables.log_warnings > 2) {
sql_print_information(
"InnoDB: Online DDL : Start "
"building index %s"
" (" ULINTPF
" / " ULINTPF "), estimated "
"cost : %2.4f", buf, i + 1,
n_indexes, pct_cost);
}
error = row_merge_insert_index_tuples(
trx->id, sort_idx, old_table,
......@@ -4244,9 +4270,13 @@ row_merge_build_indexes(
crypt_data, crypt_block, new_table->space);
pct_progress += pct_cost;
sql_print_information("InnoDB: Online DDL : "
"End of building index %s (%lu / %lu)",
buf, (i+1), n_indexes);
if (global_system_variables.log_warnings > 2) {
sql_print_information(
"InnoDB: Online DDL : "
"End of building index %s"
" (" ULINTPF " / " ULINTPF ")",
buf, i + 1, n_indexes);
}
}
}
......@@ -4263,15 +4293,16 @@ row_merge_build_indexes(
ut_ad(sort_idx->online_status
== ONLINE_INDEX_COMPLETE);
} else {
sql_print_information("InnoDB: Online DDL : Start applying row log");
if (global_system_variables.log_warnings > 2) {
sql_print_information(
"InnoDB: Online DDL : Applying"
" log to index");
}
DEBUG_SYNC_C("row_log_apply_before");
error = row_log_apply(trx, sort_idx, table);
DEBUG_SYNC_C("row_log_apply_after");
sql_print_information("InnoDB: Online DDL : End of applying row log");
}
sql_print_information("InnoDB: Online DDL : Completed");
if (error != DB_SUCCESS) {
trx->error_key_num = key_numbers[i];
goto func_exit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment