This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-1.7
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/branch-1.7 by this push:
     new f61f755  ORC-1039: Make FileDump.recoverFile handle side files only if 
they exist (#949)
f61f755 is described below

commit f61f755fbddbe477ad16047d3b64edba73e68970
Author: Guiyanakaung <[email protected]>
AuthorDate: Wed Oct 27 16:10:48 2021 +0800

    ORC-1039: Make FileDump.recoverFile handle side files only if they exist 
(#949)
    
    ### What changes were proposed in this pull request?
    
    This PR aims to make FileDump.recoverFile handle side files only if they 
exist.
    
    ### Why are the changes needed?
    
    This is useful when the test environment does not have sideFile.
    Without this, IOException occurs
    
    ### How was this patch tested?
    
    Pass the CIs.
    
    (cherry picked from commit c944a3c96dea8127d5712a627d02d61aae230c93)
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 java/tools/src/java/org/apache/orc/tools/FileDump.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/java/tools/src/java/org/apache/orc/tools/FileDump.java 
b/java/tools/src/java/org/apache/orc/tools/FileDump.java
index 0257c23..cce3400 100644
--- a/java/tools/src/java/org/apache/orc/tools/FileDump.java
+++ b/java/tools/src/java/org/apache/orc/tools/FileDump.java
@@ -592,8 +592,10 @@ public final class FileDump {
 
       // Move side file to backup path
       Path sideFilePath = OrcAcidUtils.getSideFile(corruptPath);
-      Path backupSideFilePath = new Path(backupDataPath.getParent(), 
sideFilePath.getName());
-      moveFiles(fs, sideFilePath, backupSideFilePath);
+      if (fs.exists(sideFilePath)) {
+        Path backupSideFilePath = new Path(backupDataPath.getParent(), 
sideFilePath.getName());
+        moveFiles(fs, sideFilePath, backupSideFilePath);
+      }
 
       // finally move recovered file to actual file
       moveFiles(fs, recoveredPath, corruptPath);

Reply via email to