-
Notifications
You must be signed in to change notification settings - Fork 9k
HDFS-17793. [ARR] RBF: Enable the router asynchronous RPC feature to handle DelegationToken request errors #7714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
… getDelegationToken request errors
Hi, @zhangxiping1 . Thanks for reporting this problem. Make sense to me. |
![]() @Override
public Token<DelegationTokenIdentifier> getDelegationToken(Text renewer)
throws IOException {
rpcServer.checkOperation(NameNode.OperationCategory.WRITE, true);
asyncComplete(this.securityManager.getDelegationToken(renewer));
return asyncReturn(Token.class);
}
@Override
public long renewDelegationToken(Token<DelegationTokenIdentifier> token)
throws IOException {
rpcServer.checkOperation(NameNode.OperationCategory.WRITE, true);
asyncComplete(this.securityManager.renewDelegationToken(token));
return asyncReturn(Long.class);
}
@Override
public void cancelDelegationToken(Token<DelegationTokenIdentifier> token)
throws IOException {
rpcServer.checkOperation(NameNode.OperationCategory.WRITE, true);
this.securityManager.cancelDelegationToken(token);
asyncComplete(null);
} |
@KeeProMise ok,I'll revise and submit the following later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Enable the router’s asynchronous RPC support for delegation token operations by removing the old synchronous overrides and adding a basic test.
- Added a test stub for
getDelegationToken
in the async RPC test suite. - Removed the synchronous
getDelegationToken
,renewDelegationToken
, andcancelDelegationToken
overrides in favor of the async router mechanism.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
hadoop-hdfs-project/.../TestRouterAsyncRpc.java | Added testgetDelegationToken stub without assertions |
hadoop-hdfs-project/.../RouterClientNamenodeProtocolServerSideTranslatorPB.java | Removed synchronous delegation-token RPC overrides |
Comments suppressed due to low confidence (2)
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpc.java:95
- [nitpick] The method name
testgetDelegationToken
is inconsistent with camelCase conventions; consider renaming it totestGetDelegationToken
for readability and consistency.
public void testgetDelegationToken() throws Exception {
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/protocolPB/RouterClientNamenodeProtocolServerSideTranslatorPB.java:979
- The synchronous overrides for delegation token operations were removed without replacement; callers of these RPCs will now receive
null
. Implement the asyncRouterServer logic forgetDelegationToken
,renewDelegationToken
, andcancelDelegationToken
to ensure proper handling.
@Override
|
||
@Test | ||
public void testgetDelegationToken() throws Exception { | ||
rndRouter.getFileSystem().getDelegationToken("yarn"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test does not include any assertions to verify the returned token or expected error; add assertions (e.g., assertNotNull or expected exception) to validate behavior.
rndRouter.getFileSystem().getDelegationToken("yarn"); | |
// Get the delegation token for the user "yarn". | |
org.apache.hadoop.security.token.Token<?> token = | |
rndRouter.getFileSystem().getDelegationToken("yarn"); | |
// Assert that the token is not null. | |
assertNotNull(token, "Delegation token should not be null"); | |
// Optionally, verify additional properties of the token. | |
assertEquals("yarn", token.getService().toString(), | |
"The token service should match the requested user"); |
Copilot uses AI. Check for mistakes.
🎊 +1 overall
This message was automatically generated. |
…handle DelegationToken request errors
… to handle DelegationToken request errors
🎊 +1 overall
This message was automatically generated. |
@zhangxiping1 Here is a Checkstyle exception /hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java:171: protected RouterSecurityManager securityManager = null;:35: Variable 'securityManager' must be private and have accessor methods. [VisibilityModifier] |
ok ,I'll make some more revisions. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@KeeProMise hi, lao tie, it seems to be okay. |
@zhangxiping1 LGTM + 1. Let's wait for two days to see if there are any other comments. |
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @zhangxiping1 Just leave a blank line here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables the router’s asynchronous RPC feature to support delegation token operations and adds a basic test for the new async getDelegationToken call.
- Added async implementations for
getDelegationToken
,renewDelegationToken
, andcancelDelegationToken
inRouterAsyncClientProtocol
- Exposed
getSecurityManager()
inRouterClientProtocol
to back the async handlers - Introduced a new test to verify no exception is thrown when calling
getDelegationToken
asynchronously
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
TestRouterAsyncRpc.java | Added testGetDelegationTokenAsyncRpc using assertDoesNotThrow |
RouterAsyncClientProtocol.java | Implemented async methods for delegation token operations |
RouterClientProtocol.java | Exposed getSecurityManager() getter |
Comments suppressed due to low confidence (2)
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpc.java:97
- The test only asserts that no exception is thrown; consider adding
assertNotNull
on the returned token to validate the async call actually returns a valid delegation token.
assertDoesNotThrow(() -> {
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpc.java:94
- There are no tests covering
renewDelegationToken
orcancelDelegationToken
async methods; consider adding similar tests to ensure those flows handle errors correctly.
@Test
throws IOException { | ||
rpcServer.checkOperation(NameNode.OperationCategory.WRITE, true); | ||
asyncComplete(getSecurityManager().getDelegationToken(renewer)); | ||
return asyncReturn(Token.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using asyncReturn(Token.class)
loses the generic type information (DelegationTokenIdentifier
). Consider an explicit cast or adding @SuppressWarnings("unchecked")
to make the conversion clear and safe.
return asyncReturn(Token.class); | |
return (Token<DelegationTokenIdentifier>) asyncReturn(Token.class); |
Copilot uses AI. Check for mistakes.
@@ -2524,4 +2524,8 @@ public void setServerDefaultsLastUpdate(long serverDefaultsLastUpdate) { | |||
public RouterFederationRename getRbfRename() { | |||
return rbfRename; | |||
} | |||
|
|||
public RouterSecurityManager getSecurityManager() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new public getter lacks Javadoc and audience annotations; consider adding a brief description and an @InterfaceAudience
tag to clarify intended use.
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. +1
Enable the router asynchronous RPC feature to handle getDelegationToken request errors.