YARN-7636. Re-reservation count may overflow when cluster resource exhausted for a long time. contributed by Tao Yang.

This commit is contained in:
Weiwei Yang 2018-03-16 18:57:31 +08:00
parent 21c6661461
commit 154cfb2b62
1 changed files with 12 additions and 3 deletions

View File

@ -418,7 +418,11 @@ public class SchedulerApplicationAttempt implements SchedulableEntity {
protected void addReReservation( protected void addReReservation(
SchedulerRequestKey schedulerKey) { SchedulerRequestKey schedulerKey) {
try {
reReservations.add(schedulerKey); reReservations.add(schedulerKey);
} catch (IllegalArgumentException e) {
// This happens when count = MAX_INT, ignore the exception
}
} }
public int getReReservations(SchedulerRequestKey schedulerKey) { public int getReReservations(SchedulerRequestKey schedulerKey) {
@ -1006,8 +1010,13 @@ public class SchedulerApplicationAttempt implements SchedulableEntity {
public int addMissedNonPartitionedRequestSchedulingOpportunity( public int addMissedNonPartitionedRequestSchedulingOpportunity(
SchedulerRequestKey schedulerKey) { SchedulerRequestKey schedulerKey) {
try {
return missedNonPartitionedReqSchedulingOpportunity.add( return missedNonPartitionedReqSchedulingOpportunity.add(
schedulerKey, 1) + 1; schedulerKey, 1) + 1;
} catch (IllegalArgumentException e) {
// This happens when count = MAX_INT, ignore the exception
return Integer.MAX_VALUE;
}
} }
public void public void