Skip to content

Commit

Permalink
Add a config property for excluding java-worker session properties in…
Browse files Browse the repository at this point in the history
… a native cluster
  • Loading branch information
pdabre12 authored and Pratik Joseph Dabre committed Nov 6, 2024
1 parent fcac3b4 commit a9f640f
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
9 changes: 9 additions & 0 deletions presto-docs/src/main/sphinx/admin/properties.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ When enabled, the logical plan will begin to be built and validated before
queueing and allocation of cluster resources so that any errors or
incompatibilities in the query plan will fail quickly and inform the user.

``exclude-java-worker-session-properties``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* **Type:** ``boolean``
* **Default value:** ``false``

When ``exclude-java-worker-session-properties`` is ``true``, java-worker session properties will
be excluded from a native cluster.

.. _tuning-memory:

Memory Management Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ public final class SystemSessionProperties
public static final String OPTIMIZER_USE_HISTOGRAMS = "optimizer_use_histograms";
public static final String WARN_ON_COMMON_NAN_PATTERNS = "warn_on_common_nan_patterns";
public static final String INLINE_PROJECTIONS_ON_VALUES = "inline_projections_on_values";
public static final String EXCLUDE_JAVA_WORKER_SESSION_PROPERTIES = "exclude-java-worker-session-properties";

// TODO: Native execution related session properties that are temporarily put here. They will be relocated in the future.
public static final String NATIVE_AGGREGATION_SPILL_ALL = "native_aggregation_spill_all";
Expand Down Expand Up @@ -1824,6 +1825,11 @@ public SystemSessionProperties(
booleanProperty(INLINE_PROJECTIONS_ON_VALUES,
"Whether to evaluate project node on values node",
featuresConfig.getInlineProjectionsOnValues(),
false),
booleanProperty(
EXCLUDE_JAVA_WORKER_SESSION_PROPERTIES,
"Exclude java-worker session properties from a native cluster",
featuresConfig.isExcludeJavaWorkerSessionProperties(),
false));
}

Expand Down Expand Up @@ -3100,4 +3106,9 @@ public static boolean isInlineProjectionsOnValues(Session session)
{
return session.getSystemProperty(INLINE_PROJECTIONS_ON_VALUES, Boolean.class);
}

public static boolean isExcludeJavaWorkerSessionProperties(Session session)
{
return session.getSystemProperty(EXCLUDE_JAVA_WORKER_SESSION_PROPERTIES, Boolean.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
mapBinder.addBinding("java-worker").to(JavaWorkerSessionPropertyProvider.class).in(Scopes.SINGLETON);
}
if (!serverConfig.isCoordinatorSidecarEnabled()) {
mapBinder.addBinding("native-worker").to(NativeWorkerSessionPropertyProvider.class).in(Scopes.SINGLETON);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ public class FeaturesConfig
private boolean isInlineProjectionsOnValuesEnabled;

private boolean eagerPlanValidationEnabled;

private boolean excludeJavaWorkerSessionProperties;
private int eagerPlanValidationThreadPoolSize = 20;

public enum PartitioningPrecisionStrategy
Expand Down Expand Up @@ -2846,4 +2848,17 @@ public int getEagerPlanValidationThreadPoolSize()
{
return this.eagerPlanValidationThreadPoolSize;
}

@Config("exclude-java-worker-session-properties")
@ConfigDescription("Exclude java-worker session properties")
public FeaturesConfig setExcludeJavaWorkerSessionProperties(boolean excludeJavaWorkerSessionProperties)
{
this.excludeJavaWorkerSessionProperties = excludeJavaWorkerSessionProperties;
return this;
}

public boolean isExcludeJavaWorkerSessionProperties()
{
return this.excludeJavaWorkerSessionProperties;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ public void testDefaults()
.setUseHistograms(false)
.setInlineProjectionsOnValues(false)
.setEagerPlanValidationEnabled(false)
.setEagerPlanValidationThreadPoolSize(20));
.setEagerPlanValidationThreadPoolSize(20)
.setExcludeJavaWorkerSessionProperties(false));
}

@Test
Expand Down Expand Up @@ -442,6 +443,7 @@ public void testExplicitPropertyMappings()
.put("optimizer.inline-projections-on-values", "true")
.put("eager-plan-validation-enabled", "true")
.put("eager-plan-validation-thread-pool-size", "2")
.put("exclude-java-worker-session-properties", "true")
.build();

FeaturesConfig expected = new FeaturesConfig()
Expand Down Expand Up @@ -634,7 +636,8 @@ public void testExplicitPropertyMappings()
.setUseHistograms(true)
.setInlineProjectionsOnValues(true)
.setEagerPlanValidationEnabled(true)
.setEagerPlanValidationThreadPoolSize(2);
.setEagerPlanValidationThreadPoolSize(2)
.setExcludeJavaWorkerSessionProperties(true);
assertFullMapping(properties, expected);
}

Expand Down

0 comments on commit a9f640f

Please sign in to comment.