goiri commented on code in PR #5537:
URL: https://github.com/apache/hadoop/pull/5537#discussion_r1162087173
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/impl/TestZookeeperFederationStateStore.java:
##########
@@ -276,4 +278,48 @@ protected void
checkRouterStoreToken(RMDelegationTokenIdentifier identifier,
assertNotNull(zkRouterStoreToken);
assertEquals(token, zkRouterStoreToken);
}
+
+ @Test
+ public void testGetCurrentVersion() {
+ ZookeeperFederationStateStore zkFederationStateStore =
+ ZookeeperFederationStateStore.class.cast(this.getStateStore());
+ Version version = zkFederationStateStore.getCurrentVersion();
+ assertEquals(version.getMajorVersion(), 1);
+ assertEquals(version.getMinorVersion(), 1);
+ }
+
+ @Test
+ public void testStoreVersion() throws Exception {
+ ZookeeperFederationStateStore zkFederationStateStore =
+ ZookeeperFederationStateStore.class.cast(this.getStateStore());
+ zkFederationStateStore.storeVersion();
+ Version version = zkFederationStateStore.loadVersion();
+ assertEquals(version.getMajorVersion(), 1);
Review Comment:
Reversed as expected is first?
##########
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:
##########
@@ -643,22 +652,52 @@ public GetSubClusterPoliciesConfigurationsResponse
getPoliciesConfigurations(
@Override
public Version getCurrentVersion() {
- throw new NotImplementedException("Code is not implemented");
+ return CURRENT_VERSION_INFO;
}
@Override
public Version loadVersion() throws Exception {
- throw new NotImplementedException("Code is not implemented");
+ if (exists(versionNode)) {
+ byte[] data = get(versionNode);
+ if (data != null) {
+ return new VersionPBImpl(VersionProto.parseFrom(data));
+ }
+ }
+ return null;
}
@Override
public void storeVersion() throws Exception {
- throw new NotImplementedException("Code is not implemented");
+ byte[] data = ((VersionPBImpl)
CURRENT_VERSION_INFO).getProto().toByteArray();
+ boolean isUpdate = false;
Review Comment:
```
boolean isUpdate = exists(versionNode);
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]