reset lifetimes for the replication throttle

This commit is contained in:
Fangjin Yang 2013-02-06 17:41:08 -08:00
parent d023d219ae
commit 0d303bee96
2 changed files with 11 additions and 5 deletions

View File

@ -33,14 +33,14 @@ public class DruidMasterRuleRunner implements DruidMasterHelper
{
private static final EmittingLogger log = new EmittingLogger(DruidMasterRuleRunner.class);
private final ReplicationThrottler replicationManager;
private final ReplicationThrottler replicatorThrottler;
private final DruidMaster master;
public DruidMasterRuleRunner(DruidMaster master, int replicantLifeTime, int replicantThrottleLimit)
{
this.master = master;
this.replicationManager = new ReplicationThrottler(replicantThrottleLimit, replicantLifeTime);
this.replicatorThrottler = new ReplicationThrottler(replicantThrottleLimit, replicantLifeTime);
}
@Override
@ -55,12 +55,12 @@ public class DruidMasterRuleRunner implements DruidMasterHelper
}
for (String tier : cluster.getTierNames()) {
replicationManager.updateReplicationState(tier);
replicationManager.updateTerminationState(tier);
replicatorThrottler.updateReplicationState(tier);
replicatorThrottler.updateTerminationState(tier);
}
DruidMasterRuntimeParams paramsWithReplicationManager = params.buildFromExisting()
.withReplicationManager(replicationManager)
.withReplicationManager(replicatorThrottler)
.build();
// Run through all matched rules for available segments

View File

@ -76,6 +76,7 @@ public class ReplicationThrottler
} else {
log.info("[%s]: Replicant %s queue is empty.", tier, type);
lookup.put(tier, true);
holder.resetLifetime(tier);
}
}
@ -162,5 +163,10 @@ public class ReplicationThrottler
}
lifetimes.put(tier, --lifetime);
}
public void resetLifetime(String tier)
{
lifetimes.put(tier, maxLifetime);
}
}
}