|
23 | 23 | #include <yt/yt/core/actions/invoker.h> |
24 | 24 | #include <yt/yt/core/concurrency/action_queue.h> |
25 | 25 | #include <yt/yt/core/concurrency/thread_pool.h> |
| 26 | +#include <yt/yt/core/net/address.h> |
| 27 | +#include <yt/yt/core/net/config.h> |
26 | 28 |
|
27 | 29 | #include <library/cpp/protobuf/util/pb_io.h> |
28 | 30 |
|
29 | 31 | #include <util/system/fs.h> |
30 | 32 | #include <util/stream/file.h> |
31 | 33 | #include <util/system/env.h> |
32 | 34 | #include <util/system/shellcommand.h> |
| 35 | +#include <util/string/type.h> |
33 | 36 |
|
34 | 37 | using namespace NYql::NDqs; |
35 | 38 |
|
@@ -187,11 +190,20 @@ namespace NYql::NDq::NWorker { |
187 | 190 | TRangeWalker<int> portWalker(startPort, startPort+100); |
188 | 191 | auto ports = BindInRange(portWalker); |
189 | 192 |
|
| 193 | + auto forceIPv4 = IsTrue(GetEnv(TString("YT_SECURE_VAULT_") + NCommonJobVars::YT_FORCE_IPV4, "")); |
| 194 | + if (forceIPv4) { |
| 195 | + auto config = NYT::New<NYT::NNet::TAddressResolverConfig>(); |
| 196 | + config->EnableIPv4 = true; |
| 197 | + config->EnableIPv6 = false; |
| 198 | + NYT::NNet::TAddressResolver::Get()->Configure(config); |
| 199 | + } |
| 200 | + |
190 | 201 | auto [host, ip] = NYql::NDqs::GetLocalAddress( |
191 | | - coordinatorConfig.HasHostName() ? &coordinatorConfig.GetHostName() : nullptr |
| 202 | + coordinatorConfig.HasHostName() ? &coordinatorConfig.GetHostName() : nullptr, |
| 203 | + forceIPv4 ? AF_INET : AF_INET6 |
192 | 204 | ); |
193 | 205 |
|
194 | | - auto coordinator = CreateCoordiantionHelper(coordinatorConfig, NProto::TDqConfig::TScheduler(), "worker_node", ports[1].Addr.GetPort(), host, ip); |
| 206 | + auto coordinator = CreateCoordiantionHelper(coordinatorConfig, NProto::TDqConfig::TScheduler(), "worker_node", ports[forceIPv4 ? 0 : 1].Addr.GetPort(), host, ip); |
195 | 207 | i64 cacheSize = backendConfig.HasCacheSize() |
196 | 208 | ? backendConfig.GetCacheSize() |
197 | 209 | : 16000000000L; |
@@ -280,8 +292,8 @@ namespace NYql::NDq::NWorker { |
280 | 292 | std::tie(setup, logSettings) = BuildActorSetup( |
281 | 293 | nodeId, |
282 | 294 | ip, |
283 | | - ports[1].Addr.GetPort(), |
284 | | - ports[1].Socket->Release(), |
| 295 | + ports[forceIPv4 ? 0 : 1].Addr.GetPort(), |
| 296 | + ports[forceIPv4 ? 0 : 1].Socket->Release(), |
285 | 297 | {}, |
286 | 298 | dqSensors, |
287 | 299 | [](const TIntrusivePtr<NActors::TTableNameserverSetup>& setup) { |
|
0 commit comments