diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/FederationStateStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/FederationStateStore.java index 3ca8ccc2bfb..e65bdf42e2e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/FederationStateStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/FederationStateStore.java @@ -60,7 +60,21 @@ public interface FederationStateStore extends * Load the version information from the federation state store. * * @return the {@link Version} of the federation state store + * @throws Exception an exception occurred in load version. */ - Version loadVersion(); + Version loadVersion() throws Exception; + /** + * Store the Version information in federation state store. + * + * @throws Exception an exception occurred in store version. + */ + void storeVersion() throws Exception; + + /** + * Check the version of federation stateStore. + * + * @throws Exception an exception occurred in check version. + */ + void checkVersion() throws Exception; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/MemoryFederationStateStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/MemoryFederationStateStore.java index 03fb19a173d..273e736e887 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/MemoryFederationStateStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/MemoryFederationStateStore.java @@ -31,6 +31,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import java.util.Comparator; +import org.apache.commons.lang3.NotImplementedException; import org.apache.hadoop.classification.VisibleForTesting; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.token.delegation.DelegationKey; @@ -366,12 +367,22 @@ public class MemoryFederationStateStore implements FederationStateStore { @Override public Version getCurrentVersion() { - return null; + throw new NotImplementedException("Code is not implemented"); } @Override - public Version loadVersion() { - return null; + public Version loadVersion() throws Exception { + throw new NotImplementedException("Code is not implemented"); + } + + @Override + public void storeVersion() throws Exception { + throw new NotImplementedException("Code is not implemented"); + } + + @Override + public void checkVersion() throws Exception { + throw new NotImplementedException("Code is not implemented"); } @Override diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java index f16fe673ce3..e1fc3f2a47e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java @@ -997,7 +997,17 @@ public class SQLFederationStateStore implements FederationStateStore { } @Override - public Version loadVersion() { + public Version loadVersion() throws Exception { + throw new NotImplementedException("Code is not implemented"); + } + + @Override + public void storeVersion() throws Exception { + throw new NotImplementedException("Code is not implemented"); + } + + @Override + public void checkVersion() throws Exception { throw new NotImplementedException("Code is not implemented"); } diff --git a/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 b/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 index 95903b81d18..536faa31dca 100644 --- a/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 +++ b/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 @@ -30,6 +30,7 @@ import java.util.TimeZone; import java.util.Comparator; import java.util.stream.Collectors; +import org.apache.commons.lang3.NotImplementedException; import org.apache.curator.framework.recipes.shared.SharedCount; import org.apache.curator.framework.recipes.shared.VersionedValue; import org.apache.hadoop.classification.VisibleForTesting; @@ -642,12 +643,22 @@ public class ZookeeperFederationStateStore implements FederationStateStore { @Override public Version getCurrentVersion() { - return null; + throw new NotImplementedException("Code is not implemented"); } @Override - public Version loadVersion() { - return null; + public Version loadVersion() throws Exception { + throw new NotImplementedException("Code is not implemented"); + } + + @Override + public void storeVersion() throws Exception { + throw new NotImplementedException("Code is not implemented"); + } + + @Override + public void checkVersion() throws Exception { + throw new NotImplementedException("Code is not implemented"); } /** diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/impl/FederationStateStoreBaseTest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/impl/FederationStateStoreBaseTest.java index 1952d47cb54..b93763583d7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/impl/FederationStateStoreBaseTest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/impl/FederationStateStoreBaseTest.java @@ -26,6 +26,7 @@ import java.util.Set; import java.util.HashSet; import java.util.TimeZone; +import org.apache.commons.lang3.NotImplementedException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.Text; import org.apache.hadoop.security.token.delegation.DelegationKey; @@ -1043,4 +1044,24 @@ public abstract class FederationStateStoreBaseTest { checkRouterStoreToken(identifier, getStoreTokenResp); } + + @Test(expected = NotImplementedException.class) + public void testGetCurrentVersion() { + stateStore.getCurrentVersion(); + } + + @Test(expected = NotImplementedException.class) + public void testStoreVersion() throws Exception { + stateStore.storeVersion(); + } + + @Test(expected = NotImplementedException.class) + public void testLoadVersion() throws Exception { + stateStore.loadVersion(); + } + + @Test(expected = NotImplementedException.class) + public void testCheckVersion() throws Exception { + stateStore.checkVersion(); + } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/federation/FederationStateStoreService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/federation/FederationStateStoreService.java index 92376872919..90dcadb721e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/federation/FederationStateStoreService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/federation/FederationStateStoreService.java @@ -266,10 +266,20 @@ public class FederationStateStoreService extends AbstractService } @Override - public Version loadVersion() { + public Version loadVersion() throws Exception { return stateStoreClient.getCurrentVersion(); } + @Override + public void storeVersion() throws Exception { + stateStoreClient.storeVersion(); + } + + @Override + public void checkVersion() throws Exception { + stateStoreClient.checkVersion(); + } + @Override public GetSubClusterPolicyConfigurationResponse getPolicyConfiguration( GetSubClusterPolicyConfigurationRequest request) throws YarnException {