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