@@ -28,7 +28,6 @@ namespace ErrorCodes
2828 extern const int TOO_MANY_PARTITIONS;
2929 extern const int DISTRIBUTED_TOO_MANY_PENDING_BYTES;
3030 extern const int ARGUMENT_OUT_OF_BOUND;
31- extern const int LOGICAL_ERROR;
3231}
3332
3433// / Can the batch be split and send files from batch one-by-one instead?
@@ -244,9 +243,7 @@ void DistributedAsyncInsertBatch::sendBatch(const SettingsChanges & settings_cha
244243 auto timeouts = ConnectionTimeouts::getTCPTimeoutsWithFailover (insert_settings);
245244 auto results = parent.pool ->getManyCheckedForInsert (timeouts, insert_settings, PoolMode::GET_ONE, parent.storage .remote_storage .getQualifiedName ());
246245 auto result = results.front ();
247- if (parent.pool ->isTryResultInvalid (result, insert_settings.distributed_insert_skip_read_only_replicas ))
248- throw Exception (ErrorCodes::LOGICAL_ERROR, " Got an invalid connection result" );
249-
246+ parent.pool ->checkTryResultIsValid (result, insert_settings.distributed_insert_skip_read_only_replicas );
250247 connection = std::move (result.entry );
251248 compression_expected = connection->getCompression () == Protocol::Compression::Enable;
252249
@@ -306,9 +303,7 @@ void DistributedAsyncInsertBatch::sendSeparateFiles(const SettingsChanges & sett
306303 auto timeouts = ConnectionTimeouts::getTCPTimeoutsWithFailover (insert_settings);
307304 auto results = parent.pool ->getManyCheckedForInsert (timeouts, insert_settings, PoolMode::GET_ONE, parent.storage .remote_storage .getQualifiedName ());
308305 auto result = results.front ();
309- if (parent.pool ->isTryResultInvalid (result, insert_settings.distributed_insert_skip_read_only_replicas ))
310- throw Exception (ErrorCodes::LOGICAL_ERROR, " Got an invalid connection result" );
311-
306+ parent.pool ->checkTryResultIsValid (result, insert_settings.distributed_insert_skip_read_only_replicas );
312307 auto connection = std::move (result.entry );
313308 bool compression_expected = connection->getCompression () == Protocol::Compression::Enable;
314309
0 commit comments