Skip to content
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

Do not merge, just for validating. #7456

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -276,6 +276,7 @@
import java.util.Map;
import java.util.stream.Collectors;

import static org.apache.hadoop.hdfs.protocolPB.AsyncRpcProtocolPBUtil.LOG;
import static org.apache.hadoop.hdfs.protocolPB.AsyncRpcProtocolPBUtil.asyncRouterServer;

public class RouterClientNamenodeProtocolServerSideTranslatorPB
Expand Down Expand Up @@ -562,6 +563,7 @@ public MkdirsResponseProto mkdirs(
PBHelperClient.convert(req.getMasked());
boolean result = server.mkdirs(req.getSrc(), masked,
req.getCreateParent());
LOG.info("BZL#mkdirs, result is {}", result);
return result;
}, result -> MkdirsResponseProto.newBuilder().setResult(result).build());
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2225,7 +2225,7 @@ protected static FsPermission getParentPermission(final FsPermission mask) {
* @return New HDFS file status representing a mount point.
*/
@VisibleForTesting
protected HdfsFileStatus getMountPointStatus(
public HdfsFileStatus getMountPointStatus(
String name, int childrenNum, long date) {
return getMountPointStatus(name, childrenNum, date, true);
}
Expand All @@ -2240,7 +2240,7 @@ protected HdfsFileStatus getMountPointStatus(
* @return New HDFS file status representing a mount point.
*/
@VisibleForTesting
protected HdfsFileStatus getMountPointStatus(
public HdfsFileStatus getMountPointStatus(
String name, int childrenNum, long date, boolean setPath) {
long modTime = date;
long accessTime = date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1994,7 +1994,7 @@ private static boolean isReadCall(Method method) {
* @param nsId namespaceID
*/
@VisibleForTesting
boolean isNamespaceStateIdFresh(String nsId) {
public boolean isNamespaceStateIdFresh(String nsId) {
if (activeNNStateIdRefreshPeriodMs < 0) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class RouterStateIdContext implements AlignmentContext {
/** Nameservice specific overrides of the default setting for enabling observer reads. */
private HashSet<String> observerReadEnabledOverrides = new HashSet<>();

RouterStateIdContext(Configuration conf) {
public RouterStateIdContext(Configuration conf) {
this.coordinatedMethods = new HashSet<>();
// For now, only ClientProtocol methods can be coordinated, so only checking
// against ClientProtocol.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hdfs.server.federation.router;

import static org.apache.hadoop.hdfs.server.federation.router.async.utils.AsyncUtil.syncReturn;
import static org.apache.hadoop.util.StringUtils.getTrimmedStringCollection;

import org.apache.hadoop.fs.InvalidPathException;
Expand All @@ -28,6 +29,7 @@
import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
import org.apache.hadoop.hdfs.protocol.HdfsConstants.DatanodeReportType;
import org.apache.hadoop.hdfs.server.common.JspHelper;
import org.apache.hadoop.hdfs.server.federation.resolver.RemoteLocation;
import org.apache.hadoop.hdfs.server.federation.router.security.RouterSecurityManager;
import org.apache.hadoop.hdfs.server.namenode.web.resources.NamenodeWebHdfsMethods;

Expand Down Expand Up @@ -478,8 +480,14 @@ private DatanodeInfo chooseDatanode(final Router router,

if (op == PutOpParam.Op.CREATE) {
try {
resolvedNs = rpcServer.getCreateLocation(path).getNameserviceId();
} catch (IOException e) {
if (rpcServer.isAsync()) {
rpcServer.getCreateLocation(path);
RemoteLocation remoteLocation = syncReturn(RemoteLocation.class);
resolvedNs = remoteLocation.getNameserviceId();
} else {
resolvedNs = rpcServer.getCreateLocation(path).getNameserviceId();
}
} catch (Exception e) {
LOG.error("Cannot get the name service " +
"to create file for path {} ", path, e);
}
Expand Down
Loading