Till Westmann has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1938

Change subject: [ASTERIXDB-1990][ASTERIXDB-1991][STO] Log deletion failure
......................................................................

[ASTERIXDB-1990][ASTERIXDB-1991][STO] Log deletion failure

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Instead of failing operations due to file deletion
  exceptions, we will log the failure.

Change-Id: I7cf7c76f0613467ab307eca42f5ac0834a60fa44

Change-Id: I94e248e45d88247256a427614ca73e4cea809310
---
M 
hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/IoUtil.java
M 
hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/storage/am/common/AbstractIndexLifecycleTest.java
2 files changed, 12 insertions(+), 10 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/38/1938/1

diff --git 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/IoUtil.java
 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/IoUtil.java
index 0e70759..38c7473 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/IoUtil.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/IoUtil.java
@@ -19,8 +19,12 @@
 package org.apache.hyracks.api.util;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.hyracks.api.exceptions.ErrorCode;
@@ -32,6 +36,8 @@
  * and throws the appropriate error in case of failure.
  */
 public class IoUtil {
+
+    private static final Logger LOGGER = 
Logger.getLogger(IoUtil.class.getName());
 
     private IoUtil() {
     }
@@ -54,7 +60,7 @@
      * @param file
      *            the file to be deleted
      * @throws HyracksDataException
-     *             if the file doesn't exist or if it couldn't be deleted
+     *            if the file couldn't be deleted
      */
     public static void delete(File file) throws HyracksDataException {
         try {
@@ -63,8 +69,10 @@
             } else {
                 Files.delete(file.toPath());
             }
+        } catch (NoSuchFileException|FileNotFoundException e) {
+            LOGGER.log(Level.WARNING, e.getMessage(), e);
         } catch (IOException e) {
-            throw HyracksDataException.create(ErrorCode.CANNOT_DELETE_FILE, e, 
file.getAbsolutePath());
+            HyracksDataException.create(ErrorCode.CANNOT_DELETE_FILE, e, 
file.getAbsolutePath());
         }
     }
 
diff --git 
a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/storage/am/common/AbstractIndexLifecycleTest.java
 
b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/storage/am/common/AbstractIndexLifecycleTest.java
index aac4df5..5df7fc2 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/storage/am/common/AbstractIndexLifecycleTest.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/storage/am/common/AbstractIndexLifecycleTest.java
@@ -81,16 +81,10 @@
         checkInsertions();
         index.deactivate();
 
-        // Double destroy is invalid
+        // Double destroy is idempotent
         index.destroy();
         Assert.assertFalse(persistentStateExists());
-        exceptionCaught = false;
-        try {
-            index.destroy();
-        } catch (Exception e) {
-            exceptionCaught = true;
-        }
-        Assert.assertTrue(exceptionCaught);
+        index.destroy();
         Assert.assertFalse(persistentStateExists());
     }
 

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1938
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I94e248e45d88247256a427614ca73e4cea809310
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Till Westmann <ti...@apache.org>

Reply via email to