From 6ff0d7defbb874e4264bab6974cbb23ccb805197 Mon Sep 17 00:00:00 2001 From: krgoyal krgoyal Date: Mon, 6 Mar 2023 17:09:40 +0530 Subject: [PATCH] Fix pending checkstyles & test cases --- .../store/impl/TestMemoryFederationStateStore.java | 3 +-- .../security/RouterDelegationTokenSecretManager.java | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) 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/TestMemoryFederationStateStore.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/TestMemoryFederationStateStore.java index 474f45f8b5c..3aa07b7a3e5 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/TestMemoryFederationStateStore.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/TestMemoryFederationStateStore.java @@ -31,7 +31,6 @@ import org.apache.hadoop.yarn.server.federation.store.records.RouterStoreToken; import java.io.IOException; import java.nio.ByteBuffer; import java.util.Map; -import java.util.Set; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -82,7 +81,7 @@ public class TestMemoryFederationStateStore extends FederationStateStoreBaseTest secretManagerState.getTokenState(); assertNotNull(tokenStateMap); - assertTrue(tokenStateMap.containsKey(identifier)); + assertTrue(tokenStateMap.containsKey(identifier.getSequenceNumber())); YARNDelegationTokenIdentifier tokenIdentifier = token.getTokenIdentifier(); assertTrue(tokenIdentifier instanceof RMDelegationTokenIdentifier); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/security/RouterDelegationTokenSecretManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/security/RouterDelegationTokenSecretManager.java index 6d602db3e31..867990472ec 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/security/RouterDelegationTokenSecretManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/security/RouterDelegationTokenSecretManager.java @@ -36,24 +36,24 @@ import java.nio.ByteBuffer; import java.util.Base64; /** - * A Router specific delegation token secret manager & is designed to be stateless. + * A Router specific delegation token secret manager and is designed to be stateless. * The secret manager is responsible for generating and accepting the password * for each token. * * Behavioural Differences from AbstractDelegationTokenSecretManager - * 1) Master Key - Each instance of Router will have its own master key & each instance rolls its own master key. + * 1) Master Key - Each instance of Router will have its own master key and each instance rolls its own master key. * Thus there is no concept of a global current key. * The requirement to generate new master keys / delegation tokens is to generate unique INTEGER keys, * which the state store is responsible for (Autoincrement is one of the ways to achieve this). - * This key will be regenerated on service restart & thus there is no requirement of an explicit restore mechanism. - * Current master key will be stored in memory on each instance & will be used to generate new tokens. + * This key will be regenerated on service restart and thus there is no requirement of an explicit restore mechanism. + * Current master key will be stored in memory on each instance and will be used to generate new tokens. * Master key will be looked up from the state store for Validation / renewal, etc of tokens. * * 2) Token Expiry - It doesn't take care of token removal on expiry. * Each state store can implement its own way to manage token deletion on expiry. * * This pretty much replaces all methods of AbstractDelegationTokenSecretManager which is designed for stateful managers - * TODO - Refactor Secret Manager interfaces to support stateful & stateless secret management + * TODO - Refactor Secret Manager interfaces to support stateful and stateless secret management */ public class RouterDelegationTokenSecretManager extends AbstractDelegationTokenSecretManager {