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

Add a config property for excluding invalid worker session properties #23968

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pdabre12
Copy link
Contributor

@pdabre12 pdabre12 commented Nov 6, 2024

Resolves: #23827

== RELEASE NOTES ==

General Changes
* Add configuration property ``exclude-invalid-worker-session-properties``. : pr:`23968`

@pdabre12 pdabre12 force-pushed the add-java-worker-exclusion-config-property branch from 3ec1cc9 to a9f640f Compare November 6, 2024 23:19
Copy link
Contributor

@steveburnett steveburnett 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 doc! Nit for tense. Pull branch, local doc build, formatting looks good.

presto-docs/src/main/sphinx/admin/properties.rst Outdated Show resolved Hide resolved
presto-docs/src/main/sphinx/admin/properties.rst Outdated Show resolved Hide resolved
@steveburnett
Copy link
Contributor

steveburnett commented Nov 7, 2024

Thanks for the release note entry! A couple of nits in the formatting:

== RELEASE NOTES ==

General Changes
* Add configuration property ``exclude-java-worker-session-properties``. : pr:`23968`

@pdabre12 pdabre12 force-pushed the add-java-worker-exclusion-config-property branch from a9f640f to 1c80ce0 Compare November 7, 2024 20:22
@pdabre12
Copy link
Contributor Author

pdabre12 commented Nov 7, 2024

@steveburnett Thank you for the suggestions. Please have another look.

@pdabre12
Copy link
Contributor Author

pdabre12 commented Nov 7, 2024

CC: @tdcmeehan @rschlussel

@pdabre12 pdabre12 marked this pull request as ready for review November 7, 2024 20:27
@pdabre12 pdabre12 requested a review from presto-oss November 7, 2024 20:27
steveburnett
steveburnett previously approved these changes Nov 7, 2024
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pull updated branch, reviewed the new local doc build, looks good. Thanks!

@tdcmeehan tdcmeehan self-assigned this Nov 11, 2024
@pdabre12 pdabre12 force-pushed the add-java-worker-exclusion-config-property branch 2 times, most recently from 4da5af8 to a0ab00f Compare November 11, 2024 18:38
@@ -805,7 +805,9 @@ public ListeningExecutorService createResourceManagerExecutor(ResourceManagerCon
// Worker session property providers
MapBinder<String, WorkerSessionPropertyProvider> mapBinder =
newMapBinder(binder, String.class, WorkerSessionPropertyProvider.class);
mapBinder.addBinding("java-worker").to(JavaWorkerSessionPropertyProvider.class).in(Scopes.SINGLETON);
if (!featuresConfig.isExcludeJavaWorkerSessionProperties()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!featuresConfig.isExcludeJavaWorkerSessionProperties()) {
if (!serverConfig.isCoordinatorSidecarEnabled() || !featuresConfig.isExcludeJavaWorkerSessionProperties()) {

I think we should always include them for Java clusters.

mapBinder.addBinding("java-worker").to(JavaWorkerSessionPropertyProvider.class).in(Scopes.SINGLETON);
if (!featuresConfig.isExcludeJavaWorkerSessionProperties()) {
mapBinder.addBinding("java-worker").to(JavaWorkerSessionPropertyProvider.class).in(Scopes.SINGLETON);
}
if (!serverConfig.isCoordinatorSidecarEnabled()) {
mapBinder.addBinding("native-worker").to(NativeWorkerSessionPropertyProvider.class).in(Scopes.SINGLETON);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the same for native-worker session properties? Maybe the config could have a generic name to exclude properties that aren't relevant for that worker type.

@pdabre12 pdabre12 mentioned this pull request Nov 14, 2024
6 tasks
@pdabre12 pdabre12 force-pushed the add-java-worker-exclusion-config-property branch from a0ab00f to 9b3f472 Compare December 3, 2024 00:15
@pdabre12 pdabre12 requested a review from a team as a code owner December 3, 2024 00:15
@pdabre12 pdabre12 changed the title Add a config property for excluding java-worker session properties in a native cluster Add a config property for excluding invalid worker session properties Dec 3, 2024
@pdabre12
Copy link
Contributor Author

pdabre12 commented Dec 3, 2024

@tdcmeehan @rschlussel Made the changes, now setting the config property should help exclude properties that aren't relevant for that worker type.
Please have another look. Thanks !

mapBinder.addBinding("java-worker").to(JavaWorkerSessionPropertyProvider.class).in(Scopes.SINGLETON);
if (!serverConfig.isCoordinatorSidecarEnabled()) {
mapBinder.addBinding("native-worker").to(NativeWorkerSessionPropertyProvider.class).in(Scopes.SINGLETON);
if (featuresConfig.isExcludeInvalidWorkerSessionProperties()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

i think it would be easier to understand if the logic were rearranged a bit like this:

if(featuresConfig.isNativeExecutionEnabled()) {
    if(!server.isCoordinatorSidecarEnabled()) {
          mapBinder.addBinding("native-worker").to(NativeWorkerSessionPropertyProvider.class).in(Scopes.SINGLETON);
    }
    if(!featuresConfig.isExcludeInvalidWorkerSessionProperties()) {
             mapBinder.addBinding("java-worker").to(JavaWorkerSessionPropertyProvider.class).in(Scopes.SINGLETON);
    }
} 
else {
    mapBinder.addBinding("java-worker").to(JavaWorkerSessionPropertyProvider.class).in(Scopes.SINGLETON);
    if(!featuresConfig.isExcludeInvalidWorkerSessionProperties()) {
        mapBinder.addBinding("native-worker").to(NativeWorkerSessionPropertyProvider.class).in(Scopes.SINGLETON);
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, updated.

@@ -72,14 +72,7 @@ public void testShowSession()
@Test
public void testSetJavaWorkerSessionProperty()
Copy link
Contributor

Choose a reason for hiding this comment

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

need a test that when exclude-invalid-session-properties is false that the session properties are visible. (and make sure we have true and false tests both for java and cpp.

Copy link
Contributor Author

@pdabre12 pdabre12 Jan 31, 2025

Choose a reason for hiding this comment

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

Test cases added:

  1. Native cluster invalid test :
  2. Native cluster valid test:

True and false tests for java clusters.

@pdabre12 pdabre12 force-pushed the add-java-worker-exclusion-config-property branch from 9b3f472 to e36b36e Compare January 31, 2025 20:50
@pdabre12
Copy link
Contributor Author

@rschlussel Can you please have another look? Thanks.


import static com.facebook.presto.testing.TestingSession.testSessionBuilder;

public class TestSetWorkerSessionPropertiesExcludingInvalidProperties
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's just remove the inheritance and create two classes. I feel like that's more straightforward than excluding tests depending on the subclass. Some duplication is OK here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, thanks.

@pdabre12 pdabre12 force-pushed the add-java-worker-exclusion-config-property branch from e36b36e to f3033e0 Compare January 31, 2025 23:00
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.

Skip adding java-worker related session properties in a C++ cluster
4 participants