diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2008-11-24 23:45:26 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2008-11-24 23:45:26 +0000 |
commit | 44ab9fdec458b51577bf806dc542a22f8b632410 (patch) | |
tree | 35bb462dd283952a9294be74b3a77be159d22ccd /src | |
parent | e13910b6bb3ea03de2cc7e1ab146117658983d77 (diff) |
Allow primary record to be deleted if corrupt.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/indexed/IndexesTrigger.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/IndexesTrigger.java b/src/main/java/com/amazon/carbonado/repo/indexed/IndexesTrigger.java index ab718e4..678769d 100644 --- a/src/main/java/com/amazon/carbonado/repo/indexed/IndexesTrigger.java +++ b/src/main/java/com/amazon/carbonado/repo/indexed/IndexesTrigger.java @@ -18,6 +18,9 @@ package com.amazon.carbonado.repo.indexed;
+import org.apache.commons.logging.LogFactory;
+
+import com.amazon.carbonado.CorruptEncodingException;
import com.amazon.carbonado.FetchException;
import com.amazon.carbonado.PersistException;
import com.amazon.carbonado.Storable;
@@ -89,10 +92,19 @@ class IndexesTrigger<S extends Storable> extends Trigger<S> { // Delete index entries referenced by existing storable.
S copy = (S) storable.copy();
try {
- if (copy.tryLoad()) {
- for (ManagedIndex<S> managed : mManagedIndexes) {
- managed.deleteIndexEntry(copy);
+ try {
+ if (!copy.tryLoad()) {
+ return null;
}
+ } catch (CorruptEncodingException e) {
+ LogFactory.getLog(IndexedStorage.class)
+ .warn("Unable to delete index entries because primary record is corrupt: " +
+ copy.toStringKeyOnly(), e);
+ return null;
+ }
+
+ for (ManagedIndex<S> managed : mManagedIndexes) {
+ managed.deleteIndexEntry(copy);
}
} catch (FetchException e) {
throw e.toPersistException();
|