|
19 | 19 |
|
20 | 20 | package org.apache.iotdb.db.conf; |
21 | 21 |
|
| 22 | +import org.apache.iotdb.commons.conf.ConfigurationFileUtils; |
22 | 23 | import org.apache.iotdb.commons.conf.TrimProperties; |
23 | 24 | import org.apache.iotdb.commons.utils.RegionMigrationFileRemoveRateLimiter; |
24 | 25 |
|
|
36 | 37 | import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; |
37 | 38 |
|
38 | 39 | public class PropertiesTest { |
| 40 | + @Test |
| 41 | + public void testHotReloadNegativeWalThrottleThresholdUsesDefault() throws Exception { |
| 42 | + final String key = "wal_throttle_threshold_in_byte"; |
| 43 | + final long configuredThreshold = 1024 * 1024 * 1024L; |
| 44 | + final long defaultThreshold = |
| 45 | + Long.parseLong(ConfigurationFileUtils.getConfigurationDefaultValue(key)); |
| 46 | + final IoTDBDescriptor descriptor = IoTDBDescriptor.getInstance(); |
| 47 | + final long originalThreshold = descriptor.getConfig().getThrottleThreshold(); |
| 48 | + |
| 49 | + try { |
| 50 | + final TrimProperties properties = new TrimProperties(); |
| 51 | + properties.setProperty(key, Long.toString(configuredThreshold)); |
| 52 | + descriptor.loadHotModifiedProps(properties); |
| 53 | + Assert.assertEquals(configuredThreshold, descriptor.getConfig().getThrottleThreshold()); |
| 54 | + |
| 55 | + properties.setProperty(key, "-1"); |
| 56 | + descriptor.loadHotModifiedProps(properties); |
| 57 | + Assert.assertEquals(defaultThreshold, descriptor.getConfig().getThrottleThreshold()); |
| 58 | + Assert.assertEquals( |
| 59 | + Long.toString(defaultThreshold), ConfigurationFileUtils.getAppliedProperties().get(key)); |
| 60 | + } finally { |
| 61 | + final TrimProperties properties = new TrimProperties(); |
| 62 | + properties.setProperty(key, Long.toString(originalThreshold)); |
| 63 | + descriptor.loadHotModifiedProps(properties); |
| 64 | + } |
| 65 | + } |
| 66 | + |
39 | 67 | @Test |
40 | 68 | public void testHotReloadRegionMigrationFileRemoveSpeedLimit() throws Exception { |
41 | 69 | IoTDBDescriptor descriptor = IoTDBDescriptor.getInstance(); |
|
0 commit comments