Skip to content

Commit

Permalink
[native] Add sidecar system property
Browse files Browse the repository at this point in the history
  • Loading branch information
deepthydavis authored and aditi-pandit committed Jun 13, 2024
1 parent 10143be commit 664d682
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions presto-native-execution/presto_cpp/main/Announcer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>& connectorIds) {
std::string id =
boost::lexical_cast<std::string>(boost::uuids::random_generator()());
Expand All @@ -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)}}}}}}};
Expand Down Expand Up @@ -79,6 +81,7 @@ Announcer::Announcer(
const std::string& environment,
const std::string& nodeId,
const std::string& nodeLocation,
const bool sidecar,
const std::vector<std::string>& connectorIds,
const uint64_t maxFrequencyMs,
folly::SSLContextPtr sslContext)
Expand All @@ -96,6 +99,7 @@ Announcer::Announcer(
nodeVersion,
environment,
nodeLocation,
sidecar,
connectorIds)),
announcementRequest_(
announcementRequest(address, port, nodeId, announcementBody_)) {}
Expand Down
1 change: 1 addition & 0 deletions presto-native-execution/presto_cpp/main/Announcer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>& connectorIds,
const uint64_t maxFrequencyMs_,
folly::SSLContextPtr sslContext);
Expand Down
1 change: 1 addition & 0 deletions presto-native-execution/presto_cpp/main/PrestoServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ void PrestoServer::run() {
environment_,
nodeId_,
nodeLocation_,
systemConfig->prestoNativeSidecar(),
catalogNames,
systemConfig->announcementMaxFrequencyMs(),
sslContext_);
Expand Down
5 changes: 5 additions & 0 deletions presto-native-execution/presto_cpp/main/common/Configs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -384,6 +385,10 @@ uint32_t SystemConfig::systemMemoryGb() const {
return optionalProperty<uint32_t>(kSystemMemoryGb).value();
}

bool SystemConfig::prestoNativeSidecar() const {
return optionalProperty<bool>(kNativeSidecar).value();
}

uint32_t SystemConfig::systemMemLimitGb() const {
return optionalProperty<uint32_t>(kSystemMemLimitGb).value();
}
Expand Down
4 changes: 4 additions & 0 deletions presto-native-execution/presto_cpp/main/common/Configs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -722,6 +724,8 @@ class SystemConfig : public ConfigBase {
std::chrono::duration<double> cacheVeloxTtlCheckInterval() const;

bool enableRuntimeMetricsCollection() const;

bool prestoNativeSidecar() const;
};

/// Provides access to node properties defined in node.properties file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ TEST_P(AnnouncerTestSuite, basic) {
"testing",
"test-node",
"test-node-location",
true,
{"hive", "tpch"},
500 /*milliseconds*/,
useHttps ? sslContext_ : nullptr);
Expand Down

0 comments on commit 664d682

Please sign in to comment.