From 5453fc2a2ada2f2f7b28a2db2f5553e231587e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Osipiuk?= Date: Sat, 14 May 2022 09:10:47 +0200 Subject: [PATCH 1/2] Rename least-wasted task killing policy to least-waste --- .../src/main/java/io/trino/memory/MemoryManagerConfig.java | 6 +++--- .../src/main/java/io/trino/server/CoordinatorModule.java | 2 +- docs/src/main/sphinx/admin/properties-query-management.rst | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/memory/MemoryManagerConfig.java b/core/trino-main/src/main/java/io/trino/memory/MemoryManagerConfig.java index 4485b5599785..9be2ba1060e2 100644 --- a/core/trino-main/src/main/java/io/trino/memory/MemoryManagerConfig.java +++ b/core/trino-main/src/main/java/io/trino/memory/MemoryManagerConfig.java @@ -203,7 +203,7 @@ public enum LowMemoryTaskKillerPolicy { NONE, TOTAL_RESERVATION_ON_BLOCKED_NODES, - LEAST_WASTED, + LEAST_WASTE, /**/; public static LowMemoryTaskKillerPolicy fromString(String value) @@ -213,8 +213,8 @@ public static LowMemoryTaskKillerPolicy fromString(String value) return NONE; case "total-reservation-on-blocked-nodes": return TOTAL_RESERVATION_ON_BLOCKED_NODES; - case "least-wasted": - return LEAST_WASTED; + case "least-waste": + return LEAST_WASTE; } throw new IllegalArgumentException(format("Unrecognized value: '%s'", value)); diff --git a/core/trino-main/src/main/java/io/trino/server/CoordinatorModule.java b/core/trino-main/src/main/java/io/trino/server/CoordinatorModule.java index 9d39e3b92b33..456620fcc611 100644 --- a/core/trino-main/src/main/java/io/trino/server/CoordinatorModule.java +++ b/core/trino-main/src/main/java/io/trino/server/CoordinatorModule.java @@ -221,7 +221,7 @@ protected void setup(Binder binder) bindLowMemoryTaskKiller(LowMemoryTaskKillerPolicy.NONE, NoneLowMemoryKiller.class); bindLowMemoryTaskKiller(LowMemoryTaskKillerPolicy.TOTAL_RESERVATION_ON_BLOCKED_NODES, TotalReservationOnBlockedNodesTaskLowMemoryKiller.class); - bindLowMemoryTaskKiller(LowMemoryTaskKillerPolicy.LEAST_WASTED, LeastWastedEffortTaskLowMemoryKiller.class); + bindLowMemoryTaskKiller(LowMemoryTaskKillerPolicy.LEAST_WASTE, LeastWastedEffortTaskLowMemoryKiller.class); bindLowMemoryQueryKiller(LowMemoryQueryKillerPolicy.NONE, NoneLowMemoryKiller.class); bindLowMemoryQueryKiller(LowMemoryQueryKillerPolicy.TOTAL_RESERVATION, TotalReservationLowMemoryKiller.class); bindLowMemoryQueryKiller(LowMemoryQueryKillerPolicy.TOTAL_RESERVATION_ON_BLOCKED_NODES, TotalReservationOnBlockedNodesQueryLowMemoryKiller.class); diff --git a/docs/src/main/sphinx/admin/properties-query-management.rst b/docs/src/main/sphinx/admin/properties-query-management.rst index 6813e9cdf1ee..b27add3d8d7d 100644 --- a/docs/src/main/sphinx/admin/properties-query-management.rst +++ b/docs/src/main/sphinx/admin/properties-query-management.rst @@ -63,7 +63,7 @@ memory availability. Supports the following values: * ``total-reservation-on-blocked-nodes`` - Kill the tasks which are part of the queries which has task retries enabled and are currently using the most memory specifically on nodes that are now out of memory. -* ``least-wasted`` - Kill the tasks which are part of the queries +* ``least-waste`` - Kill the tasks which are part of the queries which has task retries enabled and use significant amount of memory on nodes which are now out of memory. This policy avoids killing tasks which are already executing for a long time, so significant amount of work is not wasted. From 27353d0fd5d4033c5b3104bb200424c846cc44ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Osipiuk?= Date: Sat, 14 May 2022 09:15:50 +0200 Subject: [PATCH 2/2] Rename killer policy config --- .../main/java/io/trino/memory/MemoryManagerConfig.java | 6 ++---- .../java/io/trino/memory/TestMemoryManagerConfig.java | 4 ++-- docs/src/main/sphinx/admin/fault-tolerant-execution.rst | 2 +- .../src/main/sphinx/admin/properties-query-management.rst | 8 ++++---- .../src/test/java/io/trino/memory/TestMemoryManager.java | 2 +- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/memory/MemoryManagerConfig.java b/core/trino-main/src/main/java/io/trino/memory/MemoryManagerConfig.java index 9be2ba1060e2..af2130f95c58 100644 --- a/core/trino-main/src/main/java/io/trino/memory/MemoryManagerConfig.java +++ b/core/trino-main/src/main/java/io/trino/memory/MemoryManagerConfig.java @@ -16,7 +16,6 @@ import io.airlift.configuration.Config; import io.airlift.configuration.ConfigDescription; import io.airlift.configuration.DefunctConfig; -import io.airlift.configuration.LegacyConfig; import io.airlift.units.DataSize; import io.airlift.units.Duration; @@ -55,8 +54,7 @@ public LowMemoryQueryKillerPolicy getLowMemoryQueryKillerPolicy() return lowMemoryQueryKillerPolicy; } - @LegacyConfig("query.low-memory-killer.policy") - @Config("query.low-memory-query-killer.policy") + @Config("query.low-memory-killer.policy") public MemoryManagerConfig setLowMemoryQueryKillerPolicy(LowMemoryQueryKillerPolicy lowMemoryQueryKillerPolicy) { this.lowMemoryQueryKillerPolicy = lowMemoryQueryKillerPolicy; @@ -68,7 +66,7 @@ public LowMemoryTaskKillerPolicy getLowMemoryTaskKillerPolicy() return lowMemoryTaskKillerPolicy; } - @Config("query.low-memory-task-killer.policy") + @Config("task.low-memory-killer.policy") public MemoryManagerConfig setLowMemoryTaskKillerPolicy(LowMemoryTaskKillerPolicy lowMemoryTaskKillerPolicy) { this.lowMemoryTaskKillerPolicy = lowMemoryTaskKillerPolicy; diff --git a/core/trino-main/src/test/java/io/trino/memory/TestMemoryManagerConfig.java b/core/trino-main/src/test/java/io/trino/memory/TestMemoryManagerConfig.java index 0df03a9773f9..70530ad9a2ac 100644 --- a/core/trino-main/src/test/java/io/trino/memory/TestMemoryManagerConfig.java +++ b/core/trino-main/src/test/java/io/trino/memory/TestMemoryManagerConfig.java @@ -51,8 +51,8 @@ public void testDefaults() public void testExplicitPropertyMappings() { Map properties = ImmutableMap.builder() - .put("query.low-memory-query-killer.policy", "none") - .put("query.low-memory-task-killer.policy", "none") + .put("query.low-memory-killer.policy", "none") + .put("task.low-memory-killer.policy", "none") .put("query.low-memory-killer.delay", "20s") .put("query.max-memory", "2GB") .put("query.max-total-memory", "3GB") diff --git a/docs/src/main/sphinx/admin/fault-tolerant-execution.rst b/docs/src/main/sphinx/admin/fault-tolerant-execution.rst index a088aa4d870e..83cbd443e6b4 100644 --- a/docs/src/main/sphinx/admin/fault-tolerant-execution.rst +++ b/docs/src/main/sphinx/admin/fault-tolerant-execution.rst @@ -99,7 +99,7 @@ query. The following cluster configuration changes are recommended to improve fault-tolerant execution with a ``TASK`` retry policy: -* Set the ``query.low-memory-task-killer.policy`` +* Set the ``task.low-memory-killer.policy`` :doc:`query management property ` to ``total-reservation-on-blocked-nodes``, or queries may need to be manually killed if the cluster runs out of memory. diff --git a/docs/src/main/sphinx/admin/properties-query-management.rst b/docs/src/main/sphinx/admin/properties-query-management.rst index b27add3d8d7d..a9b378e3c936 100644 --- a/docs/src/main/sphinx/admin/properties-query-management.rst +++ b/docs/src/main/sphinx/admin/properties-query-management.rst @@ -32,7 +32,7 @@ stages of a query. You can use the following execution policies: The number of partitions to use for processing distributed operations, such as joins, aggregations, partitioned window functions and others. -``query.low-memory-query-killer.policy`` +``query.low-memory-killer.policy`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * **Type:** :ref:`prop-type-string` @@ -50,7 +50,7 @@ memory availability. Supports the following values: Only applies for queries with task level retries disabled (``retry-policy`` set to ``NONE`` or ``QUERY``) -``query.low-memory-task-killer.policy`` +``task.low-memory-killer.policy`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * **Type:** :ref:`prop-type-string` @@ -79,8 +79,8 @@ memory availability. Supports the following values: * **Default value:** ``5m`` The amount of time a query is allowed to recover between running out of memory -and being killed, if ``query.low-memory-query-killer.policy`` or -``query.low-memory-task-killer.policy`` is set to value differnt than ``none``. +and being killed, if ``query.low-memory-killer.policy`` or +``task.low-memory-killer.policy`` is set to value differnt than ``none``. ``query.max-execution-time`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/testing/trino-tests/src/test/java/io/trino/memory/TestMemoryManager.java b/testing/trino-tests/src/test/java/io/trino/memory/TestMemoryManager.java index efbd90ea1553..2bbe55477b09 100644 --- a/testing/trino-tests/src/test/java/io/trino/memory/TestMemoryManager.java +++ b/testing/trino-tests/src/test/java/io/trino/memory/TestMemoryManager.java @@ -116,7 +116,7 @@ public void testOutOfMemoryKiller() { Map properties = ImmutableMap.builder() .put("query.low-memory-killer.delay", "5s") - .put("query.low-memory-query-killer.policy", "total-reservation") + .put("query.low-memory-killer.policy", "total-reservation") .buildOrThrow(); try (DistributedQueryRunner queryRunner = createQueryRunner(TINY_SESSION, properties)) {