summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/indexed/DerivedIndexesTrigger.java15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/DerivedIndexesTrigger.java b/src/main/java/com/amazon/carbonado/repo/indexed/DerivedIndexesTrigger.java
index 23e2837..ef5c710 100644
--- a/src/main/java/com/amazon/carbonado/repo/indexed/DerivedIndexesTrigger.java
+++ b/src/main/java/com/amazon/carbonado/repo/indexed/DerivedIndexesTrigger.java
@@ -89,15 +89,6 @@ class DerivedIndexesTrigger<S extends Storable, D extends Storable> extends Trig
@Override
public void afterDelete(S storable, Object state) throws PersistException {
updateValues(storable, state);
- /* FIXME: Deleting of derived index entries needs more thought.
- if (state != null) {
- List<Storable> oldIndexEntries = (List<Storable>) state;
- int size = oldIndexEntries.size();
- for (int i=0; i<size; i++) {
- oldIndexEntries.get(i).delete();
- }
- }
- */
}
@Override
@@ -171,9 +162,11 @@ class DerivedIndexesTrigger<S extends Storable, D extends Storable> extends Trig
Storable oldIndexEntry = oldIndexEntries.get(i);
Storable newIndexEntry = newIndexEntries.get(i);
if (!oldIndexEntry.equalProperties(newIndexEntry)) {
- oldIndexEntry.delete();
- newIndexEntry.tryInsert();
+ // Try delete old entry, just in case it is missing.
+ oldIndexEntry.tryDelete();
}
+ // Always try to insert index entry, just in case it is missing.
+ newIndexEntry.tryInsert();
}
}
}