goiri commented on code in PR #4738: URL: https://github.com/apache/hadoop/pull/4738#discussion_r948194089
########## hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java: ########## @@ -184,16 +193,17 @@ public AddApplicationHomeSubClusterResponse addApplicationHomeSubCluster( FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg); } - return AddApplicationHomeSubClusterResponse - .newInstance(homeSubCluster); + opDurations.addAppHomeSubClusterDuration(clock.getTime() - start); Review Comment: No need to do this but one thing I was thinking about is the fact that we keep doing the substraction in the call. Would it look better to pass the start and the end time and do the substraction inside? ########## hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java: ########## @@ -161,8 +169,9 @@ public void close() throws Exception { @Override public AddApplicationHomeSubClusterResponse addApplicationHomeSubCluster( - AddApplicationHomeSubClusterRequest request) throws YarnException { + AddApplicationHomeSubClusterRequest request) throws YarnException { Review Comment: The old indentation was correct. ########## hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java: ########## @@ -336,14 +354,14 @@ public SubClusterHeartbeatResponse subClusterHeartbeat( subClusterInfo.setCapability(request.getCapability()); putSubclusterInfo(subClusterId, subClusterInfo, true); - + opDurations.addSubClusterHeartbeatDuration(clock.getTime() - start); return SubClusterHeartbeatResponse.newInstance(); } @Override public GetSubClusterInfoResponse getSubCluster( - GetSubClusterInfoRequest request) throws YarnException { - + GetSubClusterInfoRequest request) throws YarnException { Review Comment: Indentation all over. ########## hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java: ########## @@ -203,53 +213,58 @@ public AddApplicationHomeSubClusterResponse addApplicationHomeSubCluster( FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg); } SubClusterId newSubClusterId = - request.getApplicationHomeSubCluster().getHomeSubCluster(); + request.getApplicationHomeSubCluster().getHomeSubCluster(); putApp(appId, newSubClusterId, true); + + opDurations.addUpdateAppHomeSubClusterDuration(clock.getTime() - start); return UpdateApplicationHomeSubClusterResponse.newInstance(); } @Override public GetApplicationHomeSubClusterResponse getApplicationHomeSubCluster( - GetApplicationHomeSubClusterRequest request) throws YarnException { + GetApplicationHomeSubClusterRequest request) throws YarnException { + long start = clock.getTime(); FederationApplicationHomeSubClusterStoreInputValidator.validate(request); ApplicationId appId = request.getApplicationId(); SubClusterId homeSubCluster = getApp(appId); if (homeSubCluster == null) { String errMsg = "Application " + appId + " does not exist"; FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg); } + opDurations.addGetAppHomeSubClusterDuration(clock.getTime() - start); return GetApplicationHomeSubClusterResponse.newInstance( - ApplicationHomeSubCluster.newInstance(appId, homeSubCluster)); + ApplicationHomeSubCluster.newInstance(appId, homeSubCluster)); } @Override public GetApplicationsHomeSubClusterResponse getApplicationsHomeSubCluster( - GetApplicationsHomeSubClusterRequest request) throws YarnException { + GetApplicationsHomeSubClusterRequest request) throws YarnException { Review Comment: Indetation ########## hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java: ########## @@ -203,53 +213,58 @@ public AddApplicationHomeSubClusterResponse addApplicationHomeSubCluster( FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg); } SubClusterId newSubClusterId = - request.getApplicationHomeSubCluster().getHomeSubCluster(); + request.getApplicationHomeSubCluster().getHomeSubCluster(); putApp(appId, newSubClusterId, true); + + opDurations.addUpdateAppHomeSubClusterDuration(clock.getTime() - start); return UpdateApplicationHomeSubClusterResponse.newInstance(); } @Override public GetApplicationHomeSubClusterResponse getApplicationHomeSubCluster( - GetApplicationHomeSubClusterRequest request) throws YarnException { + GetApplicationHomeSubClusterRequest request) throws YarnException { + long start = clock.getTime(); FederationApplicationHomeSubClusterStoreInputValidator.validate(request); ApplicationId appId = request.getApplicationId(); SubClusterId homeSubCluster = getApp(appId); if (homeSubCluster == null) { String errMsg = "Application " + appId + " does not exist"; FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg); } + opDurations.addGetAppHomeSubClusterDuration(clock.getTime() - start); return GetApplicationHomeSubClusterResponse.newInstance( - ApplicationHomeSubCluster.newInstance(appId, homeSubCluster)); + ApplicationHomeSubCluster.newInstance(appId, homeSubCluster)); Review Comment: Indentation ########## hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java: ########## @@ -203,53 +213,58 @@ public AddApplicationHomeSubClusterResponse addApplicationHomeSubCluster( FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg); } SubClusterId newSubClusterId = - request.getApplicationHomeSubCluster().getHomeSubCluster(); + request.getApplicationHomeSubCluster().getHomeSubCluster(); putApp(appId, newSubClusterId, true); + + opDurations.addUpdateAppHomeSubClusterDuration(clock.getTime() - start); return UpdateApplicationHomeSubClusterResponse.newInstance(); } @Override public GetApplicationHomeSubClusterResponse getApplicationHomeSubCluster( - GetApplicationHomeSubClusterRequest request) throws YarnException { + GetApplicationHomeSubClusterRequest request) throws YarnException { + long start = clock.getTime(); FederationApplicationHomeSubClusterStoreInputValidator.validate(request); ApplicationId appId = request.getApplicationId(); SubClusterId homeSubCluster = getApp(appId); if (homeSubCluster == null) { String errMsg = "Application " + appId + " does not exist"; FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg); } + opDurations.addGetAppHomeSubClusterDuration(clock.getTime() - start); return GetApplicationHomeSubClusterResponse.newInstance( Review Comment: As this is all we do, would it make sense to have a: ``` GetApplicationHomeSubClusterResponse.newInstance(appId, homeSubCluster); ``` ? ########## hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java: ########## @@ -203,53 +213,58 @@ public AddApplicationHomeSubClusterResponse addApplicationHomeSubCluster( FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg); } SubClusterId newSubClusterId = Review Comment: This indentation was correct earlier. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org