From 0a78be150e162aad34c19f233dc2f4ca71f61135 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Sat, 4 Nov 2006 17:44:21 +0000 Subject: Support transaction isolation level of "none". --- .../com/amazon/carbonado/repo/indexed/ManagedIndex.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/repo/indexed') 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 implements IndexEntryAccessor { void populateIndex(Repository repo, Storage 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 cursor = masterStorage.query().fetch(); if (!cursor.hasNext()) { @@ -335,10 +331,10 @@ class ManagedIndex implements IndexEntryAccessor { 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(); -- cgit v1.2.3