Change log level from debug to warn when update stale leases
Change log level from debug to warn when update stale leases
This commit is contained in:
parent
a323272a97
commit
72aeac3819
2 changed files with 23 additions and 24 deletions
|
|
@ -47,7 +47,8 @@ import software.amazon.kinesis.metrics.MetricsFactory;
|
|||
import software.amazon.kinesis.metrics.MetricsLevel;
|
||||
import software.amazon.kinesis.metrics.MetricsScope;
|
||||
import software.amazon.kinesis.metrics.MetricsUtil;
|
||||
import static software.amazon.kinesis.common.CommonCalculations.*;
|
||||
|
||||
import static software.amazon.kinesis.common.CommonCalculations.getRenewerTakerIntervalMillis;
|
||||
|
||||
/**
|
||||
* LeaseCoordinator abstracts away LeaseTaker and LeaseRenewer from the application code that's using leasing. It owns
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ import software.amazon.kinesis.metrics.MetricsFactory;
|
|||
import software.amazon.kinesis.metrics.MetricsLevel;
|
||||
import software.amazon.kinesis.metrics.MetricsScope;
|
||||
import software.amazon.kinesis.metrics.MetricsUtil;
|
||||
import static software.amazon.kinesis.common.CommonCalculations.*;
|
||||
|
||||
import static software.amazon.kinesis.common.CommonCalculations.getRenewerTakerIntervalMillis;
|
||||
|
||||
/**
|
||||
* An implementation of {@link LeaseTaker} that uses DynamoDB via {@link LeaseRefresher}.
|
||||
|
|
@ -51,7 +52,7 @@ import static software.amazon.kinesis.common.CommonCalculations.*;
|
|||
public class DynamoDBLeaseTaker implements LeaseTaker {
|
||||
private static final int TAKE_RETRIES = 3;
|
||||
private static final int SCAN_RETRIES = 1;
|
||||
private long veryOldLeaseDurationNanosMultiplier = 3;
|
||||
private static final double RENEWAL_SLACK_PERCENTAGE = 0.5;
|
||||
|
||||
// See note on TAKE_LEASES_DIMENSION(Callable) for why we have this callable.
|
||||
private static final Callable<Long> SYSTEM_CLOCK_CALLABLE = System::nanoTime;
|
||||
|
|
@ -64,15 +65,15 @@ public class DynamoDBLeaseTaker implements LeaseTaker {
|
|||
private final long leaseRenewalIntervalMillis;
|
||||
private final MetricsFactory metricsFactory;
|
||||
|
||||
private final double RENEWAL_SLACK_PERCENTAGE = 0.5;
|
||||
|
||||
private final Map<String, Lease> allLeases = new HashMap<>();
|
||||
final Map<String, Lease> allLeases = new HashMap<>();
|
||||
// TODO: Remove these defaults and use the defaults in the config
|
||||
private int maxLeasesForWorker = Integer.MAX_VALUE;
|
||||
private int maxLeasesToStealAtOneTime = 1;
|
||||
|
||||
private long veryOldLeaseDurationNanosMultiplier = 3;
|
||||
private long lastScanTimeNanos = 0L;
|
||||
|
||||
|
||||
public DynamoDBLeaseTaker(LeaseRefresher leaseRefresher, String workerIdentifier, long leaseDurationMillis,
|
||||
final MetricsFactory metricsFactory) {
|
||||
this.leaseRefresher = leaseRefresher;
|
||||
|
|
@ -259,7 +260,8 @@ public class DynamoDBLeaseTaker implements LeaseTaker {
|
|||
try {
|
||||
return leaseRefresher.getLease(lease.leaseKey());
|
||||
} catch (DependencyException | InvalidStateException | ProvisionedThroughputException e) {
|
||||
log.debug("Unable to retrieve the current lease, defaulting to existing lease", e);
|
||||
log.warn("Unable to retrieve the current lease while refreshing the stale lease, "
|
||||
+ "defaulting to existing lease", e);
|
||||
}
|
||||
}
|
||||
return lease;
|
||||
|
|
@ -599,11 +601,7 @@ public class DynamoDBLeaseTaker implements LeaseTaker {
|
|||
}
|
||||
|
||||
// If I have no leases, I wasn't represented in leaseCounts. Let's fix that.
|
||||
Integer myCount = leaseCounts.get(workerIdentifier);
|
||||
if (myCount == null) {
|
||||
myCount = 0;
|
||||
leaseCounts.put(workerIdentifier, myCount);
|
||||
}
|
||||
leaseCounts.putIfAbsent(workerIdentifier, 0);
|
||||
|
||||
return leaseCounts;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue