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, ...)
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)
......
......@@ -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[];
......
......@@ -220,7 +220,7 @@ 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",
sql_print_verbose_info("RocksDB: Manual compaction of column family: %s\n",
cf);
rdb->CompactRange(getCompactRangeOptions(), cfh, nullptr, nullptr);
}
......@@ -7776,7 +7776,7 @@ 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,
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);
......@@ -7792,7 +7792,7 @@ 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,
sql_print_verbose_info("CHECKTABLE %s: Checking index %s", table_name,
table->key_info[keyno].name);
while (1) {
if (!rows)
......@@ -7881,7 +7881,7 @@ 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 "
sql_print_verbose_info("CHECKTABLE %s: ... %lld index entries checked "
"(%lld had checksums)",
table_name, rows, checksums);
......@@ -7894,7 +7894,7 @@ 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",
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.
......
......@@ -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;
extern bool prevent_myrocks_loading;
void sql_print_verbose_info(const char *format, ...);
} // namespace myrocks
......@@ -4906,7 +4906,7 @@ 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)",
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,7 +4986,7 @@ 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)",
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);
......
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