Skip to content

Commit

Permalink
tmp save
Browse files Browse the repository at this point in the history
  • Loading branch information
hfutatzhanghb committed Mar 5, 2025
1 parent 31d29e5 commit 54d684d
Show file tree
Hide file tree
Showing 14 changed files with 1,933 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public static <T> void asyncRouterServer(ServerReq<T> req, ServerRes<T> res) {
LOG.debug("Async response, callback: {}, CallerContext: {}, result: [{}], exception: [{}]",
callback, CallerContext.getCurrent(), result, e);
if (e == null) {
LOG.info("BZL#Test. asyncRouterServer. excep == null.");
Message value = null;
try {
value = res.res(result);
Expand All @@ -134,6 +135,7 @@ public static <T> void asyncRouterServer(ServerReq<T> req, ServerRes<T> res) {
}
callback.setResponse(value);
} else {
LOG.info("BZL#Test. asyncRouterServer. excep != null.");
callback.error(e.getCause());
}
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

0 comments on commit 54d684d

Please sign in to comment.