summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/repo/indexed
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2006-11-04 17:44:21 +0000
committerBrian S. O'Neill <bronee@gmail.com>2006-11-04 17:44:21 +0000
commit0a78be150e162aad34c19f233dc2f4ca71f61135 (patch)
treeaf6a18cac0541894b16a72782f3fb50f59c533a9 /src/main/java/com/amazon/carbonado/repo/indexed
parent9e4cd7e3af4ff5326fcb7a1dde3861f64badab41 (diff)
Support transaction isolation level of "none".
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo/indexed')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java b/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java
index 80ad172..bb17067 100644
--- a/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java
+++ b/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java
@@ -296,14 +296,10 @@ class ManagedIndex<S extends Storable> implements IndexEntryAccessor<S> {
void populateIndex(Repository repo, Storage<S> masterStorage) throws RepositoryException {
MergeSortBuffer buffer;
Comparator c;
- Transaction txn;
-
- if (repo.getTransactionIsolationLevel() == null) {
- txn = null;
- } else {
- txn = repo.enterTopTransaction(IsolationLevel.READ_COMMITTED);
- }
+ // Enter top transaction with isolation level of none to make sure
+ // preload operation does not run in a long nested transaction.
+ Transaction txn = repo.enterTopTransaction(IsolationLevel.NONE);
try {
Cursor<S> cursor = masterStorage.query().fetch();
if (!cursor.hasNext()) {
@@ -335,10 +331,10 @@ class ManagedIndex<S extends Storable> implements IndexEntryAccessor<S> {
while (cursor.hasNext()) {
buffer.add(makeIndexEntry(cursor.next()));
}
+
+ // No need to commit transaction because no changes should have been made.
} finally {
- if (txn != null) {
- txn.exit();
- }
+ txn.exit();
}
buffer.sort();