Remove superior check for empty pools

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2024-02-22 17:19:16 +01:00
parent dbdf080108
commit eb334d717a
3 changed files with 0 additions and 12 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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