You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "John Zhuge (JIRA)" <ji...@apache.org> on 2016/10/13 22:17:21 UTC
[jira] [Commented] (HDFS-10993) rename may fail without a clear
message indicating the failure reason.
[ https://issues.apache.org/jira/browse/HDFS-10993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15573378#comment-15573378 ]
John Zhuge commented on HDFS-10993:
-----------------------------------
This is a deprecated method. The other non-deprecated method does not have this issue.
Currently there are 2 callers of the deprecated method, should we switch them to use the non-deprecated one?
> rename may fail without a clear message indicating the failure reason.
> ----------------------------------------------------------------------
>
> Key: HDFS-10993
> URL: https://issues.apache.org/jira/browse/HDFS-10993
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: hdfs
> Reporter: Yongjun Zhang
> Assignee: John Zhuge
> Priority: Minor
>
> Currently the FSDirRenameOp$unprotectedRenameTo looks like
> {code}
> static INodesInPath unprotectedRenameTo(FSDirectory fsd,
> final INodesInPath srcIIP, final INodesInPath dstIIP, long timestamp)
> throws IOException {
> assert fsd.hasWriteLock();
> final INode srcInode = srcIIP.getLastINode();
> try {
> validateRenameSource(fsd, srcIIP);
> } catch (SnapshotException e) {
> throw e;
> } catch (IOException ignored) {
> return null;
> }
> String src = srcIIP.getPath();
> String dst = dstIIP.getPath();
> // validate the destination
> if (dst.equals(src)) {
> return dstIIP;
> }
> try {
> validateDestination(src, dst, srcInode);
> } catch (IOException ignored) {
> return null;
> }
> if (dstIIP.getLastINode() != null) {
> NameNode.stateChangeLog.warn("DIR* FSDirectory.unprotectedRenameTo: " +
> "failed to rename " + src + " to " + dst + " because destination " +
> "exists");
> return null;
> }
> INode dstParent = dstIIP.getINode(-2);
> if (dstParent == null) {
> NameNode.stateChangeLog.warn("DIR* FSDirectory.unprotectedRenameTo: " +
> "failed to rename " + src + " to " + dst + " because destination's " +
> "parent does not exist");
> return null;
> }
> fsd.ezManager.checkMoveValidity(srcIIP, dstIIP, src);
> // Ensure dst has quota to accommodate rename
> verifyFsLimitsForRename(fsd, srcIIP, dstIIP);
> verifyQuotaForRename(fsd, srcIIP, dstIIP);
> RenameOperation tx = new RenameOperation(fsd, srcIIP, dstIIP);
> boolean added = false;
> INodesInPath renamedIIP = null;
> try {
> // remove src
> if (!tx.removeSrc4OldRename()) {
> return null;
> }
> renamedIIP = tx.addSourceToDestination();
> added = (renamedIIP != null);
> if (added) {
> if (NameNode.stateChangeLog.isDebugEnabled()) {
> NameNode.stateChangeLog.debug("DIR* FSDirectory" +
> ".unprotectedRenameTo: " + src + " is renamed to " + dst);
> }
> tx.updateMtimeAndLease(timestamp);
> tx.updateQuotasInSourceTree(fsd.getBlockStoragePolicySuite());
> return renamedIIP;
> }
> } finally {
> if (!added) {
> tx.restoreSource();
> }
> }
> NameNode.stateChangeLog.warn("DIR* FSDirectory.unprotectedRenameTo: " +
> "failed to rename " + src + " to " + dst);
> return null;
> }
> {code}
> There are several places that returns null without a clear message. Though that seems to be on purpose in the code, it left to user to guess what's going on.
> It seems to make sense to have a warning for each failed scenario.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org