[ASTERIXDB-3426][TX] Error during recovery for atomic statements
- user model changes: no
- storage format changes: no
- interface changes: yes
Change-Id: I2a92e07b230f6a1d4aca2cacff8a568c29615238
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18362
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Peeyush Gupta <peeyush.gupta@couchbase.com>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/AtomicJobRollbackMessage.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/AtomicJobRollbackMessage.java
index e611d8f..2110bc8 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/AtomicJobRollbackMessage.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/AtomicJobRollbackMessage.java
@@ -71,7 +71,7 @@
if (checkpoint.getLastComponentId() == v.getMaxId()) {
LOGGER.info("Removing checkpoint for resource {} for component id {}", k,
checkpoint.getLastComponentId());
- checkpointManager.deleteLatest(v.getMaxId(), 1);
+ checkpointManager.deleteLatest(v.getMaxId());
}
}
} catch (Exception e) {
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/IndexCheckpointManager.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/IndexCheckpointManager.java
index 77a4f19..4ca9f7c 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/IndexCheckpointManager.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/IndexCheckpointManager.java
@@ -231,18 +231,18 @@
}
@Override
- public void deleteLatest(long latestId, int historyToDelete) {
+ public void deleteLatest(long latestId) {
try {
final Collection<FileReference> checkpointFiles = ioManager.list(indexPath, CHECKPOINT_FILE_FILTER);
if (!checkpointFiles.isEmpty()) {
for (FileReference checkpointFile : checkpointFiles) {
- if (getCheckpointIdFromFileName(checkpointFile) > (latestId - historyToDelete)) {
+ if (read(checkpointFile).getLastComponentId() == latestId) {
ioManager.delete(checkpointFile);
}
}
}
} catch (Exception e) {
- LOGGER.warn(() -> "Couldn't delete history checkpoints at " + indexPath, e);
+ LOGGER.warn(() -> "Couldn't delete latest checkpoint file at " + indexPath, e);
}
}
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/storage/IIndexCheckpointManager.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/storage/IIndexCheckpointManager.java
index 75557ec..2cf613b 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/storage/IIndexCheckpointManager.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/storage/IIndexCheckpointManager.java
@@ -102,7 +102,7 @@
*/
void delete();
- void deleteLatest(long latestId, int historyToDelete);
+ void deleteLatest(long latestId);
/**
* Gets the index last valid component sequence.
diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/transaction/AtomicNoWALTransactionContext.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/transaction/AtomicNoWALTransactionContext.java
index 151d9ef..a743bb1 100644
--- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/transaction/AtomicNoWALTransactionContext.java
+++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/transaction/AtomicNoWALTransactionContext.java
@@ -198,7 +198,7 @@
if (checkpoint.getLastComponentId() == v.getMaxId()) {
LOGGER.info("Removing checkpoint for resource {} for component id {}", k,
checkpoint.getLastComponentId());
- checkpointManager.deleteLatest(v.getMaxId(), 1);
+ checkpointManager.deleteLatest(v.getMaxId());
}
}
} catch (HyracksDataException e) {