This is an automated email from the ASF dual-hosted git repository.
CRZbulabula pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new fe77cf1e0ae Fix invalid WAL throttle threshold persistence (#18327)
fe77cf1e0ae is described below
commit fe77cf1e0aed287036345e1e8fc29846dae6f327
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 fee78f5568a..d646b359e1f 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
@@ -369,6 +369,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
@@ -1791,6 +1793,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 =