[ https://issues.apache.org/jira/browse/HADOOP-13427?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mingliang Liu updated HADOOP-13427: ----------------------------------- Attachment: HADOOP-13427.005.patch old: {code} 116 if (targetFS.exists(targetFinalPath) && targetFS.isFile(targetFinalPath)) { 117 overWrite = true; // When target is an existing file, overwrite it. {code} new: {code} 116 try { 117 overWrite = targetFS.getFileStatus(targetFinalPath).isFile(); 118 } catch (FileNotFoundException ignored) { 118 } {code} If {{overWrite}} is true before this, we may overwrite it, which is not expected. {code} try { overWrite = overWrite || targetFS.getFileStatus(targetFinalPath).isFile(); } catch (FileNotFoundException ignored) { } {code} This should heal the failing unit test {{hadoop.tools.TestIntegration}}, see v5 patch. > Eliminate needless uses of FileSystem#{exists(), isFile(), isDirectory()} > ------------------------------------------------------------------------- > > Key: HADOOP-13427 > URL: https://issues.apache.org/jira/browse/HADOOP-13427 > Project: Hadoop Common > Issue Type: Improvement > Components: fs > Affects Versions: 2.8.0 > Reporter: Steve Loughran > Assignee: Steve Loughran > Attachments: HADOOP-13427-001.patch, HADOOP-13427-002.patch, > HADOOP-13427.003.patch, HADOOP-13427.004.patch, HADOOP-13427.005.patch > > > We're cleaning up Hive and Spark's use of FileSystem.exists, because it is > often the case we see code of exists+open, exists+delete, when the exists > probe is needless. Against object stores, expensive needless. > Hadoop can set an example here by stripping them out. It will also show where > there are opportunities to optimise things better and/or improve reporting. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org