Skip to content

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

Merged
merged 6 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -977,43 +977,6 @@ public UpdatePipelineResponseProto updatePipeline(
return null;
}

@Override
public GetDelegationTokenResponseProto getDelegationToken(
RpcController controller, GetDelegationTokenRequestProto req) {
asyncRouterServer(() -> server
.getDelegationToken(new Text(req.getRenewer())),
token -> {
GetDelegationTokenResponseProto.Builder rspBuilder =
GetDelegationTokenResponseProto.newBuilder();
if (token != null) {
rspBuilder.setToken(PBHelperClient.convert(token));
}
return rspBuilder.build();
});
return null;
}

@Override
public RenewDelegationTokenResponseProto renewDelegationToken(
RpcController controller, RenewDelegationTokenRequestProto req) {
asyncRouterServer(() -> server.renewDelegationToken(PBHelperClient
.convertDelegationToken(req.getToken())),
result -> RenewDelegationTokenResponseProto.newBuilder()
.setNewExpiryTime(result).build());
return null;
}

@Override
public CancelDelegationTokenResponseProto cancelDelegationToken(
RpcController controller, CancelDelegationTokenRequestProto req) {
asyncRouterServer(() -> {
server.cancelDelegationToken(PBHelperClient.convertDelegationToken(req
.getToken()));
return null;
}, result -> VOID_CANCELDELEGATIONTOKEN_RESPONSE);
return null;
}

@Override
public SetBalancerBandwidthResponseProto setBalancerBandwidth(
RpcController controller, SetBalancerBandwidthRequestProto req) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,10 @@ public void testgetGroupsForUser() throws Exception {
public void testConcurrentCallExecutorInitial() {
assertNull(rndRouter.getRouterRpcClient().getExecutorService());
}


Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@Test
public void testgetDelegationToken() throws Exception {
rndRouter.getFileSystem().getDelegationToken("yarn");
Copy link
Preview

Copilot AI May 27, 2025

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.

Suggested change
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.

}
}