diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2018-04-19 14:11:53 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2018-04-19 14:13:28 +0300 |
commit | 0c02c91bc144a79c77fc5d5f0d28184c90f34933 (patch) | |
tree | 5a248b0a65efb124939c822d0732a16b9bce5ccd | |
parent | efae12680e7a245a6bdc919a67c2ec17ed6ddfda (diff) | |
download | mariadb-git-0c02c91bc144a79c77fc5d5f0d28184c90f34933.tar.gz |
MyRocks: MDEV-15911: Reduce debug logging on default levels in error log
MyRocks internally will print non-critical messages to
sql_print_verbose_info() which will do what InnoDB does in similar cases:
check if (global_system_variables.log_warnings > 2).
-rw-r--r-- | sql/log.cc | 12 | ||||
-rw-r--r-- | sql/log.h | 1 | ||||
-rw-r--r-- | storage/rocksdb/ha_rocksdb.cc | 34 | ||||
-rw-r--r-- | storage/rocksdb/ha_rocksdb.h | 4 | ||||
-rw-r--r-- | storage/rocksdb/rdb_datadic.cc | 8 |
5 files changed, 40 insertions, 19 deletions
diff --git a/sql/log.cc b/sql/log.cc index f1a0834217a..7241aa68fec 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -8747,16 +8747,20 @@ void sql_print_information(const char *format, ...) va_list args; DBUG_ENTER("sql_print_information"); - if (disable_log_notes) - DBUG_VOID_RETURN; // Skip notes during start/shutdown - va_start(args, format); - error_log_print(INFORMATION_LEVEL, format, args); + sql_print_information_v(format, args); va_end(args); DBUG_VOID_RETURN; } +void sql_print_information_v(const char *format, va_list ap) +{ + if (disable_log_notes) + return; // Skip notes during start/shutdown + + error_log_print(INFORMATION_LEVEL, format, ap); +} void TC_LOG::run_prepare_ordered(THD *thd, bool all) diff --git a/sql/log.h b/sql/log.h index c09ae14e02b..2a3912a52d3 100644 --- a/sql/log.h +++ b/sql/log.h @@ -1075,6 +1075,7 @@ int vprint_msg_to_log(enum loglevel level, const char *format, va_list args); void sql_print_error(const char *format, ...); void sql_print_warning(const char *format, ...); void sql_print_information(const char *format, ...); +void sql_print_information_v(const char *format, va_list ap); typedef void (*sql_print_message_func)(const char *format, ...); extern sql_print_message_func sql_print_message_handlers[]; diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 18d5c6ee9a2..03086db3da9 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -220,8 +220,8 @@ static int rocksdb_compact_column_family(THD *const thd, if (const char *const cf = value->val_str(value, buff, &len)) { auto cfh = cf_manager.get_cf(cf); if (cfh != nullptr && rdb != nullptr) { - sql_print_information("RocksDB: Manual compaction of column family: %s\n", - cf); + sql_print_verbose_info("RocksDB: Manual compaction of column family: %s\n", + cf); rdb->CompactRange(getCompactRangeOptions(), cfh, nullptr, nullptr); } } @@ -7776,8 +7776,8 @@ int ha_rocksdb::check(THD *const thd, HA_CHECK_OPT *const check_opt) { /* For each secondary index, check that we can get a PK value from it */ // NO_LINT_DEBUG - sql_print_information("CHECKTABLE %s: Checking table %s", table_name, - table_name); + sql_print_verbose_info("CHECKTABLE %s: Checking table %s", table_name, + table_name); ha_rows UNINIT_VAR(row_checksums_at_start); // set/used iff first_index==true ha_rows row_checksums = ha_rows(-1); bool first_index = true; @@ -7792,8 +7792,8 @@ int ha_rocksdb::check(THD *const thd, HA_CHECK_OPT *const check_opt) { row_checksums_at_start = m_row_checksums_checked; int res; // NO_LINT_DEBUG - sql_print_information("CHECKTABLE %s: Checking index %s", table_name, - table->key_info[keyno].name); + sql_print_verbose_info("CHECKTABLE %s: Checking index %s", table_name, + table->key_info[keyno].name); while (1) { if (!rows) res = index_first(table->record[0]); @@ -7881,9 +7881,9 @@ int ha_rocksdb::check(THD *const thd, HA_CHECK_OPT *const check_opt) { } } // NO_LINT_DEBUG - sql_print_information("CHECKTABLE %s: ... %lld index entries checked " - "(%lld had checksums)", - table_name, rows, checksums); + sql_print_verbose_info("CHECKTABLE %s: ... %lld index entries checked " + "(%lld had checksums)", + table_name, rows, checksums); if (first_index) { row_checksums = m_row_checksums_checked - row_checksums_at_start; @@ -7894,8 +7894,8 @@ int ha_rocksdb::check(THD *const thd, HA_CHECK_OPT *const check_opt) { } if (row_checksums != ha_rows(-1)) { // NO_LINT_DEBUG - sql_print_information("CHECKTABLE %s: %lld table records had checksums", - table_name, row_checksums); + sql_print_verbose_info("CHECKTABLE %s: %lld table records had checksums", + table_name, row_checksums); } extra(HA_EXTRA_NO_KEYREAD); @@ -12655,8 +12655,20 @@ double ha_rocksdb::read_time(uint index, uint ranges, ha_rows rows) { DBUG_RETURN((rows / 20.0) + 1); } +void sql_print_verbose_info(const char *format, ...) +{ + va_list args; + + if (global_system_variables.log_warnings > 2) { + va_start(args, format); + sql_print_information_v(format, args); + va_end(args); + } +} + } // namespace myrocks + /** Construct and emit duplicate key error message using information from table's record buffer. diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h index 31adef85507..d929ca15093 100644 --- a/storage/rocksdb/ha_rocksdb.h +++ b/storage/rocksdb/ha_rocksdb.h @@ -1415,4 +1415,8 @@ private: const int MYROCKS_MARIADB_PLUGIN_MATURITY_LEVEL= MariaDB_PLUGIN_MATURITY_GAMMA; extern bool prevent_myrocks_loading; + +void sql_print_verbose_info(const char *format, ...); + } // namespace myrocks + diff --git a/storage/rocksdb/rdb_datadic.cc b/storage/rocksdb/rdb_datadic.cc index 68ad8e091b2..01dc2d6b176 100644 --- a/storage/rocksdb/rdb_datadic.cc +++ b/storage/rocksdb/rdb_datadic.cc @@ -4906,8 +4906,8 @@ void Rdb_dict_manager::add_create_index( rocksdb::WriteBatch *const batch) const { for (const auto &gl_index_id : gl_index_ids) { // NO_LINT_DEBUG - sql_print_information("RocksDB: Begin index creation (%u,%u)", - gl_index_id.cf_id, gl_index_id.index_id); + sql_print_verbose_info("RocksDB: Begin index creation (%u,%u)", + gl_index_id.cf_id, gl_index_id.index_id); start_create_index(batch, gl_index_id); } } @@ -4986,8 +4986,8 @@ void Rdb_dict_manager::rollback_ongoing_index_creation() const { for (const auto &gl_index_id : gl_index_ids) { // NO_LINT_DEBUG - sql_print_information("RocksDB: Removing incomplete create index (%u,%u)", - gl_index_id.cf_id, gl_index_id.index_id); + sql_print_verbose_info("RocksDB: Removing incomplete create index (%u,%u)", + gl_index_id.cf_id, gl_index_id.index_id); start_drop_index(batch, gl_index_id); } |