Skip to content
Closed
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 @@ -224,11 +224,11 @@ public void shutdownReconfigurationTask() {
public final void reconfigureProperty(String property, String newVal)
throws ReconfigurationException {
if (isPropertyReconfigurable(property)) {
LOG.info("changing property " + property + " to " + newVal);
synchronized(getConf()) {
getConf().get(property);
String effectiveValue = reconfigurePropertyImpl(property, newVal);
if (newVal != null) {
if (effectiveValue != null) {
LOG.info("changing property " + property + " to " + effectiveValue);
getConf().set(property, effectiveValue);
} else {
getConf().unset(property);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1039,13 +1039,13 @@ private String reconfDiskBalancerParameters(String property, String newVal)
result = Boolean.toString(enable);
} else if (property.equals(DFS_DISK_BALANCER_PLAN_VALID_INTERVAL)) {
if (newVal == null) {
// set to default
// set to the value of the current system or default
long defaultInterval = getConf().getTimeDuration(
DFS_DISK_BALANCER_PLAN_VALID_INTERVAL,
DFS_DISK_BALANCER_PLAN_VALID_INTERVAL_DEFAULT,
TimeUnit.MILLISECONDS);
getDiskBalancer().setPlanValidityInterval(defaultInterval);
result = DFS_DISK_BALANCER_PLAN_VALID_INTERVAL_DEFAULT;
result = Long.toString(defaultInterval);
} else {
long newInterval = getConf()
.getTimeDurationHelper(DFS_DISK_BALANCER_PLAN_VALID_INTERVAL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,17 @@ public void testDiskBalancerParameters() throws Exception {
dn.reconfigureProperty(DFS_DISK_BALANCER_PLAN_VALID_INTERVAL, "1m");
assertEquals(60000, dn.getDiskBalancer().getPlanValidityInterval());
assertEquals(60000, dn.getDiskBalancer().getPlanValidityIntervalInConfig());

// Verify set to the value of the current system
long curTimeInterval = dn.getConf().getTimeDuration(DFS_DISK_BALANCER_PLAN_VALID_INTERVAL,
DFS_DISK_BALANCER_PLAN_VALID_INTERVAL_DEFAULT, TimeUnit.MILLISECONDS);
dn.reconfigureProperty(DFS_DISK_BALANCER_PLAN_VALID_INTERVAL, null);
assertEquals(60000, curTimeInterval);
assertEquals(curTimeInterval, dn.getDiskBalancer().getPlanValidityInterval());
assertEquals(60000, dn.getDiskBalancer().getPlanValidityIntervalInConfig());
curTimeInterval = dn.getConf().getTimeDuration(DFS_DISK_BALANCER_PLAN_VALID_INTERVAL,
DFS_DISK_BALANCER_PLAN_VALID_INTERVAL_DEFAULT, TimeUnit.MILLISECONDS);
assertEquals(60000, curTimeInterval);
}
}

Expand Down