Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[native] Enable node pool type specification when reporting to the coordinator from a C++ worker #24569

Merged
merged 1 commit into from
Feb 22, 2025

Conversation

jaystarshot
Copy link
Member

@jaystarshot jaystarshot commented Feb 14, 2025

Description

Presto supports splitting workers into leaf and non leaf pools. This was added here.

For this the coordinator needs worker-isolation-enabled=true and workers can report their pool_type to the resource manager.

Adding the same configs in presto c++ so that the announcer can report the node type.

With this (since support was already added in coordinator) one can deploy any combination of native/java workers in LEAF/INTERMEDIATE etc.

Motivation and Context

Impact

Test Plan

Tested that setting works and if we set pool_type=LEAF in presto c++ the coordinator will only schedule leaf tasks there

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

General Changes
* Enable node pool type specification when reporting to the coordinator from a C++ worker. 


@jaystarshot jaystarshot changed the title Support specification of node pool type when announcing cpp worker Support specification of node pool type when announcing to coordinator from c++ worker Feb 14, 2025
@jaystarshot jaystarshot changed the title Support specification of node pool type when announcing to coordinator from c++ worker Enable node pool type specification when reporting to the coordinator from a C++ worker Feb 15, 2025
@jaystarshot jaystarshot marked this pull request as ready for review February 15, 2025 00:17
@jaystarshot jaystarshot requested a review from a team as a code owner February 15, 2025 00:17
@steveburnett
Copy link
Contributor

New release note guidelines. Please remove the manual PR link in the following format from the release note entries for this PR.


:pr:`12345`

I have updated the Release Notes Guidelines to remove the examples of manually adding the PR link.

@aditi-pandit
Copy link
Contributor

@jaystarshot : Is the node pool type an optimization or it affects functionality as well ? So if a non-leaf worker received a TableScan would it throw error ?

@jaystarshot
Copy link
Member Author

jaystarshot commented Feb 18, 2025

@aditi-pandit The coordinator won’t send a non leaf fragment. If it does i believe the execution should be normal since there is no blocking logic in the worker.
Also if no intermediate or leaf workers are present when isolation is enabled then the query fails with internal cluster is starting errors.

@jaystarshot
Copy link
Member Author

@majetideepak can you please take a look

@@ -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

@@ -290,6 +290,12 @@ 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.

@aditi-pandit aditi-pandit changed the title Enable node pool type specification when reporting to the coordinator from a C++ worker [native] Enable node pool type specification when reporting to the coordinator from a C++ worker Feb 20, 2025
Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

@jaystarshot : Just had 2 questions else this PR should be fine.

@jaystarshot
Copy link
Member Author

jaystarshot commented Feb 20, 2025

@aditi-pandit I am just using the same property name as presto java uses. Its defined in serverconfig here.

@aditi-pandit
Copy link
Contributor

@aditi-pandit I am just using the same property name as presto java uses. Its defined in serverconfig here.

Thanks @jaystarshot for the explanation. I saw the linked PR later. Yeah, we'll have to stick with this name.

@jaystarshot jaystarshot force-pushed the jay-leaf branch 2 times, most recently from 7088f2f to bc3388d Compare February 20, 2025 17:07
@aditi-pandit
Copy link
Contributor

@pdabre12 @pramodsatya : Can you'll take a look at the failures in prestocpp-linux-build-and-unit-test / prestocpp-linux-presto-sidecar-tests (pull_request)

@steveburnett
Copy link
Contributor

Suggest rephrasing of release note entry to follow the Order of changes, and Order of sections grouping in the Release Notes Guidelines:

== RELEASE NOTES ==

Prestissimo (Native Execution) Changes
* Add node pool type specification in Presto C++ for reporting to the coordinator from a C++ worker. 

Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

@jaystarshot : Have one major comment about the required vs optional. The rest are nits.

Another thing : Please change your commit to add a prefix of [native]

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

std::string SystemConfig::poolType() const {
static const std::unordered_set<std::string> validTypes = {"LEAF", "INTERMEDIATE", "DEFAULT"};
auto value = requiredProperty(std::string(kPoolType));
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be optionalProperty instead ? Configs which don't have pool-type will cause failures post this change. So this could be very disruptive. Could that be the reason for all the test failures ? I haven't looked at the details but the timeouts most likely could be because the workers didn't start up.

Copy link
Member Author

Choose a reason for hiding this comment

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

i thought the default will always be initialized when we put this in the registeredProps_ map i can try with optional

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

std::string SystemConfig::poolType() const {
static const std::unordered_set<std::string> validTypes = {"LEAF", "INTERMEDIATE", "DEFAULT"};
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit rename variable to kPoolTypes.

Constant variable names should be prefixed with 'k'

@@ -34,6 +34,7 @@ class Announcer : public PeriodicServiceInventoryManager {
const bool sidecar,
const std::vector<std::string>& connectorIds,
const uint64_t maxFrequencyMs_,
const std::string& nodePoolType,
Copy link
Contributor

Choose a reason for hiding this comment

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

We could move this parameter higher up since there aren't any optional parameters in this method. After nodeLocation or sidecar ?

Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

@jaystarshot : Please change your commit title to have prefix [native] as well.

One minor nit otherwise.

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

std::string SystemConfig::poolType() const {
static const std::unordered_set<std::string> validTypes = {"LEAF", "INTERMEDIATE", "DEFAULT"};
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Rename this set of constants with k Prefix as well. kPoolTypes maybe

aditi-pandit
aditi-pandit previously approved these changes Feb 21, 2025
Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks for the iterations @jaystarshot

Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks for the test change @jaystarshot

@jaystarshot jaystarshot merged commit 4b8271c into prestodb:master Feb 22, 2025
59 of 60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants