summaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2008-09-08 22:58:24 +0000
committerBrian S. O'Neill <bronee@gmail.com>2008-09-08 22:58:24 +0000
commit0b9a4d866166ac0c555f0a3a4b44d1804ea145fb (patch)
tree901dfbe45556316625802c0f42c32a090f5b4474 /src/main/java/com
parent78d46cef0dd3d9a5051a4b60b755244b5077859d (diff)
Undo last commit.
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/indexed/IndexedStorage.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedStorage.java b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedStorage.java
index 6b2fed9..1abb064 100644
--- a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedStorage.java
+++ b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedStorage.java
@@ -142,20 +142,20 @@ class IndexedStorage<S extends Storable> implements Storage<S>, StorageAccess<S>
return;
}
- // Although the master storage and indexes should be truncated
- // atomically, this cannot be guaranteed due to freedom of truncate
- // implementation. Also, a transaction can be deadlock prone with
- // concurrent queries and updates. Instead, truncate the master first,
- // which may cause warnings to be logged if index entries refer to
- // missing records. This is harmless.
-
- mMasterStorage.truncate();
-
- // Now truncate the indexes.
- for (IndexInfo info : mAllIndexInfoMap.values()) {
- if (info instanceof ManagedIndex) {
- ((ManagedIndex) info).getIndexEntryStorage().truncate();
+ Transaction txn = mRepository.enterTransaction();
+ try {
+ mMasterStorage.truncate();
+
+ // Now truncate the indexes.
+ for (IndexInfo info : mAllIndexInfoMap.values()) {
+ if (info instanceof ManagedIndex) {
+ ((ManagedIndex) info).getIndexEntryStorage().truncate();
+ }
}
+
+ txn.commit();
+ } finally {
+ txn.exit();
}
}