mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 16:50:48 +00:00
Merge pull request #11155 from azat/dist-logging
Add table name into logs for StorageDistributed
This commit is contained in:
commit
1d0043892b
@ -278,6 +278,7 @@ StorageDistributed::StorageDistributed(
|
|||||||
, remote_database(remote_database_)
|
, remote_database(remote_database_)
|
||||||
, remote_table(remote_table_)
|
, remote_table(remote_table_)
|
||||||
, global_context(std::make_unique<Context>(context_))
|
, global_context(std::make_unique<Context>(context_))
|
||||||
|
, log(&Logger::get("StorageDistributed (" + id_.table_name + ")"))
|
||||||
, cluster_name(global_context->getMacros()->expand(cluster_name_))
|
, cluster_name(global_context->getMacros()->expand(cluster_name_))
|
||||||
, has_sharding_key(sharding_key_)
|
, has_sharding_key(sharding_key_)
|
||||||
, storage_policy(storage_policy_)
|
, storage_policy(storage_policy_)
|
||||||
@ -474,18 +475,15 @@ Pipes StorageDistributed::read(
|
|||||||
if (settings.optimize_skip_unused_shards)
|
if (settings.optimize_skip_unused_shards)
|
||||||
{
|
{
|
||||||
ClusterPtr optimized_cluster = getOptimizedCluster(context, query_info.query);
|
ClusterPtr optimized_cluster = getOptimizedCluster(context, query_info.query);
|
||||||
auto table_id = getStorageID();
|
|
||||||
if (optimized_cluster)
|
if (optimized_cluster)
|
||||||
{
|
{
|
||||||
LOG_DEBUG(log, "Reading from " << table_id.getNameForLogs() << ": "
|
LOG_DEBUG(log, "Skipping irrelevant shards - the query will be sent to the following shards of the cluster (shard numbers): " <<
|
||||||
"Skipping irrelevant shards - the query will be sent to the following shards of the cluster (shard numbers): "
|
makeFormattedListOfShards(optimized_cluster));
|
||||||
" " << makeFormattedListOfShards(optimized_cluster));
|
|
||||||
cluster = optimized_cluster;
|
cluster = optimized_cluster;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_DEBUG(log, "Reading from " << table_id.getNameForLogs() <<
|
LOG_DEBUG(log, (has_sharding_key ? "" : " (no sharding key)") << ": "
|
||||||
(has_sharding_key ? "" : " (no sharding key)") << ": "
|
|
||||||
"Unable to figure out irrelevant shards from WHERE/PREWHERE clauses - "
|
"Unable to figure out irrelevant shards from WHERE/PREWHERE clauses - "
|
||||||
"the query will be sent to all shards of the cluster");
|
"the query will be sent to all shards of the cluster");
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ public:
|
|||||||
ASTPtr remote_table_function_ptr;
|
ASTPtr remote_table_function_ptr;
|
||||||
|
|
||||||
std::unique_ptr<Context> global_context;
|
std::unique_ptr<Context> global_context;
|
||||||
Logger * log = &Logger::get("StorageDistributed");
|
Logger * log;
|
||||||
|
|
||||||
/// Used to implement TableFunctionRemote.
|
/// Used to implement TableFunctionRemote.
|
||||||
std::shared_ptr<Cluster> owned_cluster;
|
std::shared_ptr<Cluster> owned_cluster;
|
||||||
|
Loading…
Reference in New Issue
Block a user