diff --git a/src/Storages/Distributed/DistributedAsyncInsertBatch.cpp b/src/Storages/Distributed/DistributedAsyncInsertBatch.cpp index 0b258654f4a..b5a14691756 100644 --- a/src/Storages/Distributed/DistributedAsyncInsertBatch.cpp +++ b/src/Storages/Distributed/DistributedAsyncInsertBatch.cpp @@ -28,7 +28,6 @@ namespace ErrorCodes extern const int TOO_MANY_PARTITIONS; extern const int DISTRIBUTED_TOO_MANY_PENDING_BYTES; extern const int ARGUMENT_OUT_OF_BOUND; - extern const int LOGICAL_ERROR; } /// Can the batch be split and send files from batch one-by-one instead? @@ -234,8 +233,6 @@ void DistributedAsyncInsertBatch::sendBatch(const SettingsChanges & settings_cha auto timeouts = ConnectionTimeouts::getTCPTimeoutsWithFailover(insert_settings); auto result = parent.pool->getManyChecked(timeouts, insert_settings, PoolMode::GET_ONE, parent.storage.remote_storage.getQualifiedName()); - if (result.empty() || result.front().entry.isNull()) - throw Exception(ErrorCodes::LOGICAL_ERROR, "Expected exactly one connection"); if (distributed_header.insert_settings.distributed_insert_prefer_non_readonly_replica) sortConnectionPoolByNonReadOnlyReplicas(result); @@ -297,8 +294,6 @@ void DistributedAsyncInsertBatch::sendSeparateFiles(const SettingsChanges & sett auto timeouts = ConnectionTimeouts::getTCPTimeoutsWithFailover(insert_settings); auto result = parent.pool->getManyChecked(timeouts, insert_settings, PoolMode::GET_ONE, parent.storage.remote_storage.getQualifiedName()); - if (result.empty() || result.front().entry.isNull()) - throw Exception(ErrorCodes::LOGICAL_ERROR, "Expected exactly one connection"); if (distributed_header.insert_settings.distributed_insert_prefer_non_readonly_replica) sortConnectionPoolByNonReadOnlyReplicas(result); diff --git a/src/Storages/Distributed/DistributedAsyncInsertDirectoryQueue.cpp b/src/Storages/Distributed/DistributedAsyncInsertDirectoryQueue.cpp index 27fbace0482..e041caa2249 100644 --- a/src/Storages/Distributed/DistributedAsyncInsertDirectoryQueue.cpp +++ b/src/Storages/Distributed/DistributedAsyncInsertDirectoryQueue.cpp @@ -413,9 +413,6 @@ void DistributedAsyncInsertDirectoryQueue::processFile(std::string & file_path, auto timeouts = ConnectionTimeouts::getTCPTimeoutsWithFailover(insert_settings); auto result = pool->getManyChecked(timeouts, insert_settings, PoolMode::GET_ONE, storage.remote_storage.getQualifiedName()); - if (result.empty() || result.front().entry.isNull()) - throw Exception(ErrorCodes::LOGICAL_ERROR, "Expected exactly one connection"); - if (distributed_header.insert_settings.distributed_insert_prefer_non_readonly_replica) sortConnectionPoolByNonReadOnlyReplicas(result); diff --git a/src/Storages/Distributed/DistributedSink.cpp b/src/Storages/Distributed/DistributedSink.cpp index 4f58b61b0ee..f41591a52ff 100644 --- a/src/Storages/Distributed/DistributedSink.cpp +++ b/src/Storages/Distributed/DistributedSink.cpp @@ -375,10 +375,6 @@ DistributedSink::runWritingJob(JobReplica & job, const Block & current_block, si auto results = shard_info.pool->getManyChecked(timeouts, settings, PoolMode::GET_ONE, storage.remote_storage.getQualifiedName()); if (settings.distributed_insert_prefer_non_readonly_replica) sortConnectionPoolByNonReadOnlyReplicas(results); - - if (results.empty() || results.front().entry.isNull()) - throw Exception(ErrorCodes::LOGICAL_ERROR, "Expected exactly one connection for shard {}", toString(job.shard_index)); - job.connection_entry = std::move(results.front().entry); } else