Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 std::string& nodePoolType,
const bool sidecar,
const std::vector<std::string>& connectorIds) {
std::string id =
Expand All @@ -49,6 +50,7 @@ std::string announcementBody(
{"coordinator", false},
{"sidecar", sidecar},
{"connectorIds", folly::join(',', connectorIds)},
{"pool_type", nodePoolType},
{uriScheme,
fmt::format("{}://{}:{}", uriScheme, address, port)}}}}}}};
return body.dump();
Expand Down Expand Up @@ -81,6 +83,7 @@ Announcer::Announcer(
const std::string& environment,
const std::string& nodeId,
const std::string& nodeLocation,
const std::string& nodePoolType,
const bool sidecar,
const std::vector<std::string>& connectorIds,
const uint64_t maxFrequencyMs,
Expand All @@ -99,6 +102,7 @@ Announcer::Announcer(
nodeVersion,
environment,
nodeLocation,
nodePoolType,
sidecar,
connectorIds)),
announcementRequest_(
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 std::string& nodePoolType,
const bool sidecar,
const std::vector<std::string>& connectorIds,
const uint64_t maxFrequencyMs_,
Expand Down
2 changes: 2 additions & 0 deletions presto-native-execution/presto_cpp/main/PrestoServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ void PrestoServer::run() {
address_ = fmt::format("[{}]", address_);
}
nodeLocation_ = nodeConfig->nodeLocation();
nodePoolType_ = systemConfig->poolType();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the possible values for pool Type ? Might be good to validate the value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The accepted values are here Sure I can add that

prestoBuiltinFunctionPrefix_ = systemConfig->prestoDefaultNamespacePrefix();
} catch (const velox::VeloxUserError& e) {
PRESTO_STARTUP_LOG(ERROR) << "Failed to start server due to " << e.what();
Expand Down Expand Up @@ -576,6 +577,7 @@ void PrestoServer::run() {
environment_,
nodeId_,
nodeLocation_,
nodePoolType_,
systemConfig->prestoNativeSidecar(),
catalogNames,
systemConfig->announcementMaxFrequencyMs(),
Expand Down
1 change: 1 addition & 0 deletions presto-native-execution/presto_cpp/main/PrestoServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ class PrestoServer {
std::string nodeId_;
std::string address_;
std::string nodeLocation_;
std::string nodePoolType_;
folly::SSLContextPtr sslContext_;
std::string prestoBuiltinFunctionPrefix_;
};
Expand Down
12 changes: 12 additions & 0 deletions presto-native-execution/presto_cpp/main/common/Configs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ SystemConfig::SystemConfig() {
BOOL_PROP(kEnableRuntimeMetricsCollection, false),
BOOL_PROP(kPlanValidatorFailOnNestedLoopJoin, false),
STR_PROP(kPrestoDefaultNamespacePrefix, "presto.default"),
STR_PROP(kPoolType, "DEFAULT"),
};
}

Expand Down Expand Up @@ -290,6 +291,17 @@ std::string SystemConfig::prestoVersion() const {
return requiredProperty(std::string(kPrestoVersion));
}

std::string SystemConfig::poolType() const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to confirm that this is not a registered property... Else it has to be a part of registeredProps_. If you add it to registeredProps_ it might be simpler to initialize the default value as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between registeredProps_ and configs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registered properties are validated on server startup https://github.com/prestodb/presto/blob/master/presto-native-execution/presto_cpp/main/common/Configs.cpp#L110

Might be better to add it to avoid warnings.

static const std::unordered_set<std::string> kPoolTypes = {"LEAF", "INTERMEDIATE", "DEFAULT"};
static constexpr std::string_view kPoolTypeDefault = "DEFAULT";
auto value = optionalProperty<std::string>(kPoolType).value_or(std::string(kPoolTypeDefault));
VELOX_USER_CHECK(
kPoolTypes.count(value),
"{} must be one of 'LEAF', 'INTERMEDIATE', or 'DEFAULT'",
kPoolType);
return value;
}

bool SystemConfig::mutableConfig() const {
return optionalProperty<bool>(kMutableConfig).value();
}
Expand Down
5 changes: 5 additions & 0 deletions presto-native-execution/presto_cpp/main/common/Configs.h
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,9 @@ class SystemConfig : public ConfigBase {
static constexpr std::string_view kPrestoDefaultNamespacePrefix{
"presto.default-namespace"};

// Specifies the type of worker pool
static constexpr std::string_view kPoolType{"pool-type"};

SystemConfig();

virtual ~SystemConfig() = default;
Expand Down Expand Up @@ -898,6 +901,8 @@ class SystemConfig : public ConfigBase {

bool prestoNativeSidecar() const;
std::string prestoDefaultNamespacePrefix() const;

std::string poolType() 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",
"DEFAULT",
true,
{"hive", "tpch"},
500 /*milliseconds*/,
Expand Down
Loading