YARN-8025. UsersManangers#getComputedResourceLimitForActiveUsers throws NPE due to preComputedActiveUserLimit is empty. Contributed by Tao Yang.

This commit is contained in:
Weiwei Yang 2018-05-07 11:33:14 +08:00
parent e9159db623
commit 67f239c42f
1 changed files with 5 additions and 4 deletions

View File

@ -490,11 +490,12 @@ public class UsersManager implements AbstractUsersManager {
Resource clusterResource, String nodePartition,
SchedulingMode schedulingMode) {
Map<SchedulingMode, Resource> userLimitPerSchedulingMode = preComputedActiveUserLimit
.get(nodePartition);
Map<SchedulingMode, Resource> userLimitPerSchedulingMode;
try {
writeLock.lock();
userLimitPerSchedulingMode =
preComputedActiveUserLimit.get(nodePartition);
if (isRecomputeNeeded(schedulingMode, nodePartition, true)) {
// recompute
userLimitPerSchedulingMode = reComputeUserLimits(userName,
@ -548,11 +549,11 @@ public class UsersManager implements AbstractUsersManager {
Resource clusterResource, String nodePartition,
SchedulingMode schedulingMode) {
Map<SchedulingMode, Resource> userLimitPerSchedulingMode = preComputedAllUserLimit
.get(nodePartition);
Map<SchedulingMode, Resource> userLimitPerSchedulingMode;
try {
writeLock.lock();
userLimitPerSchedulingMode = preComputedAllUserLimit.get(nodePartition);
if (isRecomputeNeeded(schedulingMode, nodePartition, false)) {
// recompute
userLimitPerSchedulingMode = reComputeUserLimits(userName,