diff --git a/presto-native-execution/presto_cpp/main/Announcer.cpp b/presto-native-execution/presto_cpp/main/Announcer.cpp index 596f44d73a1b..a218c68d8c84 100644 --- a/presto-native-execution/presto_cpp/main/Announcer.cpp +++ b/presto-native-execution/presto_cpp/main/Announcer.cpp @@ -30,6 +30,7 @@ std::string announcementBody( const std::string& nodeVersion, const std::string& environment, const std::string& nodeLocation, + const bool sidecar, const std::vector& connectorIds) { std::string id = boost::lexical_cast(boost::uuids::random_generator()()); @@ -46,6 +47,7 @@ std::string announcementBody( {"properties", {{"node_version", nodeVersion}, {"coordinator", false}, + {"sidecar", sidecar}, {"connectorIds", folly::join(',', connectorIds)}, {uriScheme, fmt::format("{}://{}:{}", uriScheme, address, port)}}}}}}}; @@ -79,6 +81,7 @@ Announcer::Announcer( const std::string& environment, const std::string& nodeId, const std::string& nodeLocation, + const bool sidecar, const std::vector& connectorIds, const uint64_t maxFrequencyMs, folly::SSLContextPtr sslContext) @@ -96,6 +99,7 @@ Announcer::Announcer( nodeVersion, environment, nodeLocation, + sidecar, connectorIds)), announcementRequest_( announcementRequest(address, port, nodeId, announcementBody_)) {} diff --git a/presto-native-execution/presto_cpp/main/Announcer.h b/presto-native-execution/presto_cpp/main/Announcer.h index 4a806ee78b08..2b35f6e69de1 100644 --- a/presto-native-execution/presto_cpp/main/Announcer.h +++ b/presto-native-execution/presto_cpp/main/Announcer.h @@ -31,6 +31,7 @@ class Announcer : public PeriodicServiceInventoryManager { const std::string& environment, const std::string& nodeId, const std::string& nodeLocation, + const bool sidecar, const std::vector& connectorIds, const uint64_t maxFrequencyMs_, folly::SSLContextPtr sslContext); diff --git a/presto-native-execution/presto_cpp/main/PrestoServer.cpp b/presto-native-execution/presto_cpp/main/PrestoServer.cpp index 6fbdc208b5a6..91113e1d83d5 100644 --- a/presto-native-execution/presto_cpp/main/PrestoServer.cpp +++ b/presto-native-execution/presto_cpp/main/PrestoServer.cpp @@ -280,6 +280,7 @@ void PrestoServer::run() { environment_, nodeId_, nodeLocation_, + systemConfig->prestoNativeSidecar(), catalogNames, systemConfig->announcementMaxFrequencyMs(), sslContext_); diff --git a/presto-native-execution/presto_cpp/main/common/Configs.cpp b/presto-native-execution/presto_cpp/main/common/Configs.cpp index e952bb603c19..e250cc391e01 100644 --- a/presto-native-execution/presto_cpp/main/common/Configs.cpp +++ b/presto-native-execution/presto_cpp/main/common/Configs.cpp @@ -179,6 +179,7 @@ SystemConfig::SystemConfig() { NUM_PROP(kMallocHeapDumpThresholdGb, 20), NUM_PROP(kMallocMemMinHeapDumpInterval, 10), NUM_PROP(kMallocMemMaxHeapDumpFiles, 5), + BOOL_PROP(kNativeSidecar, false), BOOL_PROP(kAsyncDataCacheEnabled, true), NUM_PROP(kAsyncCacheSsdGb, 0), NUM_PROP(kAsyncCacheSsdCheckpointGb, 0), @@ -384,6 +385,10 @@ uint32_t SystemConfig::systemMemoryGb() const { return optionalProperty(kSystemMemoryGb).value(); } +bool SystemConfig::prestoNativeSidecar() const { + return optionalProperty(kNativeSidecar).value(); +} + uint32_t SystemConfig::systemMemLimitGb() const { return optionalProperty(kSystemMemLimitGb).value(); } diff --git a/presto-native-execution/presto_cpp/main/common/Configs.h b/presto-native-execution/presto_cpp/main/common/Configs.h index 5cb427fc0984..375d0d9d76be 100644 --- a/presto-native-execution/presto_cpp/main/common/Configs.h +++ b/presto-native-execution/presto_cpp/main/common/Configs.h @@ -248,6 +248,8 @@ class SystemConfig : public ConfigBase { /// Memory allocation limit enforced via internal memory allocator. static constexpr std::string_view kSystemMemoryGb{"system-memory-gb"}; + /// Indicates if the process is configured as a sidecar. + static constexpr std::string_view kNativeSidecar{"native-sidecar"}; /// Specifies the total memory capacity that can be used by query execution in /// GB. The query memory capacity should be configured less than the system /// memory capacity ('system-memory-gb') to reserve memory for system usage @@ -722,6 +724,8 @@ class SystemConfig : public ConfigBase { std::chrono::duration cacheVeloxTtlCheckInterval() const; bool enableRuntimeMetricsCollection() const; + + bool prestoNativeSidecar() const; }; /// Provides access to node properties defined in node.properties file. diff --git a/presto-native-execution/presto_cpp/main/tests/AnnouncerTest.cpp b/presto-native-execution/presto_cpp/main/tests/AnnouncerTest.cpp index 37408a848498..4b5881645f05 100644 --- a/presto-native-execution/presto_cpp/main/tests/AnnouncerTest.cpp +++ b/presto-native-execution/presto_cpp/main/tests/AnnouncerTest.cpp @@ -173,6 +173,7 @@ TEST_P(AnnouncerTestSuite, basic) { "testing", "test-node", "test-node-location", + true, {"hive", "tpch"}, 500 /*milliseconds*/, useHttps ? sslContext_ : nullptr);