[
https://issues.apache.org/jira/browse/HDFS-16865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17655147#comment-17655147
]
ASF GitHub Bot commented on HDFS-16865:
---------------------------------------
ayushtkn commented on code in PR #5200:
URL: https://github.com/apache/hadoop/pull/5200#discussion_r1062932845
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java:
##########
@@ -465,6 +465,26 @@ public void setOwner(String src, String username, String
groupname)
}
}
+ /**
+ * Try to get the remote location whose bpId is same with the input bpId
from the input locations.
+ * @param locations the input RemoteLocations.
+ * @param bpId the input bpId.
+ * @return the remote location whose bpId is same with the input.
+ * @throws IOException
+ */
+ private RemoteLocation getLocationWithBPID(List<RemoteLocation> locations,
String bpId)
+ throws IOException {
+ String nsId = rpcClient.getNameserviceForBlockPoolId(bpId);
+ for (RemoteLocation l : locations) {
+ if (l.getNameserviceId().equals(nsId)) {
+ return l;
+ }
+ }
+
+ LOG.debug("Can't found remote location for the {} from {}", bpId,
locations);
Review Comment:
nit:
I think it will be `find` instead of `found`
checked here as well
https://hinative.com/questions/16308167
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java:
##########
@@ -545,12 +567,12 @@ public boolean complete(String src, String clientName,
ExtendedBlock last,
long.class},
new RemoteParam(), clientName, last, fileId);
+ final List<RemoteLocation> locations = rpcServer.getLocationsForPath(src,
true);
if (last != null) {
- return rpcClient.invokeSingle(last, method, Boolean.class);
+ RemoteLocation location = getLocationWithBPID(locations,
last.getBlockPoolId());
+ return rpcClient.invokeSingle(location, method, Boolean.class);
Review Comment:
We are doing this `` rpcServer.getLocationsForPath(src, true);`` and then
getting the location for I think every old invokeSingle with Block as an
argument.
Can we not do this logic inside the removed ``invokeSingle`` method?
> RBF: The source path is always / after RBF proxied the complete, addBlock and
> getAdditionalDatanode RPC.
> --------------------------------------------------------------------------------------------------------
>
> Key: HDFS-16865
> URL: https://issues.apache.org/jira/browse/HDFS-16865
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: ZanderXu
> Assignee: ZanderXu
> Priority: Major
> Labels: pull-request-available
>
> The source path is always / after RBF proxied the complete, addBlock and
> getAdditionalDatanode RPC.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]