Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,11 @@ private void loadWALHotModifiedProps(TrimProperties properties) throws IOExcepti
}

long throttleDownThresholdInByte = Long.parseLong(getWalThrottleThreshold(properties));
if (throttleDownThresholdInByte < 0) {
throttleDownThresholdInByte =
Long.parseLong(
ConfigurationFileUtils.getConfigurationDefaultValue(DEFAULT_WAL_THRESHOLD_NAME[1]));
}
if (throttleDownThresholdInByte > 0) {
conf.setThrottleThreshold(throttleDownThresholdInByte);
}
Expand Down Expand Up @@ -2401,6 +2406,8 @@ private void overlayEffectiveConfigurationValues() {
Long.toString(commonDescriptor.getConfig().getSortBufferSize()));
ConfigurationFileUtils.updateAppliedProperties(
"mods_cache_size_limit_per_fi_in_bytes", Long.toString(conf.getModsCacheSizeLimitPerFI()));
ConfigurationFileUtils.updateAppliedProperties(
DEFAULT_WAL_THRESHOLD_NAME[1], Long.toString(conf.getThrottleThreshold()));
}

private void loadQuerySampleThroughput(TrimProperties properties) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.apache.iotdb.db.conf;

import org.apache.iotdb.commons.conf.ConfigurationFileUtils;
import org.apache.iotdb.commons.conf.TrimProperties;
import org.apache.iotdb.commons.utils.RegionMigrationFileRemoveRateLimiter;

Expand All @@ -36,6 +37,33 @@
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;

public class PropertiesTest {
@Test
public void testHotReloadNegativeWalThrottleThresholdUsesDefault() throws Exception {
final String key = "wal_throttle_threshold_in_byte";
final long configuredThreshold = 1024 * 1024 * 1024L;
final long defaultThreshold =
Long.parseLong(ConfigurationFileUtils.getConfigurationDefaultValue(key));
final IoTDBDescriptor descriptor = IoTDBDescriptor.getInstance();
final long originalThreshold = descriptor.getConfig().getThrottleThreshold();

try {
final TrimProperties properties = new TrimProperties();
properties.setProperty(key, Long.toString(configuredThreshold));
descriptor.loadHotModifiedProps(properties);
Assert.assertEquals(configuredThreshold, descriptor.getConfig().getThrottleThreshold());

properties.setProperty(key, "-1");
descriptor.loadHotModifiedProps(properties);
Assert.assertEquals(defaultThreshold, descriptor.getConfig().getThrottleThreshold());
Assert.assertEquals(
Long.toString(defaultThreshold), ConfigurationFileUtils.getAppliedProperties().get(key));
} finally {
final TrimProperties properties = new TrimProperties();
properties.setProperty(key, Long.toString(originalThreshold));
descriptor.loadHotModifiedProps(properties);
}
}

@Test
public void testHotReloadRegionMigrationFileRemoveSpeedLimit() throws Exception {
IoTDBDescriptor descriptor = IoTDBDescriptor.getInstance();
Expand Down
Loading