[ https://issues.apache.org/jira/browse/HDFS-10993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
John Zhuge updated HDFS-10993: ------------------------------ Summary: Rename may fail without a clear message indicating the failure reason (was: rename may fail without a clear message indicating the failure reason) > 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-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org