Fix logging for asynchronous non-batched distributed sends (#52583)

Before you may see the following:

  2023.07.25 09:21:39.705559 [ 692 ] {6b5e1299-1b64-4dbb-b25d-45e10027db22} <Trace> test_hkt5nnqj.dist_opentelemetry.DirectoryMonitor.default: Finished processing `` (took 37 ms)

Because file_path and current_file are the references to the same
variable in DistributedAsyncInsertDirectoryQueue::processFile().

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2023-08-07 20:57:42 +02:00 committed by GitHub
parent ab4b4ed873
commit 2f414950b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -419,7 +419,7 @@ catch (...)
throw;
}
void DistributedAsyncInsertDirectoryQueue::processFile(const std::string & file_path)
void DistributedAsyncInsertDirectoryQueue::processFile(std::string & file_path)
{
OpenTelemetry::TracingContextHolderPtr thread_trace_context;
@ -459,7 +459,7 @@ void DistributedAsyncInsertDirectoryQueue::processFile(const std::string & file_
if (isDistributedSendBroken(e.code(), e.isRemoteException()))
{
markAsBroken(file_path);
current_file.clear();
file_path.clear();
}
throw;
}
@ -473,8 +473,8 @@ void DistributedAsyncInsertDirectoryQueue::processFile(const std::string & file_
auto dir_sync_guard = getDirectorySyncGuard(relative_path);
markAsSend(file_path);
current_file.clear();
LOG_TRACE(log, "Finished processing `{}` (took {} ms)", file_path, watch.elapsedMilliseconds());
file_path.clear();
}
struct DistributedAsyncInsertDirectoryQueue::BatchHeader

View File

@ -100,7 +100,7 @@ private:
void addFile(const std::string & file_path);
void initializeFilesFromDisk();
void processFiles();
void processFile(const std::string & file_path);
void processFile(std::string & file_path);
void processFilesWithBatching();
void markAsBroken(const std::string & file_path);

View File

@ -3,8 +3,8 @@
{"operation_name":"void DB::DistributedSink::writeToLocal(const Cluster::ShardInfo &, const Block &, size_t)","cluster":"test_cluster_two_shards_localhost","shard":"2","rows":"1","bytes":"8"}
1
===2===
{"operation_name":"void DB::DistributedAsyncInsertDirectoryQueue::processFile(const std::string &)","cluster":"test_cluster_two_shards_localhost","shard":"1","rows":"1","bytes":"8"}
{"operation_name":"void DB::DistributedAsyncInsertDirectoryQueue::processFile(const std::string &)","cluster":"test_cluster_two_shards_localhost","shard":"2","rows":"1","bytes":"8"}
{"operation_name":"void DB::DistributedAsyncInsertDirectoryQueue::processFile(std::string &)","cluster":"test_cluster_two_shards_localhost","shard":"1","rows":"1","bytes":"8"}
{"operation_name":"void DB::DistributedAsyncInsertDirectoryQueue::processFile(std::string &)","cluster":"test_cluster_two_shards_localhost","shard":"2","rows":"1","bytes":"8"}
3
2
===3===