[ASTERIXDB-2072][STO] Do Not Delete Checkpoints on ClosedByInterruptException
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- On ClosedByInterruptException, don't delete checkpoints since
they are not corrupted.
Change-Id: I7581eb15558dd656d9e2de1469845371dcc13e4b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1975
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/recovery/AbstractCheckpointManager.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/recovery/AbstractCheckpointManager.java
index 24d316b..2a075f1 100644
--- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/recovery/AbstractCheckpointManager.java
+++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/recovery/AbstractCheckpointManager.java
@@ -23,6 +23,7 @@
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.channels.ClosedByInterruptException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -91,6 +92,10 @@
LOGGER.log(Level.WARNING, "Reading checkpoint file: " + file.getAbsolutePath());
String jsonString = new String(Files.readAllBytes(Paths.get(file.getAbsolutePath())));
checkpointObjectList.add(Checkpoint.fromJson(jsonString));
+ } catch (ClosedByInterruptException e) {
+ Thread.currentThread().interrupt();
+ LOGGER.log(Level.WARNING, "Interrupted while reading checkpoint file: " + file.getAbsolutePath(), e);
+ throw new ACIDException(e);
} catch (IOException e) {
// ignore corrupted checkpoint file
LOGGER.log(Level.WARNING, "Failed to read checkpoint file: " + file.getAbsolutePath(), e);