From 02907e327a657b6038d1eeec898bc42caa3b5ce3 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Thu, 1 May 2008 20:41:50 +0000 Subject: Add index repair method. --- src/main/java/com/amazon/carbonado/repo/indexed/IndexedStorage.java | 6 +++--- src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src/main') 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 fb55433..6409da7 100644 --- a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedStorage.java +++ b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedStorage.java @@ -605,7 +605,7 @@ class IndexedStorage implements Storage, StorageAccess // Doesn't completely remove the index, but it should free up space. double desiredSpeed = mRepository.getIndexRepairThrottle(); - Throttle throttle = desiredSpeed < 1.0 ? new Throttle(POPULATE_THROTTLE_WINDOW) : null; + Throttle throttle = desiredSpeed < 1.0 ? new Throttle(BUILD_THROTTLE_WINDOW) : null; if (throttle == null) { indexEntryStorage.truncate(); @@ -624,7 +624,7 @@ class IndexedStorage implements Storage, StorageAccess final long savedTotal = totalDropped; boolean anyFailure = false; try { - while (count++ < POPULATE_BATCH_SIZE && cursor.hasNext()) { + while (count++ < BUILD_BATCH_SIZE && cursor.hasNext()) { if (cursor.next().tryDelete()) { totalDropped++; } else { @@ -650,7 +650,7 @@ class IndexedStorage implements Storage, StorageAccess } try { - throttle.throttle(desiredSpeed, POPULATE_THROTTLE_SLEEP_PRECISION); + throttle.throttle(desiredSpeed, BUILD_THROTTLE_SLEEP_PRECISION); } catch (InterruptedException e) { throw new RepositoryException("Index removal interrupted"); } 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 5806529..c667dde 100644 --- a/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java +++ b/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java @@ -29,7 +29,6 @@ import com.amazon.carbonado.CorruptEncodingException; import com.amazon.carbonado.Cursor; import com.amazon.carbonado.FetchException; import com.amazon.carbonado.IsolationLevel; -import com.amazon.carbonado.OptimisticLockException; import com.amazon.carbonado.PersistException; import com.amazon.carbonado.Query; import com.amazon.carbonado.Repository; @@ -388,7 +387,6 @@ class ManagedIndex implements IndexEntryAccessor { txn = repo.enterTopTransaction(IsolationLevel.READ_COMMITTED); try { - for (Object obj : buffer) { Storable indexEntry = (Storable) obj; if (indexEntry.tryInsert()) { -- cgit v1.2.3