diff --git a/dbms/src/TiDB/Schema/SchemaBuilder.cpp b/dbms/src/TiDB/Schema/SchemaBuilder.cpp index cf769181b6c..328769f3894 100644 --- a/dbms/src/TiDB/Schema/SchemaBuilder.cpp +++ b/dbms/src/TiDB/Schema/SchemaBuilder.cpp @@ -844,7 +844,7 @@ void SchemaBuilder::applyDropSchema(const String & db_name) auto db = context.tryGetDatabase(db_name); if (db == nullptr) { - LOG_INFO(log, "Database {} does not exists", db_name); + LOG_INFO(log, "Database does not exist, db_name={}", db_name); return; } @@ -1046,7 +1046,7 @@ void SchemaBuilder::applyDropPhysicalTable(const String & db auto storage = tmt_context.getStorages().get(keyspace_id, table_id); if (storage == nullptr) { - LOG_DEBUG(log, "table {} does not exist.", table_id); + LOG_DEBUG(log, "table does not exist, table_id={}", table_id); return; } GET_METRIC(tiflash_schema_internal_ddl_count, type_drop_table).Increment(); @@ -1087,7 +1087,7 @@ void SchemaBuilder::applyDropTable(DatabaseID database_id, T auto * storage = tmt_context.getStorages().get(keyspace_id, table_id).get(); if (storage == nullptr) { - LOG_DEBUG(log, "table {} does not exist.", table_id); + LOG_DEBUG(log, "table does not exist, table_id={}", table_id); return; } const auto & table_info = storage->getTableInfo(); diff --git a/dbms/src/TiDB/Schema/SchemaGetter.cpp b/dbms/src/TiDB/Schema/SchemaGetter.cpp index 47ee084341c..5e170dd7fd6 100644 --- a/dbms/src/TiDB/Schema/SchemaGetter.cpp +++ b/dbms/src/TiDB/Schema/SchemaGetter.cpp @@ -248,10 +248,10 @@ std::optional SchemaGetter::getSchemaDiff(Int64 ver) String data = TxnStructure::get(snap, key); if (data.empty()) { - LOG_WARNING(log, "The schema diff for version {}, key {} is empty.", ver, key); + LOG_WARNING(log, "The schema diff is empty, schema_version={} key={}", ver, key); return std::nullopt; } - LOG_DEBUG(log, "Get SchemaDiff from TiKV: {}", data); // TODO: turn it into trace level + LOG_TRACE(log, "Get SchemaDiff from TiKV, schema_version={} data={}", ver, data); SchemaDiff diff; diff.deserialize(data); return diff; @@ -275,7 +275,7 @@ TiDB::DBInfoPtr SchemaGetter::getDatabase(DatabaseID db_id) if (json.empty()) return nullptr; - LOG_DEBUG(log, "Get DB Info from TiKV : " + json); + LOG_DEBUG(log, "Get DB Info from TiKV: {}", json); auto db_info = std::make_shared(json, keyspace_id); return db_info; } @@ -285,25 +285,26 @@ TiDB::TableInfoPtr SchemaGetter::getTableInfo(DatabaseID db_id, TableID table_id String db_key = getDBKey(db_id); if (!checkDBExists(db_key)) { - LOG_ERROR(log, "The database {} does not exist.", db_id); + LOG_ERROR(log, "The database does not exist, database_id={}", db_id); return nullptr; } String table_key = getTableKey(table_id); String table_info_json = TxnStructure::hGet(snap, db_key, table_key); if (table_info_json.empty()) { - LOG_WARNING(log, "The table {} is dropped in TiKV, try to get the latest table_info", table_id); + LOG_WARNING(log, "The table is dropped in TiKV, try to get the latest table_info, table_id={}", table_id); table_info_json = TxnStructure::mvccGet(snap, db_key, table_key); if (table_info_json.empty()) { LOG_ERROR( log, - "The table {} is dropped in TiKV, and the latest table_info is still empty, it should by gc", + "The table is dropped in TiKV, and the latest table_info is still empty, it should be GCed, " + "table_id={}", table_id); return nullptr; } } - LOG_DEBUG(log, "Get Table Info from TiKV : " + table_info_json); + LOG_DEBUG(log, "Get Table Info from TiKV: {}", table_info_json); TiDB::TableInfoPtr table_info = std::make_shared(table_info_json, keyspace_id); return table_info; @@ -319,26 +320,26 @@ std::tuple SchemaGetter::getDatabaseAndTabl if (db_json.empty()) return std::make_tuple(nullptr, nullptr); - LOG_DEBUG(log, "Get DB Info from TiKV : " + db_json); + LOG_DEBUG(log, "Get DB Info from TiKV: {}", db_json); auto db_info = std::make_shared(db_json, keyspace_id); String table_key = getTableKey(table_id); String table_info_json = TxnStructure::hGet(snap, db_key, table_key); if (table_info_json.empty()) { - LOG_WARNING(log, "The table {} is dropped in TiKV, try to get the latest table_info", table_id); + LOG_WARNING(log, "The table is dropped in TiKV, try to get the latest table_info, table_id={}", table_id); table_info_json = TxnStructure::mvccGet(snap, db_key, table_key); if (table_info_json.empty()) { LOG_ERROR( log, - "The table {} is dropped in TiKV, and the latest table_info is still empty, it should by gc", + "The table is dropped in TiKV, and the latest table_info is still empty, it should be GCed, " + "table_id={}", table_id); return std::make_tuple(db_info, nullptr); - ; } } - LOG_DEBUG(log, "Get Table Info from TiKV : " + table_info_json); + LOG_DEBUG(log, "Get Table Info from TiKV: {}", table_info_json); TiDB::TableInfoPtr table_info = std::make_shared(table_info_json, keyspace_id); return std::make_tuple(db_info, table_info);