Commit 0c02c91b authored by Sergei Petrunia's avatar Sergei Petrunia

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).
parent efae1268
...@@ -8747,16 +8747,20 @@ void sql_print_information(const char *format, ...) ...@@ -8747,16 +8747,20 @@ void sql_print_information(const char *format, ...)
va_list args; va_list args;
DBUG_ENTER("sql_print_information"); DBUG_ENTER("sql_print_information");
if (disable_log_notes)
DBUG_VOID_RETURN; // Skip notes during start/shutdown
va_start(args, format); va_start(args, format);
error_log_print(INFORMATION_LEVEL, format, args); sql_print_information_v(format, args);
va_end(args); va_end(args);
DBUG_VOID_RETURN; 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 void
TC_LOG::run_prepare_ordered(THD *thd, bool all) TC_LOG::run_prepare_ordered(THD *thd, bool all)
......
...@@ -1075,6 +1075,7 @@ int vprint_msg_to_log(enum loglevel level, const char *format, va_list args); ...@@ -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_error(const char *format, ...);
void sql_print_warning(const char *format, ...); void sql_print_warning(const char *format, ...);
void sql_print_information(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, ...); typedef void (*sql_print_message_func)(const char *format, ...);
extern sql_print_message_func sql_print_message_handlers[]; extern sql_print_message_func sql_print_message_handlers[];
......
...@@ -220,8 +220,8 @@ static int rocksdb_compact_column_family(THD *const thd, ...@@ -220,8 +220,8 @@ static int rocksdb_compact_column_family(THD *const thd,
if (const char *const cf = value->val_str(value, buff, &len)) { if (const char *const cf = value->val_str(value, buff, &len)) {
auto cfh = cf_manager.get_cf(cf); auto cfh = cf_manager.get_cf(cf);
if (cfh != nullptr && rdb != nullptr) { if (cfh != nullptr && rdb != nullptr) {
sql_print_information("RocksDB: Manual compaction of column family: %s\n", sql_print_verbose_info("RocksDB: Manual compaction of column family: %s\n",
cf); cf);
rdb->CompactRange(getCompactRangeOptions(), cfh, nullptr, nullptr); rdb->CompactRange(getCompactRangeOptions(), cfh, nullptr, nullptr);
} }
} }
...@@ -7776,8 +7776,8 @@ int ha_rocksdb::check(THD *const thd, HA_CHECK_OPT *const check_opt) { ...@@ -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 */ /* For each secondary index, check that we can get a PK value from it */
// NO_LINT_DEBUG // NO_LINT_DEBUG
sql_print_information("CHECKTABLE %s: Checking table %s", table_name, sql_print_verbose_info("CHECKTABLE %s: Checking table %s", table_name,
table_name); table_name);
ha_rows UNINIT_VAR(row_checksums_at_start); // set/used iff first_index==true ha_rows UNINIT_VAR(row_checksums_at_start); // set/used iff first_index==true
ha_rows row_checksums = ha_rows(-1); ha_rows row_checksums = ha_rows(-1);
bool first_index = true; bool first_index = true;
...@@ -7792,8 +7792,8 @@ int ha_rocksdb::check(THD *const thd, HA_CHECK_OPT *const check_opt) { ...@@ -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; row_checksums_at_start = m_row_checksums_checked;
int res; int res;
// NO_LINT_DEBUG // NO_LINT_DEBUG
sql_print_information("CHECKTABLE %s: Checking index %s", table_name, sql_print_verbose_info("CHECKTABLE %s: Checking index %s", table_name,
table->key_info[keyno].name); table->key_info[keyno].name);
while (1) { while (1) {
if (!rows) if (!rows)
res = index_first(table->record[0]); res = index_first(table->record[0]);
...@@ -7881,9 +7881,9 @@ int ha_rocksdb::check(THD *const thd, HA_CHECK_OPT *const check_opt) { ...@@ -7881,9 +7881,9 @@ int ha_rocksdb::check(THD *const thd, HA_CHECK_OPT *const check_opt) {
} }
} }
// NO_LINT_DEBUG // NO_LINT_DEBUG
sql_print_information("CHECKTABLE %s: ... %lld index entries checked " sql_print_verbose_info("CHECKTABLE %s: ... %lld index entries checked "
"(%lld had checksums)", "(%lld had checksums)",
table_name, rows, checksums); table_name, rows, checksums);
if (first_index) { if (first_index) {
row_checksums = m_row_checksums_checked - row_checksums_at_start; 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) { ...@@ -7894,8 +7894,8 @@ int ha_rocksdb::check(THD *const thd, HA_CHECK_OPT *const check_opt) {
} }
if (row_checksums != ha_rows(-1)) { if (row_checksums != ha_rows(-1)) {
// NO_LINT_DEBUG // NO_LINT_DEBUG
sql_print_information("CHECKTABLE %s: %lld table records had checksums", sql_print_verbose_info("CHECKTABLE %s: %lld table records had checksums",
table_name, row_checksums); table_name, row_checksums);
} }
extra(HA_EXTRA_NO_KEYREAD); extra(HA_EXTRA_NO_KEYREAD);
...@@ -12655,8 +12655,20 @@ double ha_rocksdb::read_time(uint index, uint ranges, ha_rows rows) { ...@@ -12655,8 +12655,20 @@ double ha_rocksdb::read_time(uint index, uint ranges, ha_rows rows) {
DBUG_RETURN((rows / 20.0) + 1); 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 } // namespace myrocks
/** /**
Construct and emit duplicate key error message using information Construct and emit duplicate key error message using information
from table's record buffer. from table's record buffer.
......
...@@ -1415,4 +1415,8 @@ struct Rdb_inplace_alter_ctx : public my_core::inplace_alter_handler_ctx { ...@@ -1415,4 +1415,8 @@ struct Rdb_inplace_alter_ctx : public my_core::inplace_alter_handler_ctx {
const int MYROCKS_MARIADB_PLUGIN_MATURITY_LEVEL= MariaDB_PLUGIN_MATURITY_GAMMA; const int MYROCKS_MARIADB_PLUGIN_MATURITY_LEVEL= MariaDB_PLUGIN_MATURITY_GAMMA;
extern bool prevent_myrocks_loading; extern bool prevent_myrocks_loading;
void sql_print_verbose_info(const char *format, ...);
} // namespace myrocks } // namespace myrocks
...@@ -4906,8 +4906,8 @@ void Rdb_dict_manager::add_create_index( ...@@ -4906,8 +4906,8 @@ void Rdb_dict_manager::add_create_index(
rocksdb::WriteBatch *const batch) const { rocksdb::WriteBatch *const batch) const {
for (const auto &gl_index_id : gl_index_ids) { for (const auto &gl_index_id : gl_index_ids) {
// NO_LINT_DEBUG // NO_LINT_DEBUG
sql_print_information("RocksDB: Begin index creation (%u,%u)", sql_print_verbose_info("RocksDB: Begin index creation (%u,%u)",
gl_index_id.cf_id, gl_index_id.index_id); gl_index_id.cf_id, gl_index_id.index_id);
start_create_index(batch, gl_index_id); start_create_index(batch, gl_index_id);
} }
} }
...@@ -4986,8 +4986,8 @@ void Rdb_dict_manager::rollback_ongoing_index_creation() const { ...@@ -4986,8 +4986,8 @@ void Rdb_dict_manager::rollback_ongoing_index_creation() const {
for (const auto &gl_index_id : gl_index_ids) { for (const auto &gl_index_id : gl_index_ids) {
// NO_LINT_DEBUG // NO_LINT_DEBUG
sql_print_information("RocksDB: Removing incomplete create index (%u,%u)", sql_print_verbose_info("RocksDB: Removing incomplete create index (%u,%u)",
gl_index_id.cf_id, gl_index_id.index_id); gl_index_id.cf_id, gl_index_id.index_id);
start_drop_index(batch, gl_index_id); start_drop_index(batch, gl_index_id);
} }
......
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