|
18 | 18 | #include <Storages/extractTableFunctionFromSelectQuery.h>
|
19 | 19 | #include <Storages/ObjectStorage/StorageObjectStorageStableTaskDistributor.h>
|
20 | 20 |
|
21 |
| - |
22 | 21 | namespace DB
|
23 | 22 | {
|
24 | 23 | namespace Setting
|
@@ -214,13 +213,28 @@ void StorageObjectStorageCluster::updateQueryToSendIfNeeded(
|
214 | 213 | }
|
215 | 214 |
|
216 | 215 | RemoteQueryExecutor::Extension StorageObjectStorageCluster::getTaskIteratorExtension(
|
217 |
| - const ActionsDAG::Node * predicate, const ContextPtr & local_context, const size_t number_of_replicas) const |
| 216 | + const ActionsDAG::Node * predicate, |
| 217 | + const ContextPtr & local_context, |
| 218 | + ClusterPtr cluster) const |
218 | 219 | {
|
219 | 220 | auto iterator = StorageObjectStorageSource::createFileIterator(
|
220 | 221 | configuration, configuration->getQuerySettings(local_context), object_storage, /* distributed_processing */false,
|
221 | 222 | local_context, predicate, {}, virtual_columns, hive_partition_columns_to_read_from_file_path, nullptr, local_context->getFileProgressCallback(), /*ignore_archive_globs=*/true, /*skip_object_metadata=*/true);
|
222 | 223 |
|
223 |
| - auto task_distributor = std::make_shared<StorageObjectStorageStableTaskDistributor>(iterator, number_of_replicas); |
| 224 | + std::vector<std::string> ids_of_hosts; |
| 225 | + for (const auto & shard : cluster->getShardsInfo()) |
| 226 | + { |
| 227 | + if (shard.per_replica_pools.empty()) |
| 228 | + throw Exception(ErrorCodes::LOGICAL_ERROR, "Cluster {} with empty shard {}", cluster->getName(), shard.shard_num); |
| 229 | + for (const auto & replica : shard.per_replica_pools) |
| 230 | + { |
| 231 | + if (!replica) |
| 232 | + throw Exception(ErrorCodes::LOGICAL_ERROR, "Cluster {}, shard {} with empty node", cluster->getName(), shard.shard_num); |
| 233 | + ids_of_hosts.push_back(replica->getAddress()); |
| 234 | + } |
| 235 | + } |
| 236 | + |
| 237 | + auto task_distributor = std::make_shared<StorageObjectStorageStableTaskDistributor>(iterator, ids_of_hosts); |
224 | 238 |
|
225 | 239 | auto callback = std::make_shared<TaskIterator>(
|
226 | 240 | [task_distributor](size_t number_of_current_replica) mutable -> String
|
|
0 commit comments