swuferhong commented on code in PR #2178: URL: https://github.com/apache/fluss/pull/2178#discussion_r2629318433
########## fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/procedure/SetClusterConfigProcedure.java: ########## @@ -0,0 +1,128 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.fluss.flink.procedure; + +import org.apache.fluss.config.cluster.AlterConfig; +import org.apache.fluss.config.cluster.AlterConfigOpType; + +import org.apache.flink.table.annotation.ArgumentHint; +import org.apache.flink.table.annotation.DataTypeHint; +import org.apache.flink.table.annotation.ProcedureHint; +import org.apache.flink.table.procedure.ProcedureContext; + +import javax.annotation.Nullable; + +import java.util.Collections; + +/** + * Procedure to set or delete cluster configuration dynamically. + * + * <p>This procedure allows modifying dynamic cluster configurations. The changes are: + * + * <ul> + * <li>Validated by the CoordinatorServer before persistence + * <li>Persisted in ZooKeeper for durability + * <li>Applied to all relevant servers (Coordinator and TabletServers) + * <li>Survive server restarts + * </ul> + * + * <p>Usage examples: + * + * <pre> + * -- Set a configuration + * CALL sys.set_cluster_config('kv.shared-rate-limiter.bytes-per-sec', '200MB'); + * CALL sys.set_cluster_config('datalake.format', 'paimon'); + * + * -- Delete a configuration (reset to default) + * CALL sys.set_cluster_config('kv.shared-rate-limiter.bytes-per-sec', NULL); + * CALL sys.set_cluster_config('kv.shared-rate-limiter.bytes-per-sec', ''); Review Comment: Maybe `set_cluster_config` and `delete_cluster_config` can be divided into different procedures? ########## fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/procedure/FlinkProcedureITCase.java: ########## @@ -86,12 +87,42 @@ void before() throws ExecutionException, InterruptedException { tEnv.executeSql("use catalog " + CATALOG_NAME); } + @AfterEach + void after() throws Exception { + // Clean up any dynamic config changes made during the test + // to ensure tests don't affect each other + if (tEnv != null) { + try { + // Delete dynamic configs that might have been modified during tests + // This resets them to their initial static configuration values + tEnv.executeSql( + String.format( + "Call %s.sys.set_cluster_config('%s')", + CATALOG_NAME, + ConfigOptions.KV_SHARED_RATE_LIMITER_BYTES_PER_SEC.key())) + .await(); + tEnv.executeSql( + String.format( + "Call %s.sys.set_cluster_config('%s')", + CATALOG_NAME, ConfigOptions.DATALAKE_FORMAT.key())) + .await(); + } catch (Exception e) { + // Ignore cleanup errors to avoid masking test failures + } + } Review Comment: Can these be moved into test cases related to set cluster configuration? It feels a bit odd to place them in afterEach? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
