This is an automated email from the ASF dual-hosted git repository. JackieTien97 pushed a commit to branch rc/2.0.11 in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 2da273385dd55333d9106b16ca2797913f813e0a Author: Yongzao <[email protected]> AuthorDate: Tue Jul 28 14:04:00 2026 +0800 Fix invalid WAL throttle threshold persistence (#18327) --- .../iotdb/db/it/IoTDBSetConfigurationIT.java | 42 ++++++++++++++++++++++ .../iotdb/confignode/manager/ConfigManager.java | 13 +++++++ 2 files changed, 55 insertions(+) diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java index 964a67155d8..e58a661cf8d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java @@ -178,6 +178,48 @@ public class IoTDBSetConfigurationIT { checkConfigFileContains(nodeWrapper, "heartbeat_interval_in_ms=1000"))); } + @Test + public void testRejectedWalThrottleThresholdDoesNotUpdateConfiguration() { + String key = "wal_throttle_threshold_in_byte"; + String validValue = "1073741824"; + String defaultValue = "214748364800"; + int dataNodeId = EnvFactory.getEnv().getConfigNodeWrapperList().size(); + try (Connection connection = EnvFactory.getEnv().getConnection(); + Statement statement = connection.createStatement()) { + statement.execute("set configuration \"" + key + "\"=\"" + validValue + "\""); + assertAppliedConfiguration(0, key, validValue); + assertAppliedConfiguration(dataNodeId, key, validValue); + + for (String invalidValue : Arrays.asList("bad", "9223372036854775808")) { + assertSetConfigurationFailed( + statement, + "set configuration \"" + key + "\"=\"" + invalidValue + "\"", + "NumberFormatException"); + assertAppliedConfiguration(0, key, validValue); + assertAppliedConfiguration(dataNodeId, key, validValue); + Assert.assertTrue( + EnvFactory.getEnv().getNodeWrapperList().stream() + .allMatch( + nodeWrapper -> + checkConfigFileContains(nodeWrapper, key + "=" + validValue) + && !checkConfigFileContains(nodeWrapper, key + "=" + invalidValue))); + } + } catch (Exception e) { + Assert.fail(e.getMessage()); + } finally { + try (Connection connection = EnvFactory.getEnv().getConnection(); + Statement statement = connection.createStatement()) { + statement.execute("set configuration \"" + key + "\"=\"" + defaultValue + "\""); + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + } + Assert.assertTrue( + EnvFactory.getEnv().getNodeWrapperList().stream() + .allMatch( + nodeWrapper -> checkConfigFileContains(nodeWrapper, key + "=" + defaultValue))); + } + @Test public void testHotReloadRegionMigrationFileRemoveSpeedLimit() { String key = "region_migration_file_remove_speed_limit_bytes_per_second"; diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java index 80fd5302dab..1f674ebe810 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java @@ -367,6 +367,8 @@ public class ConfigManager implements IManager { private final CNAuditLogger auditLogger; private static final String DATABASE = "\tDatabase="; + private static final List<String> WAL_THROTTLE_THRESHOLD_KEYS = + Arrays.asList("iot_consensus_throttle_threshold_in_byte", "wal_throttle_threshold_in_byte"); public ConfigManager() throws IOException { // Build the persistence module @@ -1789,6 +1791,17 @@ public class ConfigManager implements IManager { @Override public TSStatus setConfiguration(TSetConfigurationReq req) { + for (String key : WAL_THROTTLE_THRESHOLD_KEYS) { + String value = req.getConfigs().get(key); + if (value == null) { + continue; + } + try { + Long.parseLong(value.trim()); + } catch (NumberFormatException e) { + return RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR, e.toString()); + } + } TSStatus tsStatus = new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()); int currentNodeId = CONF.getConfigNodeId(); TSStatus consistentClusterConfigStatus =
