From 816705790c92d4bfac11e1b5fdd60df940cae839 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Tue, 24 Mar 2009 19:15:57 +0000 Subject: Derived index update must tolerate inconsistencies. --- .../carbonado/repo/indexed/DerivedIndexesTrigger.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src') 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 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 oldIndexEntries = (List) state; - int size = oldIndexEntries.size(); - for (int i=0; i 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(); } } } -- cgit v1.2.3