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

View File

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