made naming of ILSMIndexAccessor implementations consistent;
removed unused IIndexBulkloadContext interface;
made AntimatterAwareTupleAccesor a singleton;
miscellaneous cleanup in each of the ILSMIndex implementations;



git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_tree@1953 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IIndexBulkLoadContext.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IIndexBulkLoadContext.java
deleted file mode 100644
index a896d80..0000000
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IIndexBulkLoadContext.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package edu.uci.ics.hyracks.storage.am.common.api;
-
-public interface IIndexBulkLoadContext {
-}
diff --git a/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/AntimatterAwareTupleAcceptor.java b/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/AntimatterAwareTupleAcceptor.java
index a1d00a6..e88aea6 100644
--- a/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/AntimatterAwareTupleAcceptor.java
+++ b/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/AntimatterAwareTupleAcceptor.java
@@ -4,7 +4,8 @@
 import edu.uci.ics.hyracks.storage.am.btree.api.ITupleAcceptor;
 import edu.uci.ics.hyracks.storage.am.lsm.btree.tuples.LSMBTreeTupleReference;
 
-public class AntimatterAwareTupleAcceptor implements ITupleAcceptor {
+public enum AntimatterAwareTupleAcceptor implements ITupleAcceptor {
+    INSTANCE;
 
     @Override
     public boolean accept(ITupleReference tuple) {
diff --git a/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTree.java b/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTree.java
index 99619d6..0fc7493 100644
--- a/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTree.java
+++ b/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTree.java
@@ -20,7 +20,6 @@
 import java.util.List;
 import java.util.ListIterator;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.logging.Logger;
 
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
@@ -51,6 +50,7 @@
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.IInMemoryBufferCache;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMComponentFinalizer;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMFlushController;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperation;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallback;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
@@ -71,16 +71,11 @@
 import edu.uci.ics.hyracks.storage.common.file.IFileMapProvider;
 
 public class LSMBTree implements ILSMIndex, ITreeIndex {
-    protected final Logger LOGGER = Logger.getLogger(LSMBTree.class.getName());
-
-    private final LSMHarness lsmHarness;
+    private final ILSMHarness lsmHarness;
 
     // In-memory components.   
     private final BTree memBTree;
-    private final FileReference memBtreeFile = new FileReference(new File("memBtree"));
-    private final IInMemoryBufferCache memBufferCache;
     private final IInMemoryFreePageManager memFreePageManager;
-    private final AntimatterAwareTupleAcceptor acceptor = new AntimatterAwareTupleAcceptor();
 
     // On-disk components.    
     private final ILSMIndexFileManager fileManager;
@@ -92,7 +87,7 @@
     private final IBufferCache diskBufferCache;
     private final IFileMapProvider diskFileMapProvider;
     // List of BTree instances. Using Object for better sharing via ILSMTree + LSMHarness.
-    private LinkedList<Object> diskBTrees = new LinkedList<Object>();
+    private LinkedList<Object> diskBTrees;
     // Helps to guarantees physical consistency of LSM components.
     private final ILSMComponentFinalizer componentFinalizer;
 
@@ -101,7 +96,7 @@
     private final ITreeIndexFrameFactory deleteLeafFrameFactory;
     private final IBinaryComparatorFactory[] cmpFactories;
 
-    private boolean isActivated = false;
+    private boolean isActivated;
 
     public LSMBTree(IInMemoryBufferCache memBufferCache, IInMemoryFreePageManager memFreePageManager,
             ITreeIndexFrameFactory interiorFrameFactory, ITreeIndexFrameFactory insertLeafFrameFactory,
@@ -112,8 +107,7 @@
             ILSMIOOperationScheduler ioScheduler) {
         memBTree = new BTree(memBufferCache, ((InMemoryBufferCache) memBufferCache).getFileMapProvider(),
                 memFreePageManager, interiorFrameFactory, insertLeafFrameFactory, cmpFactories, fieldCount,
-                memBtreeFile);
-        this.memBufferCache = memBufferCache;
+                new FileReference(new File("membtree")));
         this.memFreePageManager = memFreePageManager;
         this.insertLeafFrameFactory = insertLeafFrameFactory;
         this.deleteLeafFrameFactory = deleteLeafFrameFactory;
@@ -126,6 +120,8 @@
         this.fileManager = fileNameManager;
         lsmHarness = new LSMHarness(this, flushController, mergePolicy, opTracker, ioScheduler);
         componentFinalizer = new TreeIndexComponentFinalizer(diskFileMapProvider);
+        diskBTrees = new LinkedList<Object>();
+        isActivated = false;
     }
 
     @Override
@@ -249,7 +245,7 @@
                     throw new BTreeDuplicateKeyException("Failed to insert key since key already exists.");
                 } else {
                     memCursor.close();
-                    ctx.memBTreeAccessor.upsertIfConditionElseInsert(tuple, acceptor);
+                    ctx.memBTreeAccessor.upsertIfConditionElseInsert(tuple, AntimatterAwareTupleAcceptor.INSTANCE);
                     return true;
                 }
             }
@@ -266,7 +262,7 @@
         } finally {
             searchCursor.close();
         }
-        ctx.memBTreeAccessor.upsertIfConditionElseInsert(tuple, acceptor);
+        ctx.memBTreeAccessor.upsertIfConditionElseInsert(tuple, AntimatterAwareTupleAcceptor.INSTANCE);
 
         return true;
     }
@@ -505,11 +501,11 @@
     @Override
     public ILSMIndexAccessor createAccessor(IModificationOperationCallback modificationCallback,
             ISearchOperationCallback searchCallback) {
-        return new LSMBTreeIndexAccessor(lsmHarness, createOpContext(modificationCallback, searchCallback));
+        return new LSMBTreeAccessor(lsmHarness, createOpContext(modificationCallback, searchCallback));
     }
 
-    public class LSMBTreeIndexAccessor extends LSMTreeIndexAccessor {
-        public LSMBTreeIndexAccessor(LSMHarness lsmHarness, IIndexOperationContext ctx) {
+    public class LSMBTreeAccessor extends LSMTreeIndexAccessor {
+        public LSMBTreeAccessor(ILSMHarness lsmHarness, IIndexOperationContext ctx) {
             super(lsmHarness, ctx);
         }
 
diff --git a/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTreeCursorInitialState.java b/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTreeCursorInitialState.java
index cb0351d..37958c7 100644
--- a/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTreeCursorInitialState.java
+++ b/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTreeCursorInitialState.java
@@ -23,7 +23,7 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ISearchPredicate;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
-import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMHarness;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
 public class LSMBTreeCursorInitialState implements ICursorInitialState {
@@ -33,14 +33,14 @@
     private MultiComparator cmp;
     private final boolean includeMemComponent;
     private final AtomicInteger searcherfRefCount;
-    private final LSMHarness lsmHarness;
+    private final ILSMHarness lsmHarness;
 
     private final IIndexAccessor memBtreeAccessor;
     private final ISearchPredicate predicate;
     private ISearchOperationCallback searchCallback;
 
     public LSMBTreeCursorInitialState(int numBTrees, ITreeIndexFrameFactory leafFrameFactory, MultiComparator cmp,
-            boolean includeMemComponent, AtomicInteger searcherfRefCount, LSMHarness lsmHarness,
+            boolean includeMemComponent, AtomicInteger searcherfRefCount, ILSMHarness lsmHarness,
             IIndexAccessor memBtreeAccessor, ISearchPredicate predicate, ISearchOperationCallback searchCallback) {
         this.numBTrees = numBTrees;
         this.leafFrameFactory = leafFrameFactory;
@@ -78,7 +78,7 @@
         return includeMemComponent;
     }
 
-    public LSMHarness getLSMHarness() {
+    public ILSMHarness getLSMHarness() {
         return lsmHarness;
     }
 
diff --git a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMHarness.java b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMHarness.java
index 4b445ce..a07396d 100644
--- a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMHarness.java
+++ b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMHarness.java
@@ -35,12 +35,15 @@
     public void closeSearchCursor(AtomicInteger searcherRefCount, boolean includeMemComponent)
             throws HyracksDataException;
 
+    public ILSMIOOperation createMergeOperation(ILSMIOOperationCallback callback) throws HyracksDataException,
+            IndexException;
+
     public void merge(ILSMIOOperation operation) throws HyracksDataException, IndexException;
 
     public void flush(ILSMIOOperation operation) throws HyracksDataException, IndexException;
 
     public void addBulkLoadedComponent(Object index) throws HyracksDataException, IndexException;
-    
+
     public ILSMIndex getIndex();
 
     public ILSMFlushController getFlushController();
diff --git a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMTreeIndexAccessor.java b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMTreeIndexAccessor.java
index 797e250..d0efa42 100644
--- a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMTreeIndexAccessor.java
+++ b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMTreeIndexAccessor.java
@@ -22,15 +22,16 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ISearchPredicate;
 import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOperation;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperation;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallback;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndexAccessor;
 
 public abstract class LSMTreeIndexAccessor implements ILSMIndexAccessor {
-    protected LSMHarness lsmHarness;
+    protected ILSMHarness lsmHarness;
     protected IIndexOperationContext ctx;
 
-    public LSMTreeIndexAccessor(LSMHarness lsmHarness, IIndexOperationContext ctx) {
+    public LSMTreeIndexAccessor(ILSMHarness lsmHarness, IIndexOperationContext ctx) {
         this.lsmHarness = lsmHarness;
         this.ctx = ctx;
     }
diff --git a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMTreeSearchCursor.java b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMTreeSearchCursor.java
index 0d513af..949a03a 100644
--- a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMTreeSearchCursor.java
+++ b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMTreeSearchCursor.java
@@ -25,6 +25,7 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexCursor;
 import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMTreeTupleReference;
 import edu.uci.ics.hyracks.storage.common.buffercache.IBufferCache;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
@@ -38,7 +39,7 @@
     protected boolean needPush;
     protected boolean includeMemComponent;
     protected AtomicInteger searcherRefCount;
-    protected LSMHarness lsmHarness;
+    protected ILSMHarness lsmHarness;
 
     public LSMTreeSearchCursor() {
         outputElement = null;
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java
index fedeb74..0382e2e 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java
@@ -50,6 +50,7 @@
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.IInMemoryBufferCache;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMComponentFinalizer;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMFlushController;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperation;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallback;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
@@ -94,36 +95,33 @@
         }
     }
 
-    protected final LSMHarness lsmHarness;
+    private final ILSMHarness lsmHarness;
 
     // In-memory components.
-    protected final LSMInvertedIndexComponent memComponent;
-    protected final IInMemoryBufferCache memBufferCache;
-    protected final IInMemoryFreePageManager memFreePageManager;
-    protected final IBinaryTokenizerFactory tokenizerFactory;
-    protected FileReference memDeleteKeysBTreeFile = new FileReference(new File("membtree"));
+    private final LSMInvertedIndexComponent memComponent;
+    private final IInMemoryFreePageManager memFreePageManager;
+    private final IBinaryTokenizerFactory tokenizerFactory;
 
     // On-disk components.
-    protected final ILSMIndexFileManager fileManager;
+    private final ILSMIndexFileManager fileManager;
     // For creating inverted indexes in flush and merge.
-    protected final OnDiskInvertedIndexFactory diskInvIndexFactory;
+    private final OnDiskInvertedIndexFactory diskInvIndexFactory;
     // For creating deleted-keys BTrees in flush and merge.
-    protected final BTreeFactory deletedKeysBTreeFactory;
-    protected final IBufferCache diskBufferCache;
-    protected final IFileMapProvider diskFileMapProvider;
+    private final BTreeFactory deletedKeysBTreeFactory;
+    private final IBufferCache diskBufferCache;
     // List of LSMInvertedIndexComponent instances. Using Object for better sharing via
     // ILSMIndex + LSMHarness.
-    protected final LinkedList<Object> diskComponents = new LinkedList<Object>();
+    private final LinkedList<Object> diskComponents;
     // Helps to guarantees physical consistency of LSM components.
-    protected final ILSMComponentFinalizer componentFinalizer;
+    private final ILSMComponentFinalizer componentFinalizer;
 
     // Type traits and comparators for tokens and inverted-list elements.
-    protected final ITypeTraits[] invListTypeTraits;
-    protected final IBinaryComparatorFactory[] invListCmpFactories;
-    protected final ITypeTraits[] tokenTypeTraits;
-    protected final IBinaryComparatorFactory[] tokenCmpFactories;
+    private final ITypeTraits[] invListTypeTraits;
+    private final IBinaryComparatorFactory[] invListCmpFactories;
+    private final ITypeTraits[] tokenTypeTraits;
+    private final IBinaryComparatorFactory[] tokenCmpFactories;
 
-    private boolean isActivated = false;
+    private boolean isActivated;
 
     public LSMInvertedIndex(IInMemoryBufferCache memBufferCache, IInMemoryFreePageManager memFreePageManager,
             OnDiskInvertedIndexFactory diskInvIndexFactory, BTreeFactory deletedKeysBTreeFactory,
@@ -137,22 +135,22 @@
                 tokenizerFactory);
         BTree deleteKeysBTree = BTreeUtils.createBTree(memBufferCache, memFreePageManager,
                 ((InMemoryBufferCache) memBufferCache).getFileMapProvider(), invListTypeTraits, invListCmpFactories,
-                BTreeLeafFrameType.REGULAR_NSM, memDeleteKeysBTreeFile);
+                BTreeLeafFrameType.REGULAR_NSM, new FileReference(new File("membtree")));
         memComponent = new LSMInvertedIndexComponent(memInvIndex, deleteKeysBTree);
-        this.memBufferCache = memBufferCache;
         this.memFreePageManager = memFreePageManager;
         this.tokenizerFactory = tokenizerFactory;
         this.fileManager = fileManager;
         this.diskInvIndexFactory = diskInvIndexFactory;
         this.deletedKeysBTreeFactory = deletedKeysBTreeFactory;
         this.diskBufferCache = diskInvIndexFactory.getBufferCache();
-        this.diskFileMapProvider = diskFileMapProvider;
         this.invListTypeTraits = invListTypeTraits;
         this.invListCmpFactories = invListCmpFactories;
         this.tokenTypeTraits = tokenTypeTraits;
         this.tokenCmpFactories = tokenCmpFactories;
         this.lsmHarness = new LSMHarness(this, flushController, mergePolicy, opTracker, ioScheduler);
         this.componentFinalizer = new LSMInvertedIndexComponentFinalizer(diskFileMapProvider);
+        diskComponents = new LinkedList<Object>();
+        isActivated = false;
     }
 
     @Override
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexAccessor.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexAccessor.java
index 64db7b1..02dd715 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexAccessor.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexAccessor.java
@@ -23,24 +23,24 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ISearchPredicate;
 import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOperation;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperation;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallback;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndexAccessor;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndexFileManager;
-import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMHarness;
 import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndexAccessor;
 import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.api.IInvertedListCursor;
 import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.impls.LSMInvertedIndexFileManager.LSMInvertedIndexFileNameComponent;
 
 public class LSMInvertedIndexAccessor implements ILSMIndexAccessor, IInvertedIndexAccessor {
 
-    protected final LSMHarness lsmHarness;
+    protected final ILSMHarness lsmHarness;
     protected final ILSMIndexFileManager fileManager;
     protected final IIndexOperationContext ctx;
     protected final LSMInvertedIndex invIndex;
 
-    public LSMInvertedIndexAccessor(LSMInvertedIndex invIndex, LSMHarness lsmHarness, ILSMIndexFileManager fileManager,
-            IIndexOperationContext ctx) {
+    public LSMInvertedIndexAccessor(LSMInvertedIndex invIndex, ILSMHarness lsmHarness,
+            ILSMIndexFileManager fileManager, IIndexOperationContext ctx) {
         this.lsmHarness = lsmHarness;
         this.fileManager = fileManager;
         this.ctx = ctx;
@@ -55,19 +55,19 @@
 
     @Override
     public void delete(ITupleReference tuple) throws HyracksDataException, IndexException {
-        ctx.setOperation(IndexOperation.DELETE);        
+        ctx.setOperation(IndexOperation.DELETE);
         lsmHarness.insertUpdateOrDelete(tuple, ctx);
     }
-    
+
     public void search(IIndexCursor cursor, ISearchPredicate searchPred) throws HyracksDataException, IndexException {
         ctx.setOperation(IndexOperation.SEARCH);
         lsmHarness.search(cursor, searchPred, ctx, true);
     }
-    
+
     public IIndexCursor createSearchCursor() {
-        return new LSMInvertedIndexSearchCursor(); 
+        return new LSMInvertedIndexSearchCursor();
     }
-    
+
     @Override
     public ILSMIOOperation createFlushOperation(ILSMIOOperationCallback callback) {
         LSMInvertedIndexFileNameComponent fileNameComponent = (LSMInvertedIndexFileNameComponent) fileManager
@@ -78,7 +78,7 @@
         return new LSMInvertedIndexFlushOperation(lsmHarness.getIndex(), dictBTreeFileRef, deletedKeysBTreeFileRef,
                 callback);
     }
-    
+
     @Override
     public void flush(ILSMIOOperation operation) throws HyracksDataException, IndexException {
         lsmHarness.flush(operation);
@@ -89,7 +89,7 @@
             IndexException {
         return lsmHarness.createMergeOperation(callback);
     }
-    
+
     @Override
     public void merge(ILSMIOOperation operation) throws HyracksDataException, IndexException {
         lsmHarness.merge(operation);
@@ -99,7 +99,7 @@
     public IIndexCursor createRangeSearchCursor() {
         return new LSMInvertedIndexRangeSearchCursor();
     }
-    
+
     @Override
     public void rangeSearch(IIndexCursor cursor, ISearchPredicate searchPred) throws IndexException,
             HyracksDataException {
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexRangeSearchCursorInitialState.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexRangeSearchCursorInitialState.java
index 7e01b78..2ed143d 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexRangeSearchCursorInitialState.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexRangeSearchCursorInitialState.java
@@ -24,7 +24,7 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ISearchPredicate;
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
 import edu.uci.ics.hyracks.storage.am.common.tuples.PermutingTupleReference;
-import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMHarness;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
 public class LSMInvertedIndexRangeSearchCursorInitialState implements ICursorInitialState {
@@ -32,19 +32,19 @@
     private final MultiComparator tokensAndKeysCmp;
     private final MultiComparator keyCmp;
     private final AtomicInteger searcherRefCount;
-    private final LSMHarness lsmHarness;
+    private final ILSMHarness lsmHarness;
 
     private final ArrayList<IIndexAccessor> indexAccessors;
     private final ArrayList<IIndexAccessor> deletedKeysBTreeAccessors;
     private final ISearchPredicate predicate;
     private final PermutingTupleReference keysOnlyTuple;
-    
+
     private final boolean includeMemComponent;
 
     public LSMInvertedIndexRangeSearchCursorInitialState(MultiComparator tokensAndKeysCmp, MultiComparator keyCmp,
-            PermutingTupleReference keysOnlyTuple, boolean includeMemComponent, AtomicInteger searcherRefCount, LSMHarness lsmHarness,
-            ArrayList<IIndexAccessor> indexAccessors, ArrayList<IIndexAccessor> deletedKeysBTreeAccessors,
-            ISearchPredicate predicate) {
+            PermutingTupleReference keysOnlyTuple, boolean includeMemComponent, AtomicInteger searcherRefCount,
+            ILSMHarness lsmHarness, ArrayList<IIndexAccessor> indexAccessors,
+            ArrayList<IIndexAccessor> deletedKeysBTreeAccessors, ISearchPredicate predicate) {
         this.tokensAndKeysCmp = tokensAndKeysCmp;
         this.keyCmp = keyCmp;
         this.keysOnlyTuple = keysOnlyTuple;
@@ -73,7 +73,7 @@
         return searcherRefCount;
     }
 
-    public LSMHarness getLSMHarness() {
+    public ILSMHarness getLSMHarness() {
         return lsmHarness;
     }
 
@@ -94,7 +94,7 @@
     public ArrayList<IIndexAccessor> getDeletedKeysBTreeAccessors() {
         return deletedKeysBTreeAccessors;
     }
-    
+
     public ISearchPredicate getSearchPredicate() {
         return predicate;
     }
@@ -103,7 +103,7 @@
     public void setOriginialKeyComparator(MultiComparator originalCmp) {
         // Do nothing.
     }
-    
+
     @Override
     public MultiComparator getOriginalKeyComparator() {
         return tokensAndKeysCmp;
@@ -112,11 +112,11 @@
     public MultiComparator getKeyComparator() {
         return keyCmp;
     }
-    
+
     public boolean getIncludeMemComponent() {
         return includeMemComponent;
     }
-    
+
     public PermutingTupleReference getKeysOnlyTuple() {
         return keysOnlyTuple;
     }
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexSearchCursor.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexSearchCursor.java
index 9bb52fb..7a79df6 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexSearchCursor.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexSearchCursor.java
@@ -27,7 +27,7 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ISearchPredicate;
 import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
-import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMHarness;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.exceptions.OccurrenceThresholdPanicException;
 
 /**
@@ -40,17 +40,17 @@
     private IIndexCursor currentCursor;
     private int accessorIndex = -1;
     private boolean tupleConsumed = true;
-    private LSMHarness harness;
+    private ILSMHarness harness;
     private boolean includeMemComponent;
     private AtomicInteger searcherRefCount;
     private List<IIndexAccessor> indexAccessors;
     private ISearchPredicate searchPred;
     private ISearchOperationCallback searchCallback;
-    
+
     // Assuming the cursor for all deleted-keys indexes are of the same type.
     private IIndexCursor deletedKeysBTreeCursor;
     private List<IIndexAccessor> deletedKeysBTreeAccessors;
-    private RangePredicate keySearchPred;    
+    private RangePredicate keySearchPred;
 
     @Override
     public void open(ICursorInitialState initialState, ISearchPredicate searchPred) throws HyracksDataException {
@@ -62,10 +62,10 @@
         accessorIndex = 0;
         this.searchPred = searchPred;
         this.searchCallback = lsmInitState.getSearchOperationCallback();
-        
+
         // For searching the deleted-keys BTrees.
         deletedKeysBTreeAccessors = lsmInitState.getDeletedKeysBTreeAccessors();
-        deletedKeysBTreeCursor = deletedKeysBTreeAccessors.get(0).createSearchCursor();        
+        deletedKeysBTreeCursor = deletedKeysBTreeAccessors.get(0).createSearchCursor();
         MultiComparator keyCmp = lsmInitState.getKeyComparator();
         keySearchPred = new RangePredicate(null, null, true, true, keyCmp, keyCmp);
     }
@@ -88,19 +88,19 @@
         }
         return false;
     }
-    
+
     // Move to the next tuple that has not been deleted.
     private boolean nextValidTuple() throws HyracksDataException, IndexException {
         while (currentCursor.hasNext()) {
             currentCursor.next();
-            if (!isDeleted(currentCursor.getTuple())) { 
+            if (!isDeleted(currentCursor.getTuple())) {
                 tupleConsumed = false;
                 return true;
             }
         }
         return false;
     }
-    
+
     @Override
     public boolean hasNext() throws HyracksDataException, IndexException {
         if (!tupleConsumed) {
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexSearchCursorInitialState.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexSearchCursorInitialState.java
index bd8512e..24ee41c 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexSearchCursorInitialState.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexSearchCursorInitialState.java
@@ -24,14 +24,14 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ISearchOperationCallback;
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
 import edu.uci.ics.hyracks.storage.am.common.tuples.PermutingTupleReference;
-import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMHarness;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
 public class LSMInvertedIndexSearchCursorInitialState implements ICursorInitialState {
 
     private final boolean includeMemComponent;
     private final AtomicInteger searcherfRefCount;
-    private final LSMHarness lsmHarness;
+    private final ILSMHarness lsmHarness;
     private final List<IIndexAccessor> indexAccessors;
     private final List<IIndexAccessor> deletedKeysBTreeAccessors;
     private final LSMInvertedIndexOpContext ctx;
@@ -43,7 +43,7 @@
     public LSMInvertedIndexSearchCursorInitialState(final MultiComparator keyCmp,
             PermutingTupleReference keysOnlyTuple, List<IIndexAccessor> indexAccessors,
             List<IIndexAccessor> deletedKeysBTreeAccessors, IIndexOperationContext ctx, boolean includeMemComponent,
-            AtomicInteger searcherfRefCount, LSMHarness lsmHarness) {
+            AtomicInteger searcherfRefCount, ILSMHarness lsmHarness) {
         this.keyCmp = keyCmp;
         this.keysOnlyTuple = keysOnlyTuple;
         this.indexAccessors = indexAccessors;
@@ -76,7 +76,7 @@
         return includeMemComponent;
     }
 
-    public LSMHarness getLSMHarness() {
+    public ILSMHarness getLSMHarness() {
         return lsmHarness;
     }
 
@@ -103,15 +103,15 @@
     public void setOriginialKeyComparator(MultiComparator originalCmp) {
         this.originalCmp = originalCmp;
     }
-    
+
     public MultiComparator getKeyComparator() {
         return keyCmp;
     }
-    
+
     public List<IIndexAccessor> getDeletedKeysBTreeAccessors() {
         return deletedKeysBTreeAccessors;
     }
-    
+
     public PermutingTupleReference getKeysOnlyTuple() {
         return keysOnlyTuple;
     }
diff --git a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java
index 4990de0..8613f0c 100644
--- a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java
+++ b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java
@@ -40,6 +40,7 @@
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.IInMemoryBufferCache;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMComponentFinalizer;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMFlushController;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndex;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndexAccessor;
@@ -76,7 +77,7 @@
         }
     }
 
-    protected final LSMHarness lsmHarness;
+    protected final ILSMHarness lsmHarness;
 
     protected final ILinearizeComparatorFactory linearizer;
     protected final int[] comparatorFields;
@@ -86,14 +87,12 @@
     protected final LSMRTreeComponent memComponent;
     protected final IInMemoryBufferCache memBufferCache;
     protected final IInMemoryFreePageManager memFreePageManager;
-    protected FileReference memRtreeFile = new FileReference(new File("memrtree"));
-    protected FileReference memBtreeFile = new FileReference(new File("membtree"));
 
     // This is used to estimate number of tuples in the memory RTree and BTree
     // for efficient memory allocation in the sort operation prior to flushing
-    protected int memRTreeTuples = 0;
-    protected int memBTreeTuples = 0;
-    protected TreeTupleSorter rTreeTupleSorter = null;
+    protected int memRTreeTuples;
+    protected int memBTreeTuples;
+    protected TreeTupleSorter rTreeTupleSorter;
 
     // On-disk components.
     protected final ILSMIndexFileManager fileManager;
@@ -103,7 +102,7 @@
     protected final TreeIndexFactory<RTree> diskRTreeFactory;
     // List of LSMRTreeComponent instances. Using Object for better sharing via
     // ILSMIndex + LSMHarness.
-    protected final LinkedList<Object> diskComponents = new LinkedList<Object>();
+    protected final LinkedList<Object> diskComponents;
     // Helps to guarantees physical consistency of LSM components.
     protected final ILSMComponentFinalizer componentFinalizer;
 
@@ -116,7 +115,7 @@
     protected final ITreeIndexFrameFactory rtreeLeafFrameFactory;
     protected final ITreeIndexFrameFactory btreeLeafFrameFactory;
 
-    private boolean isActivated = false;
+    private boolean isActivated;
 
     public AbstractLSMRTree(IInMemoryBufferCache memBufferCache, IInMemoryFreePageManager memFreePageManager,
             ITreeIndexFrameFactory rtreeInteriorFrameFactory, ITreeIndexFrameFactory rtreeLeafFrameFactory,
@@ -129,10 +128,10 @@
             ILSMIOOperationScheduler ioScheduler) {
         RTree memRTree = new RTree(memBufferCache, ((InMemoryBufferCache) memBufferCache).getFileMapProvider(),
                 memFreePageManager, rtreeInteriorFrameFactory, rtreeLeafFrameFactory, rtreeCmpFactories, fieldCount,
-                memBtreeFile);
+                new FileReference(new File("membtree")));
         BTree memBTree = new BTree(memBufferCache, ((InMemoryBufferCache) memBufferCache).getFileMapProvider(),
                 memFreePageManager, btreeInteriorFrameFactory, btreeLeafFrameFactory, btreeCmpFactories, fieldCount,
-                memRtreeFile);
+                new FileReference(new File("memrtree")));
         memComponent = new LSMRTreeComponent(memRTree, memBTree);
         this.memBufferCache = memBufferCache;
         this.memFreePageManager = memFreePageManager;
@@ -151,6 +150,11 @@
         this.linearizer = linearizer;
         this.comparatorFields = comparatorFields;
         this.linearizerArray = linearizerArray;
+        diskComponents = new LinkedList<Object>();
+        memRTreeTuples = 0;
+        memBTreeTuples = 0;
+        rTreeTupleSorter = null;
+        isActivated = false;
     }
 
     @Override
diff --git a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java
index cd470ba..8eca83a 100644
--- a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java
+++ b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java
@@ -44,13 +44,13 @@
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.IInMemoryBufferCache;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMFlushController;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperation;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallback;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndexFileManager;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMMergePolicy;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMOperationTracker;
-import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMHarness;
 import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMTreeIndexAccessor;
 import edu.uci.ics.hyracks.storage.am.lsm.common.impls.TreeIndexFactory;
 import edu.uci.ics.hyracks.storage.am.lsm.rtree.impls.LSMRTreeFileManager.LSMRTreeFileNameComponent;
@@ -353,7 +353,7 @@
     }
 
     public class LSMRTreeAccessor extends LSMTreeIndexAccessor {
-        public LSMRTreeAccessor(LSMHarness lsmHarness, IIndexOperationContext ctx) {
+        public LSMRTreeAccessor(ILSMHarness lsmHarness, IIndexOperationContext ctx) {
             super(lsmHarness, ctx);
         }
 
diff --git a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeAbstractCursor.java b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeAbstractCursor.java
index 969031e..a74a3db 100644
--- a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeAbstractCursor.java
+++ b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeAbstractCursor.java
@@ -11,7 +11,7 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ISearchPredicate;

 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexAccessor;

 import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;

-import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMHarness;

+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;

 import edu.uci.ics.hyracks.storage.am.rtree.api.IRTreeInteriorFrame;

 import edu.uci.ics.hyracks.storage.am.rtree.api.IRTreeLeafFrame;

 import edu.uci.ics.hyracks.storage.am.rtree.impls.RTreeSearchCursor;

@@ -40,7 +40,7 @@
     protected ITupleReference frameTuple;

     protected AtomicInteger searcherRefCount;

     protected boolean includeMemRTree;

-    protected LSMHarness lsmHarness;

+    protected ILSMHarness lsmHarness;

     protected boolean foundNext;

 

     public LSMRTreeAbstractCursor() {

diff --git a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeCursorInitialState.java b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeCursorInitialState.java
index ab62c0e..4f98557 100644
--- a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeCursorInitialState.java
+++ b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeCursorInitialState.java
@@ -23,7 +23,7 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexAccessor;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
-import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMHarness;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
 public class LSMRTreeCursorInitialState implements ICursorInitialState {
@@ -38,7 +38,7 @@
     private ITreeIndexAccessor[] bTreeAccessors;
     private AtomicInteger searcherRefCount;
     private final boolean includeMemRTree;
-    private final LSMHarness lsmHarness;
+    private final ILSMHarness lsmHarness;
     private final int[] comparatorFields;
 
     private ISearchOperationCallback searchCallback;
@@ -46,7 +46,7 @@
     public LSMRTreeCursorInitialState(int numberOfTrees, ITreeIndexFrameFactory rtreeLeafFrameFactory,
             ITreeIndexFrameFactory rtreeInteriorFrameFactory, ITreeIndexFrameFactory btreeLeafFrameFactory,
             MultiComparator btreeCmp, ITreeIndexAccessor[] rTreeAccessors, ITreeIndexAccessor[] bTreeAccessors,
-            AtomicInteger searcherRefCount, boolean includeMemRTree, LSMHarness lsmHarness, int[] comparatorFields,
+            AtomicInteger searcherRefCount, boolean includeMemRTree, ILSMHarness lsmHarness, int[] comparatorFields,
             IBinaryComparatorFactory[] linearizerArray, ISearchOperationCallback searchCallback) {
         this.numberOfTrees = numberOfTrees;
         this.rtreeLeafFrameFactory = rtreeLeafFrameFactory;
@@ -116,7 +116,7 @@
         return searcherRefCount;
     }
 
-    public LSMHarness getLSMHarness() {
+    public ILSMHarness getLSMHarness() {
         return lsmHarness;
     }
 
diff --git a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuples.java b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuples.java
index e693159..1d66eb4 100644
--- a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuples.java
+++ b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuples.java
@@ -45,6 +45,7 @@
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.IInMemoryBufferCache;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMFlushController;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperation;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallback;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
@@ -52,7 +53,6 @@
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMMergePolicy;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMOperationTracker;
 import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMFlushOperation;
-import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMHarness;
 import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMMergeOperation;
 import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMTreeIndexAccessor;
 import edu.uci.ics.hyracks.storage.am.lsm.common.impls.TreeIndexComponentFinalizer;
@@ -65,7 +65,7 @@
 
 public class LSMRTreeWithAntiMatterTuples extends AbstractLSMRTree {
 
-    private TreeTupleSorter bTreeTupleSorter = null;
+    private TreeTupleSorter bTreeTupleSorter;
 
     // On-disk components.
     // For creating RTree's used in bulk load. Different from diskRTreeFactory
@@ -86,7 +86,7 @@
                 new TreeIndexComponentFinalizer(diskFileMapProvider), fieldCount, rtreeCmpFactories, btreeCmpFactories,
                 linearizer, comparatorFields, linearizerArray, flushController, mergePolicy, opTracker, ioScheduler);
         this.bulkLoadRTreeFactory = bulkLoadRTreeFactory;
-
+        this.bTreeTupleSorter = null;
     }
 
     @Override
@@ -309,7 +309,7 @@
     }
 
     public class LSMRTreeWithAntiMatterTuplesAccessor extends LSMTreeIndexAccessor {
-        public LSMRTreeWithAntiMatterTuplesAccessor(LSMHarness lsmHarness, IIndexOperationContext ctx) {
+        public LSMRTreeWithAntiMatterTuplesAccessor(ILSMHarness lsmHarness, IIndexOperationContext ctx) {
             super(lsmHarness, ctx);
         }
 
diff --git a/hyracks-tests/hyracks-storage-am-lsm-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsm/btree/multithread/LSMBTreeTestWorker.java b/hyracks-tests/hyracks-storage-am-lsm-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsm/btree/multithread/LSMBTreeTestWorker.java
index 6ede40f..2dc3d6f 100644
--- a/hyracks-tests/hyracks-storage-am-lsm-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsm/btree/multithread/LSMBTreeTestWorker.java
+++ b/hyracks-tests/hyracks-storage-am-lsm-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsm/btree/multithread/LSMBTreeTestWorker.java
@@ -32,7 +32,7 @@
 import edu.uci.ics.hyracks.storage.am.common.datagen.DataGenThread;
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
 import edu.uci.ics.hyracks.storage.am.lsm.btree.impls.LSMBTree;
-import edu.uci.ics.hyracks.storage.am.lsm.btree.impls.LSMBTree.LSMBTreeIndexAccessor;
+import edu.uci.ics.hyracks.storage.am.lsm.btree.impls.LSMBTree.LSMBTreeAccessor;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperation;
 import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMMergeInProgressException;
 import edu.uci.ics.hyracks.storage.am.lsm.common.impls.NoOpIOOperationCallback;
@@ -53,7 +53,7 @@
 
     @Override
     public void performOp(ITupleReference tuple, TestOperation op) throws HyracksDataException, IndexException {
-        LSMBTreeIndexAccessor accessor = (LSMBTreeIndexAccessor) indexAccessor;
+        LSMBTreeAccessor accessor = (LSMBTreeAccessor) indexAccessor;
         IIndexCursor searchCursor = accessor.createSearchCursor();
         MultiComparator cmp = accessor.getMultiComparator();
         RangePredicate rangePred = new RangePredicate(tuple, tuple, true, true, cmp, cmp);