YARN-1523. Use StandbyException instead of RMNotYetReadyException (kasha)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1553620 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
59df96e4e3
commit
b99dd5de74
|
@ -171,6 +171,8 @@ Release 2.4.0 - UNRELEASED
|
||||||
|
|
||||||
YARN-1172. Convert SecretManagers in RM to services (Tsuyoshi OZAWA via kasha)
|
YARN-1172. Convert SecretManagers in RM to services (Tsuyoshi OZAWA via kasha)
|
||||||
|
|
||||||
|
YARN-1523. Use StandbyException instead of RMNotYetReadyException (kasha)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.apache.hadoop.yarn.exceptions;
|
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
|
||||||
import org.apache.hadoop.classification.InterfaceStability;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exception to be thrown when an Active-Only operation is attempted on a
|
|
||||||
* ResourceManager that is not Active.
|
|
||||||
*/
|
|
||||||
@InterfaceAudience.Private
|
|
||||||
@InterfaceStability.Evolving
|
|
||||||
public class RMNotYetActiveException extends YarnException {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public RMNotYetActiveException() {
|
|
||||||
super("ResourceManager is not yet Active!");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -24,10 +24,10 @@ import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||||
import org.apache.hadoop.classification.InterfaceStability.Evolving;
|
import org.apache.hadoop.classification.InterfaceStability.Evolving;
|
||||||
import org.apache.hadoop.classification.InterfaceStability.Stable;
|
import org.apache.hadoop.classification.InterfaceStability.Stable;
|
||||||
|
import org.apache.hadoop.ipc.StandbyException;
|
||||||
import org.apache.hadoop.tools.GetUserMappingsProtocol;
|
import org.apache.hadoop.tools.GetUserMappingsProtocol;
|
||||||
import org.apache.hadoop.yarn.api.records.NodeId;
|
import org.apache.hadoop.yarn.api.records.NodeId;
|
||||||
import org.apache.hadoop.yarn.api.records.ResourceOption;
|
import org.apache.hadoop.yarn.api.records.ResourceOption;
|
||||||
import org.apache.hadoop.yarn.exceptions.RMNotYetActiveException;
|
|
||||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||||
import org.apache.hadoop.yarn.server.api.protocolrecords.RefreshAdminAclsRequest;
|
import org.apache.hadoop.yarn.server.api.protocolrecords.RefreshAdminAclsRequest;
|
||||||
import org.apache.hadoop.yarn.server.api.protocolrecords.RefreshAdminAclsResponse;
|
import org.apache.hadoop.yarn.server.api.protocolrecords.RefreshAdminAclsResponse;
|
||||||
|
@ -51,25 +51,25 @@ public interface ResourceManagerAdministrationProtocol extends GetUserMappingsPr
|
||||||
@Public
|
@Public
|
||||||
@Stable
|
@Stable
|
||||||
public RefreshQueuesResponse refreshQueues(RefreshQueuesRequest request)
|
public RefreshQueuesResponse refreshQueues(RefreshQueuesRequest request)
|
||||||
throws RMNotYetActiveException, YarnException, IOException;
|
throws StandbyException, YarnException, IOException;
|
||||||
|
|
||||||
@Public
|
@Public
|
||||||
@Stable
|
@Stable
|
||||||
public RefreshNodesResponse refreshNodes(RefreshNodesRequest request)
|
public RefreshNodesResponse refreshNodes(RefreshNodesRequest request)
|
||||||
throws RMNotYetActiveException, YarnException, IOException;
|
throws StandbyException, YarnException, IOException;
|
||||||
|
|
||||||
@Public
|
@Public
|
||||||
@Stable
|
@Stable
|
||||||
public RefreshSuperUserGroupsConfigurationResponse
|
public RefreshSuperUserGroupsConfigurationResponse
|
||||||
refreshSuperUserGroupsConfiguration(
|
refreshSuperUserGroupsConfiguration(
|
||||||
RefreshSuperUserGroupsConfigurationRequest request)
|
RefreshSuperUserGroupsConfigurationRequest request)
|
||||||
throws RMNotYetActiveException, YarnException, IOException;
|
throws StandbyException, YarnException, IOException;
|
||||||
|
|
||||||
@Public
|
@Public
|
||||||
@Stable
|
@Stable
|
||||||
public RefreshUserToGroupsMappingsResponse refreshUserToGroupsMappings(
|
public RefreshUserToGroupsMappingsResponse refreshUserToGroupsMappings(
|
||||||
RefreshUserToGroupsMappingsRequest request)
|
RefreshUserToGroupsMappingsRequest request)
|
||||||
throws RMNotYetActiveException, YarnException, IOException;
|
throws StandbyException, YarnException, IOException;
|
||||||
|
|
||||||
@Public
|
@Public
|
||||||
@Stable
|
@Stable
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.apache.hadoop.ha.protocolPB.HAServiceProtocolServerSideTranslatorPB;
|
||||||
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
||||||
import org.apache.hadoop.ipc.RPC;
|
import org.apache.hadoop.ipc.RPC;
|
||||||
import org.apache.hadoop.ipc.RPC.Server;
|
import org.apache.hadoop.ipc.RPC.Server;
|
||||||
|
import org.apache.hadoop.ipc.StandbyException;
|
||||||
import org.apache.hadoop.security.Groups;
|
import org.apache.hadoop.security.Groups;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.security.authorize.AccessControlList;
|
import org.apache.hadoop.security.authorize.AccessControlList;
|
||||||
|
@ -49,7 +50,6 @@ import org.apache.hadoop.service.AbstractService;
|
||||||
import org.apache.hadoop.yarn.api.records.NodeId;
|
import org.apache.hadoop.yarn.api.records.NodeId;
|
||||||
import org.apache.hadoop.yarn.api.records.ResourceOption;
|
import org.apache.hadoop.yarn.api.records.ResourceOption;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.exceptions.RMNotYetActiveException;
|
|
||||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||||
import org.apache.hadoop.yarn.factories.RecordFactory;
|
import org.apache.hadoop.yarn.factories.RecordFactory;
|
||||||
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
|
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
|
||||||
|
@ -82,6 +82,7 @@ public class AdminService extends AbstractService implements
|
||||||
|
|
||||||
private final RMContext rmContext;
|
private final RMContext rmContext;
|
||||||
private final ResourceManager rm;
|
private final ResourceManager rm;
|
||||||
|
private String rmId;
|
||||||
|
|
||||||
private Server server;
|
private Server server;
|
||||||
private InetSocketAddress masterServiceAddress;
|
private InetSocketAddress masterServiceAddress;
|
||||||
|
@ -105,6 +106,7 @@ public class AdminService extends AbstractService implements
|
||||||
adminAcl = new AccessControlList(conf.get(
|
adminAcl = new AccessControlList(conf.get(
|
||||||
YarnConfiguration.YARN_ADMIN_ACL,
|
YarnConfiguration.YARN_ADMIN_ACL,
|
||||||
YarnConfiguration.DEFAULT_YARN_ADMIN_ACL));
|
YarnConfiguration.DEFAULT_YARN_ADMIN_ACL));
|
||||||
|
rmId = conf.get(YarnConfiguration.RM_HA_ID);
|
||||||
super.serviceInit(conf);
|
super.serviceInit(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,6 +178,10 @@ public class AdminService extends AbstractService implements
|
||||||
return HAServiceState.ACTIVE == rmContext.getHAServiceState();
|
return HAServiceState.ACTIVE == rmContext.getHAServiceState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void throwStandbyException() throws StandbyException {
|
||||||
|
throw new StandbyException("ResourceManager " + rmId + " is not Active!");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void monitorHealth()
|
public synchronized void monitorHealth()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
@ -239,14 +245,14 @@ public class AdminService extends AbstractService implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RefreshQueuesResponse refreshQueues(RefreshQueuesRequest request)
|
public RefreshQueuesResponse refreshQueues(RefreshQueuesRequest request)
|
||||||
throws YarnException {
|
throws YarnException, StandbyException {
|
||||||
UserGroupInformation user = checkAcls("refreshQueues");
|
UserGroupInformation user = checkAcls("refreshQueues");
|
||||||
|
|
||||||
if (!isRMActive()) {
|
if (!isRMActive()) {
|
||||||
RMAuditLogger.logFailure(user.getShortUserName(), "refreshQueues",
|
RMAuditLogger.logFailure(user.getShortUserName(), "refreshQueues",
|
||||||
adminAcl.toString(), "AdminService",
|
adminAcl.toString(), "AdminService",
|
||||||
"ResourceManager is not active. Can not refresh queues.");
|
"ResourceManager is not active. Can not refresh queues.");
|
||||||
throw new RMNotYetActiveException();
|
throwStandbyException();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -265,14 +271,14 @@ public class AdminService extends AbstractService implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RefreshNodesResponse refreshNodes(RefreshNodesRequest request)
|
public RefreshNodesResponse refreshNodes(RefreshNodesRequest request)
|
||||||
throws YarnException {
|
throws YarnException, StandbyException {
|
||||||
UserGroupInformation user = checkAcls("refreshNodes");
|
UserGroupInformation user = checkAcls("refreshNodes");
|
||||||
|
|
||||||
if (!isRMActive()) {
|
if (!isRMActive()) {
|
||||||
RMAuditLogger.logFailure(user.getShortUserName(), "refreshNodes",
|
RMAuditLogger.logFailure(user.getShortUserName(), "refreshNodes",
|
||||||
adminAcl.toString(), "AdminService",
|
adminAcl.toString(), "AdminService",
|
||||||
"ResourceManager is not active. Can not refresh nodes.");
|
"ResourceManager is not active. Can not refresh nodes.");
|
||||||
throw new RMNotYetActiveException();
|
throwStandbyException();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -291,7 +297,7 @@ public class AdminService extends AbstractService implements
|
||||||
@Override
|
@Override
|
||||||
public RefreshSuperUserGroupsConfigurationResponse refreshSuperUserGroupsConfiguration(
|
public RefreshSuperUserGroupsConfigurationResponse refreshSuperUserGroupsConfiguration(
|
||||||
RefreshSuperUserGroupsConfigurationRequest request)
|
RefreshSuperUserGroupsConfigurationRequest request)
|
||||||
throws YarnException {
|
throws YarnException, StandbyException {
|
||||||
UserGroupInformation user = checkAcls("refreshSuperUserGroupsConfiguration");
|
UserGroupInformation user = checkAcls("refreshSuperUserGroupsConfiguration");
|
||||||
|
|
||||||
// TODO (YARN-1459): Revisit handling super-user-groups on Standby RM
|
// TODO (YARN-1459): Revisit handling super-user-groups on Standby RM
|
||||||
|
@ -300,7 +306,7 @@ public class AdminService extends AbstractService implements
|
||||||
"refreshSuperUserGroupsConfiguration",
|
"refreshSuperUserGroupsConfiguration",
|
||||||
adminAcl.toString(), "AdminService",
|
adminAcl.toString(), "AdminService",
|
||||||
"ResourceManager is not active. Can not refresh super-user-groups.");
|
"ResourceManager is not active. Can not refresh super-user-groups.");
|
||||||
throw new RMNotYetActiveException();
|
throwStandbyException();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProxyUsers.refreshSuperUserGroupsConfiguration(new Configuration());
|
ProxyUsers.refreshSuperUserGroupsConfiguration(new Configuration());
|
||||||
|
@ -313,7 +319,8 @@ public class AdminService extends AbstractService implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RefreshUserToGroupsMappingsResponse refreshUserToGroupsMappings(
|
public RefreshUserToGroupsMappingsResponse refreshUserToGroupsMappings(
|
||||||
RefreshUserToGroupsMappingsRequest request) throws YarnException {
|
RefreshUserToGroupsMappingsRequest request)
|
||||||
|
throws YarnException, StandbyException {
|
||||||
UserGroupInformation user = checkAcls("refreshUserToGroupsMappings");
|
UserGroupInformation user = checkAcls("refreshUserToGroupsMappings");
|
||||||
|
|
||||||
// TODO (YARN-1459): Revisit handling user-groups on Standby RM
|
// TODO (YARN-1459): Revisit handling user-groups on Standby RM
|
||||||
|
@ -322,7 +329,7 @@ public class AdminService extends AbstractService implements
|
||||||
"refreshUserToGroupsMapping",
|
"refreshUserToGroupsMapping",
|
||||||
adminAcl.toString(), "AdminService",
|
adminAcl.toString(), "AdminService",
|
||||||
"ResourceManager is not active. Can not refresh user-groups.");
|
"ResourceManager is not active. Can not refresh user-groups.");
|
||||||
throw new RMNotYetActiveException();
|
throwStandbyException();
|
||||||
}
|
}
|
||||||
|
|
||||||
Groups.getUserToGroupsMappingService().refresh();
|
Groups.getUserToGroupsMappingService().refresh();
|
||||||
|
|
Loading…
Reference in New Issue