Author: kasha
Date: Fri Dec 27 03:28:23 2013
New Revision: 1553616
URL: http://svn.apache.org/r1553616
Log:
YARN-1523. Use StandbyException instead of RMNotYetReadyException (kasha)
Removed:
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/RMNotYetActiveException.java
Modified:
hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/ResourceManagerAdministrationProtocol.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java
Modified: hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt?rev=1553616&r1=1553615&r2=1553616&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt Fri Dec 27 03:28:23 2013
@@ -189,6 +189,8 @@ Release 2.4.0 - UNRELEASED
YARN-1172. Convert SecretManagers in RM to services (Tsuyoshi OZAWA via
kasha)
+ YARN-1523. Use StandbyException instead of RMNotYetReadyException (kasha)
+
OPTIMIZATIONS
BUG FIXES
Modified:
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/ResourceManagerAdministrationProtocol.java
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/ResourceManagerAdministrationProtocol.java?rev=1553616&r1=1553615&r2=1553616&view=diff
==============================================================================
---
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/ResourceManagerAdministrationProtocol.java
(original)
+++
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/ResourceManagerAdministrationProtocol.java
Fri Dec 27 03:28:23 2013
@@ -24,10 +24,10 @@ import org.apache.hadoop.classification.
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.ipc.StandbyException;
import org.apache.hadoop.tools.GetUserMappingsProtocol;
import org.apache.hadoop.yarn.api.records.NodeId;
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.server.api.protocolrecords.RefreshAdminAclsRequest;
import
org.apache.hadoop.yarn.server.api.protocolrecords.RefreshAdminAclsResponse;
@@ -51,25 +51,25 @@ public interface ResourceManagerAdminist
@Public
@Stable
public RefreshQueuesResponse refreshQueues(RefreshQueuesRequest request)
- throws RMNotYetActiveException, YarnException, IOException;
+ throws StandbyException, YarnException, IOException;
@Public
@Stable
public RefreshNodesResponse refreshNodes(RefreshNodesRequest request)
- throws RMNotYetActiveException, YarnException, IOException;
+ throws StandbyException, YarnException, IOException;
@Public
@Stable
public RefreshSuperUserGroupsConfigurationResponse
refreshSuperUserGroupsConfiguration(
RefreshSuperUserGroupsConfigurationRequest request)
- throws RMNotYetActiveException, YarnException, IOException;
+ throws StandbyException, YarnException, IOException;
@Public
@Stable
public RefreshUserToGroupsMappingsResponse refreshUserToGroupsMappings(
RefreshUserToGroupsMappingsRequest request)
- throws RMNotYetActiveException, YarnException, IOException;
+ throws StandbyException, YarnException, IOException;
@Public
@Stable
Modified:
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java?rev=1553616&r1=1553615&r2=1553616&view=diff
==============================================================================
---
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java
(original)
+++
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java
Fri Dec 27 03:28:23 2013
@@ -40,6 +40,7 @@ import org.apache.hadoop.ha.protocolPB.H
import org.apache.hadoop.ipc.ProtobufRpcEngine;
import org.apache.hadoop.ipc.RPC;
import org.apache.hadoop.ipc.RPC.Server;
+import org.apache.hadoop.ipc.StandbyException;
import org.apache.hadoop.security.Groups;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.authorize.AccessControlList;
@@ -49,7 +50,6 @@ import org.apache.hadoop.service.Abstrac
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.ResourceOption;
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.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
@@ -82,6 +82,7 @@ public class AdminService extends Abstra
private final RMContext rmContext;
private final ResourceManager rm;
+ private String rmId;
private Server server;
private InetSocketAddress masterServiceAddress;
@@ -105,6 +106,7 @@ public class AdminService extends Abstra
adminAcl = new AccessControlList(conf.get(
YarnConfiguration.YARN_ADMIN_ACL,
YarnConfiguration.DEFAULT_YARN_ADMIN_ACL));
+ rmId = conf.get(YarnConfiguration.RM_HA_ID);
super.serviceInit(conf);
}
@@ -176,6 +178,10 @@ public class AdminService extends Abstra
return HAServiceState.ACTIVE == rmContext.getHAServiceState();
}
+ private void throwStandbyException() throws StandbyException {
+ throw new StandbyException("ResourceManager " + rmId + " is not Active!");
+ }
+
@Override
public synchronized void monitorHealth()
throws IOException {
@@ -239,14 +245,14 @@ public class AdminService extends Abstra
@Override
public RefreshQueuesResponse refreshQueues(RefreshQueuesRequest request)
- throws YarnException {
+ throws YarnException, StandbyException {
UserGroupInformation user = checkAcls("refreshQueues");
if (!isRMActive()) {
RMAuditLogger.logFailure(user.getShortUserName(), "refreshQueues",
adminAcl.toString(), "AdminService",
"ResourceManager is not active. Can not refresh queues.");
- throw new RMNotYetActiveException();
+ throwStandbyException();
}
try {
@@ -265,14 +271,14 @@ public class AdminService extends Abstra
@Override
public RefreshNodesResponse refreshNodes(RefreshNodesRequest request)
- throws YarnException {
+ throws YarnException, StandbyException {
UserGroupInformation user = checkAcls("refreshNodes");
if (!isRMActive()) {
RMAuditLogger.logFailure(user.getShortUserName(), "refreshNodes",
adminAcl.toString(), "AdminService",
"ResourceManager is not active. Can not refresh nodes.");
- throw new RMNotYetActiveException();
+ throwStandbyException();
}
try {
@@ -291,7 +297,7 @@ public class AdminService extends Abstra
@Override
public RefreshSuperUserGroupsConfigurationResponse
refreshSuperUserGroupsConfiguration(
RefreshSuperUserGroupsConfigurationRequest request)
- throws YarnException {
+ throws YarnException, StandbyException {
UserGroupInformation user =
checkAcls("refreshSuperUserGroupsConfiguration");
// TODO (YARN-1459): Revisit handling super-user-groups on Standby RM
@@ -300,7 +306,7 @@ public class AdminService extends Abstra
"refreshSuperUserGroupsConfiguration",
adminAcl.toString(), "AdminService",
"ResourceManager is not active. Can not refresh super-user-groups.");
- throw new RMNotYetActiveException();
+ throwStandbyException();
}
ProxyUsers.refreshSuperUserGroupsConfiguration(new Configuration());
@@ -313,7 +319,8 @@ public class AdminService extends Abstra
@Override
public RefreshUserToGroupsMappingsResponse refreshUserToGroupsMappings(
- RefreshUserToGroupsMappingsRequest request) throws YarnException {
+ RefreshUserToGroupsMappingsRequest request)
+ throws YarnException, StandbyException {
UserGroupInformation user = checkAcls("refreshUserToGroupsMappings");
// TODO (YARN-1459): Revisit handling user-groups on Standby RM
@@ -322,7 +329,7 @@ public class AdminService extends Abstra
"refreshUserToGroupsMapping",
adminAcl.toString(), "AdminService",
"ResourceManager is not active. Can not refresh user-groups.");
- throw new RMNotYetActiveException();
+ throwStandbyException();
}
Groups.getUserToGroupsMappingService().refresh();