From 07141426e08e1586833018a8f367d27cd5bcb8e2 Mon Sep 17 00:00:00 2001 From: Szilard Nemeth <954799+szilard-nemeth@users.noreply.github.com> Date: Sat, 18 Dec 2021 04:52:03 +0100 Subject: [PATCH] YARN-11050 (#3805) --- .../hadoop/yarn/server/resourcemanager/webapp/RMWSConsts.java | 2 +- .../server/resourcemanager/webapp/RMWebServiceProtocol.java | 2 +- .../yarn/server/resourcemanager/webapp/RMWebServices.java | 2 +- .../server/router/webapp/DefaultRequestInterceptorREST.java | 2 +- .../yarn/server/router/webapp/FederationInterceptorREST.java | 2 +- .../hadoop/yarn/server/router/webapp/RouterWebServices.java | 4 ++-- .../yarn/server/router/webapp/BaseRouterWebServicesTest.java | 4 ++-- .../yarn/server/router/webapp/MockRESTRequestInterceptor.java | 2 +- .../router/webapp/PassThroughRESTRequestInterceptor.java | 4 ++-- .../yarn/server/router/webapp/TestRouterWebServices.java | 2 +- .../yarn/server/router/webapp/TestRouterWebServicesREST.java | 4 ++-- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWSConsts.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWSConsts.java index 82ceed37c2..791e34ad3d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWSConsts.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWSConsts.java @@ -126,7 +126,7 @@ public final class RMWSConsts { /** Path for {@code RMWebServiceProtocol#addToClusterNodeLabels}. */ public static final String ADD_NODE_LABELS = "/add-node-labels"; - /** Path for {@code RMWebServiceProtocol#removeFromCluserNodeLabels}. */ + /** Path for {@code RMWebServiceProtocol#removeFromClusterNodeLabels}. */ public static final String REMOVE_NODE_LABELS = "/remove-node-labels"; /** Path for {@code RMWebServiceProtocol#getLabelsOnNode}. */ diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServiceProtocol.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServiceProtocol.java index f2736e3773..41fc4ea870 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServiceProtocol.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServiceProtocol.java @@ -398,7 +398,7 @@ Response addToClusterNodeLabels(NodeLabelsInfo newNodeLabels, * @return Response containing the status code * @throws Exception in case of bad request */ - Response removeFromCluserNodeLabels(Set oldNodeLabels, + Response removeFromClusterNodeLabels(Set oldNodeLabels, HttpServletRequest hsr) throws Exception; /** diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java index 041b37c616..1dac043ae1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java @@ -1435,7 +1435,7 @@ public Response addToClusterNodeLabels(final NodeLabelsInfo newNodeLabels, @Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8, MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 }) @Override - public Response removeFromCluserNodeLabels( + public Response removeFromClusterNodeLabels( @QueryParam(RMWSConsts.LABELS) Set oldNodeLabels, @Context HttpServletRequest hsr) throws Exception { UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/DefaultRequestInterceptorREST.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/DefaultRequestInterceptorREST.java index 2675b38244..21fd2be854 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/DefaultRequestInterceptorREST.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/DefaultRequestInterceptorREST.java @@ -330,7 +330,7 @@ public Response addToClusterNodeLabels(NodeLabelsInfo newNodeLabels, } @Override - public Response removeFromCluserNodeLabels(Set oldNodeLabels, + public Response removeFromClusterNodeLabels(Set oldNodeLabels, HttpServletRequest hsr) throws Exception { // oldNodeLabels is specified inside hsr return RouterWebServiceUtil.genericForward(webAppAddress, hsr, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java index 14e062ad4e..db2a8edcb2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java @@ -1205,7 +1205,7 @@ public Response addToClusterNodeLabels(NodeLabelsInfo newNodeLabels, } @Override - public Response removeFromCluserNodeLabels(Set oldNodeLabels, + public Response removeFromClusterNodeLabels(Set oldNodeLabels, HttpServletRequest hsr) throws Exception { throw new NotImplementedException("Code is not implemented"); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/RouterWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/RouterWebServices.java index bb48476d65..c221b86e98 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/RouterWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/RouterWebServices.java @@ -637,13 +637,13 @@ public Response addToClusterNodeLabels(NodeLabelsInfo newNodeLabels, @Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8, MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 }) @Override - public Response removeFromCluserNodeLabels( + public Response removeFromClusterNodeLabels( @QueryParam(RMWSConsts.LABELS) Set oldNodeLabels, @Context HttpServletRequest hsr) throws Exception { init(); RequestInterceptorChainWrapper pipeline = getInterceptorChain(hsr); return pipeline.getRootInterceptor() - .removeFromCluserNodeLabels(oldNodeLabels, hsr); + .removeFromClusterNodeLabels(oldNodeLabels, hsr); } @GET diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/BaseRouterWebServicesTest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/BaseRouterWebServicesTest.java index 05a088df78..e24ad47bf7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/BaseRouterWebServicesTest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/BaseRouterWebServicesTest.java @@ -245,8 +245,8 @@ protected Response addToClusterNodeLabels(String user) throws Exception { null, createHttpServletRequest(user)); } - protected Response removeFromCluserNodeLabels(String user) throws Exception { - return routerWebService.removeFromCluserNodeLabels( + protected Response removeFromClusterNodeLabels(String user) throws Exception { + return routerWebService.removeFromClusterNodeLabels( null, createHttpServletRequest(user)); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/MockRESTRequestInterceptor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/MockRESTRequestInterceptor.java index 67c9d671fb..68b8db6f33 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/MockRESTRequestInterceptor.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/MockRESTRequestInterceptor.java @@ -215,7 +215,7 @@ public Response addToClusterNodeLabels(NodeLabelsInfo newNodeLabels, } @Override - public Response removeFromCluserNodeLabels(Set oldNodeLabels, + public Response removeFromClusterNodeLabels(Set oldNodeLabels, HttpServletRequest hsr) throws Exception { return Response.status(Status.OK).build(); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/PassThroughRESTRequestInterceptor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/PassThroughRESTRequestInterceptor.java index 142a6511b9..31f8b8b990 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/PassThroughRESTRequestInterceptor.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/PassThroughRESTRequestInterceptor.java @@ -248,9 +248,9 @@ public Response addToClusterNodeLabels(NodeLabelsInfo newNodeLabels, } @Override - public Response removeFromCluserNodeLabels(Set oldNodeLabels, + public Response removeFromClusterNodeLabels(Set oldNodeLabels, HttpServletRequest hsr) throws Exception { - return getNextInterceptor().removeFromCluserNodeLabels(oldNodeLabels, hsr); + return getNextInterceptor().removeFromClusterNodeLabels(oldNodeLabels, hsr); } @Override diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestRouterWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestRouterWebServices.java index 14652435da..7491cbc2a9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestRouterWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestRouterWebServices.java @@ -132,7 +132,7 @@ public void testRouterWebServicesE2E() throws Exception { Response response4 = addToClusterNodeLabels(user); Assert.assertNotNull(response4); - Response response5 = removeFromCluserNodeLabels(user); + Response response5 = removeFromClusterNodeLabels(user); Assert.assertNotNull(response5); NodeLabelsInfo nodeLabelsInfo2 = getLabelsOnNode(user); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestRouterWebServicesREST.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestRouterWebServicesREST.java index d3c619860a..868a953e9a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestRouterWebServicesREST.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestRouterWebServicesREST.java @@ -1203,10 +1203,10 @@ public void testAddToClusterNodeLabelsXML() throws Exception { /** * This test validates the correctness of - * {@link RMWebServiceProtocol#removeFromCluserNodeLabels()} inside Router. + * {@link RMWebServiceProtocol#removeFromClusterNodeLabels} inside Router. */ @Test(timeout = 2000) - public void testRemoveFromCluserNodeLabelsXML() + public void testRemoveFromClusterNodeLabelsXML() throws Exception { // Test with a wrong HTTP method