From 23da0e830ebfb809ffd9bc04e6e280e5ad44db43 Mon Sep 17 00:00:00 2001 From: Ashhar Hasan Date: Wed, 29 May 2024 15:24:29 +0530 Subject: [PATCH] Revert "Enable JMX metrics for resource groups by default" This reverts commit 74e3ffa65e18d2db7938d5e17b6036b8dac42efc. After this change JMX metrics for resource groups were not exported at all. --- .../resourcegroups/InternalResourceGroup.java | 2 +- docs/src/main/sphinx/admin/resource-groups.md | 2 +- .../db/TestDbResourceGroupConfigurationManager.java | 10 +++++----- .../src/test/resources/resource_groups_config.json | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java b/core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java index 53f23ff2ac50..be3c4003a24d 100644 --- a/core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java +++ b/core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java @@ -104,7 +104,7 @@ public class InternalResourceGroup @GuardedBy("root") private SchedulingPolicy schedulingPolicy = FAIR; @GuardedBy("root") - private boolean jmxExport = true; + private boolean jmxExport; // Live data structures // ==================== diff --git a/docs/src/main/sphinx/admin/resource-groups.md b/docs/src/main/sphinx/admin/resource-groups.md index 52b55f8e6937..f49d806c05d2 100644 --- a/docs/src/main/sphinx/admin/resource-groups.md +++ b/docs/src/main/sphinx/admin/resource-groups.md @@ -132,7 +132,7 @@ are reflected automatically for incoming queries. {ref}`scheduleweight-example`. - `jmxExport` (optional): If true, group statistics are exported to JMX for monitoring. - Defaults to `true`. + Defaults to `false`. - `subGroups` (optional): list of sub-groups. diff --git a/plugin/trino-resource-group-managers/src/test/java/io/trino/plugin/resourcegroups/db/TestDbResourceGroupConfigurationManager.java b/plugin/trino-resource-group-managers/src/test/java/io/trino/plugin/resourcegroups/db/TestDbResourceGroupConfigurationManager.java index ab9d813aba91..27b75af76a12 100644 --- a/plugin/trino-resource-group-managers/src/test/java/io/trino/plugin/resourcegroups/db/TestDbResourceGroupConfigurationManager.java +++ b/plugin/trino-resource-group-managers/src/test/java/io/trino/plugin/resourcegroups/db/TestDbResourceGroupConfigurationManager.java @@ -118,7 +118,7 @@ public void testConfiguration() assertEqualsResourceGroup(global, "1MB", 1000, 100, 100, WEIGHTED, DEFAULT_WEIGHT, true, Duration.ofHours(1), Duration.ofDays(1)); InternalResourceGroup sub = global.getOrCreateSubGroup("sub"); manager.configure(sub, new SelectionContext<>(sub.getId(), new ResourceGroupIdTemplate("global.sub"))); - assertEqualsResourceGroup(sub, "2MB", 4, 3, 3, FAIR, 5, true, Duration.ofMillis(Long.MAX_VALUE), Duration.ofMillis(Long.MAX_VALUE)); + assertEqualsResourceGroup(sub, "2MB", 4, 3, 3, FAIR, 5, false, Duration.ofMillis(Long.MAX_VALUE), Duration.ofMillis(Long.MAX_VALUE)); } @Test @@ -197,14 +197,14 @@ public void testReconfig() InternalResourceGroup globalSub = global.getOrCreateSubGroup("sub"); manager.configure(globalSub, new SelectionContext<>(globalSub.getId(), new ResourceGroupIdTemplate("global.sub"))); // Verify record exists - assertEqualsResourceGroup(globalSub, "2MB", 4, 3, 3, FAIR, 5, true, Duration.ofMillis(Long.MAX_VALUE), Duration.ofMillis(Long.MAX_VALUE)); - dao.updateResourceGroup(2, "sub", "3MB", 2, 1, 1, "weighted", 6, false, "1h", "1d", 1L, ENVIRONMENT); + assertEqualsResourceGroup(globalSub, "2MB", 4, 3, 3, FAIR, 5, false, Duration.ofMillis(Long.MAX_VALUE), Duration.ofMillis(Long.MAX_VALUE)); + dao.updateResourceGroup(2, "sub", "3MB", 2, 1, 1, "weighted", 6, true, "1h", "1d", 1L, ENVIRONMENT); do { MILLISECONDS.sleep(500); } - while (globalSub.getJmxExport() == true); + while (globalSub.getJmxExport() == false); // Verify update - assertEqualsResourceGroup(globalSub, "3MB", 2, 1, 1, WEIGHTED, 6, false, Duration.ofHours(1), Duration.ofDays(1)); + assertEqualsResourceGroup(globalSub, "3MB", 2, 1, 1, WEIGHTED, 6, true, Duration.ofHours(1), Duration.ofDays(1)); // Verify delete dao.deleteSelectors(2); dao.deleteResourceGroup(2); diff --git a/plugin/trino-resource-group-managers/src/test/resources/resource_groups_config.json b/plugin/trino-resource-group-managers/src/test/resources/resource_groups_config.json index 6ac045f96a66..7fd9c5e87b17 100644 --- a/plugin/trino-resource-group-managers/src/test/resources/resource_groups_config.json +++ b/plugin/trino-resource-group-managers/src/test/resources/resource_groups_config.json @@ -15,8 +15,7 @@ "softMemoryLimit": "2MB", "hardConcurrencyLimit": 3, "maxQueued": 4, - "schedulingWeight": 5, - "jmxExport": false + "schedulingWeight": 5 } ] }