http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyDiskComponent.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyDiskComponent.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyDiskComponent.java
index 3845740..57b9092 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyDiskComponent.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyDiskComponent.java
@@ -21,22 +21,26 @@ package org.apache.hyracks.storage.am.lsm.btree.impls;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilter;
 import org.apache.hyracks.storage.am.btree.impls.BTree;
-import org.apache.hyracks.storage.am.lsm.common.impls.AbstractDiskLSMComponent;
+import org.apache.hyracks.storage.am.common.api.IMetadataPageManager;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilter;
+import org.apache.hyracks.storage.am.lsm.common.impls.AbstractLSMDiskComponent;
 
-public class LSMBTreeWithBuddyDiskComponent extends AbstractDiskLSMComponent {
+public class LSMBTreeWithBuddyDiskComponent extends AbstractLSMDiskComponent {
 
     private final BTree btree;
     private final BTree buddyBtree;
     private final BloomFilter bloomFilter;
 
-    public LSMBTreeWithBuddyDiskComponent(BTree btree, BTree buddyBtree, 
BloomFilter bloomFilter) {
+    public LSMBTreeWithBuddyDiskComponent(BTree btree, BTree buddyBtree, 
BloomFilter bloomFilter,
+            ILSMComponentFilter filter) {
+        super((IMetadataPageManager) btree.getPageManager(), filter);
         this.btree = btree;
         this.buddyBtree = buddyBtree;
         this.bloomFilter = bloomFilter;
     }
 
     @Override
-    protected void destroy() throws HyracksDataException {
+    public void destroy() throws HyracksDataException {
         btree.deactivate();
         btree.destroy();
         buddyBtree.deactivate();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyDiskComponentFactory.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyDiskComponentFactory.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyDiskComponentFactory.java
index bddea2a..4223954 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyDiskComponentFactory.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyDiskComponentFactory.java
@@ -21,45 +21,27 @@ package org.apache.hyracks.storage.am.lsm.btree.impls;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilterFactory;
 import org.apache.hyracks.storage.am.btree.impls.BTree;
-import org.apache.hyracks.storage.am.common.api.IndexException;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFactory;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponentFactory;
 import 
org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFileReferences;
 import org.apache.hyracks.storage.am.lsm.common.impls.TreeIndexFactory;
-import org.apache.hyracks.storage.common.buffercache.IBufferCache;
 
-public class LSMBTreeWithBuddyDiskComponentFactory implements
-        ILSMComponentFactory {
+public class LSMBTreeWithBuddyDiskComponentFactory implements 
ILSMDiskComponentFactory {
 
     private final TreeIndexFactory<BTree> btreeFactory;
     private final TreeIndexFactory<BTree> buddyBtreeFactory;
     private final BloomFilterFactory bloomFilterFactory;
 
-    public LSMBTreeWithBuddyDiskComponentFactory(
-            TreeIndexFactory<BTree> btreeFactory,
-            TreeIndexFactory<BTree> buddyBtreeFactory,
-            BloomFilterFactory bloomFilterFactory) {
+    public LSMBTreeWithBuddyDiskComponentFactory(TreeIndexFactory<BTree> 
btreeFactory,
+            TreeIndexFactory<BTree> buddyBtreeFactory, BloomFilterFactory 
bloomFilterFactory) {
         this.btreeFactory = btreeFactory;
         this.buddyBtreeFactory = buddyBtreeFactory;
         this.bloomFilterFactory = bloomFilterFactory;
     }
 
     @Override
-    public ILSMComponent createLSMComponentInstance(
-            LSMComponentFileReferences cfr) throws IndexException,
-            HyracksDataException {
-        return new LSMBTreeWithBuddyDiskComponent(
-                btreeFactory.createIndexInstance(cfr
-                        .getInsertIndexFileReference()),
-                buddyBtreeFactory.createIndexInstance(cfr
-                        .getDeleteIndexFileReference()),
-                bloomFilterFactory.createBloomFiltertInstance(cfr
-                        .getBloomFilterFileReference()));
+    public LSMBTreeWithBuddyDiskComponent 
createComponent(LSMComponentFileReferences cfr) throws HyracksDataException {
+        return new 
LSMBTreeWithBuddyDiskComponent(btreeFactory.createIndexInstance(cfr.getInsertIndexFileReference()),
+                
buddyBtreeFactory.createIndexInstance(cfr.getDeleteIndexFileReference()),
+                
bloomFilterFactory.createBloomFiltertInstance(cfr.getBloomFilterFileReference()),
 null);
     }
-
-    @Override
-    public IBufferCache getBufferCache() {
-        return btreeFactory.getBufferCache();
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyMemoryComponent.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyMemoryComponent.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyMemoryComponent.java
index a45cbf1..f58c737 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyMemoryComponent.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyMemoryComponent.java
@@ -20,21 +20,21 @@ package org.apache.hyracks.storage.am.lsm.btree.impls;
 
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.storage.am.btree.impls.BTree;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilter;
 import org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache;
-import 
org.apache.hyracks.storage.am.lsm.common.impls.AbstractMemoryLSMComponent;
+import 
org.apache.hyracks.storage.am.lsm.common.impls.AbstractLSMMemoryComponent;
 
 /*
  * This class is also not needed at the moment but is implemented anyway
  */
-public class LSMBTreeWithBuddyMemoryComponent extends
-        AbstractMemoryLSMComponent {
+public class LSMBTreeWithBuddyMemoryComponent extends 
AbstractLSMMemoryComponent {
 
     private final BTree btree;
     private final BTree buddyBtree;
 
-    public LSMBTreeWithBuddyMemoryComponent(BTree btree, BTree buddyBtree,
-            IVirtualBufferCache vbc, boolean isActive) {
-        super(vbc, isActive);
+    public LSMBTreeWithBuddyMemoryComponent(BTree btree, BTree buddyBtree, 
IVirtualBufferCache vbc, boolean isActive,
+            ILSMComponentFilter filter) {
+        super(vbc, isActive, filter);
         this.btree = btree;
         this.buddyBtree = buddyBtree;
     }
@@ -48,7 +48,7 @@ public class LSMBTreeWithBuddyMemoryComponent extends
     }
 
     @Override
-    protected void reset() throws HyracksDataException {
+    public void reset() throws HyracksDataException {
         super.reset();
         btree.deactivate();
         btree.destroy();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyMergeOperation.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyMergeOperation.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyMergeOperation.java
index d70bdd5..2810b62 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyMergeOperation.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeWithBuddyMergeOperation.java
@@ -30,11 +30,11 @@ import 
org.apache.hyracks.storage.am.common.api.IndexException;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperation;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallback;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndexAccessorInternal;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndexAccessor;
 
 public class LSMBTreeWithBuddyMergeOperation implements ILSMIOOperation {
 
-    private final ILSMIndexAccessorInternal accessor;
+    private final ILSMIndexAccessor accessor;
     private final List<ILSMComponent> mergingComponents;
     private final ITreeIndexCursor cursor;
     private final FileReference btreeMergeTarget;
@@ -44,12 +44,10 @@ public class LSMBTreeWithBuddyMergeOperation implements 
ILSMIOOperation {
     private final String indexIdentifier;
     private final boolean keepDeletedTuples;
 
-    public LSMBTreeWithBuddyMergeOperation(ILSMIndexAccessorInternal accessor,
-            List<ILSMComponent> mergingComponents, ITreeIndexCursor cursor,
-            FileReference btreeMergeTarget,
-            FileReference buddyBtreeMergeTarget,
-            FileReference bloomFilterMergeTarget,
-            ILSMIOOperationCallback callback, String indexIdentifier, boolean 
keepDeletedTuples) {
+    public LSMBTreeWithBuddyMergeOperation(ILSMIndexAccessor accessor, 
List<ILSMComponent> mergingComponents,
+            ITreeIndexCursor cursor, FileReference btreeMergeTarget, 
FileReference buddyBtreeMergeTarget,
+            FileReference bloomFilterMergeTarget, ILSMIOOperationCallback 
callback, String indexIdentifier,
+            boolean keepDeletedTuples) {
         this.accessor = accessor;
         this.mergingComponents = mergingComponents;
         this.cursor = cursor;
@@ -63,15 +61,13 @@ public class LSMBTreeWithBuddyMergeOperation implements 
ILSMIOOperation {
 
     @Override
     public Set<IODeviceHandle> getReadDevices() {
-        Set<IODeviceHandle> devs = new HashSet<IODeviceHandle>();
+        Set<IODeviceHandle> devs = new HashSet<>();
         for (ILSMComponent o : mergingComponents) {
             LSMBTreeWithBuddyDiskComponent component = 
(LSMBTreeWithBuddyDiskComponent) o;
             
devs.add(component.getBTree().getFileReference().getDeviceHandle());
 
-            devs.add(component.getBuddyBTree().getFileReference()
-                    .getDeviceHandle());
-            devs.add(component.getBloomFilter().getFileReference()
-                    .getDeviceHandle());
+            
devs.add(component.getBuddyBTree().getFileReference().getDeviceHandle());
+            
devs.add(component.getBloomFilter().getFileReference().getDeviceHandle());
 
         }
         return devs;
@@ -79,7 +75,7 @@ public class LSMBTreeWithBuddyMergeOperation implements 
ILSMIOOperation {
 
     @Override
     public Set<IODeviceHandle> getWriteDevices() {
-        Set<IODeviceHandle> devs = new HashSet<IODeviceHandle>();
+        Set<IODeviceHandle> devs = new HashSet<>();
         devs.add(btreeMergeTarget.getDeviceHandle());
 
         devs.add(buddyBtreeMergeTarget.getDeviceHandle());

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/pom.xml
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/pom.xml 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/pom.xml
index 8ab7235..ebfb6bd 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/pom.xml
@@ -76,5 +76,9 @@
       <artifactId>hyracks-data-std</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+    </dependency>
   </dependencies>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IComponentMetadata.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IComponentMetadata.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IComponentMetadata.java
new file mode 100644
index 0000000..5dee557
--- /dev/null
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IComponentMetadata.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hyracks.storage.am.lsm.common.api;
+
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.api.IValueReference;
+
+public interface IComponentMetadata {
+
+    /**
+     * Put the key value pair in this metadata, overwrite if it exists
+     *
+     * @param key
+     * @param value
+     * @throws HyracksDataException
+     *             if the component is immutable
+     */
+    void put(IValueReference key, IValueReference value) throws 
HyracksDataException;
+
+    /**
+     * Get the value of the key from the metadata, 0 length value if not exists
+     *
+     * @param key
+     * @param value
+     * @throws HyracksDataException
+     */
+    void get(IValueReference key, IPointable value) throws 
HyracksDataException;
+
+    /**
+     * Get the value
+     *
+     * @param key
+     * @return
+     * @throws HyracksDataException
+     */
+    IValueReference get(IValueReference key) throws HyracksDataException;
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponent.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponent.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponent.java
index a888dd5..a446f4e 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponent.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponent.java
@@ -20,34 +20,105 @@ package org.apache.hyracks.storage.am.lsm.common.api;
 
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 
+/**
+ * An LSM index component. can be an in memory or on disk. Can be readable or 
unreadable, writable or unwritable
+ */
 public interface ILSMComponent {
 
+    /**
+     * Memory or Disk
+     */
     enum LSMComponentType {
+        /**
+         * Memory component
+         */
         MEMORY,
+        /**
+         * Disk component
+         */
         DISK
     }
 
+    /**
+     * The state of a component
+     */
     enum ComponentState {
+        /**
+         * The component is inactive (Unreadable and Unwritable). Can be 
activated
+         */
         INACTIVE,
+        /**
+         * The component can be read from and can be written to
+         */
         READABLE_WRITABLE,
+        /**
+         * Immutable component that can be read from but not written to
+         */
         READABLE_UNWRITABLE,
+        /**
+         * A component that is being flushed. Can be read from but not written 
to
+         */
         READABLE_UNWRITABLE_FLUSHING,
+        /**
+         * A component that has completed flushing but still has some readers 
inside
+         * This is equivalent to a DEACTIVATING state
+         */
         UNREADABLE_UNWRITABLE,
+        /**
+         * An immutable component that is being merged
+         */
         READABLE_MERGING
     }
 
-    public boolean threadEnter(LSMOperationType opType, boolean 
isMutableComponent) throws HyracksDataException;
+    /**
+     * Enter the component
+     *
+     * @param opType
+     *            the operation over the whole LSM index
+     * @param isMutableComponent
+     *            true if the thread intends to modify this component (write 
access), false otherwise
+     * @return
+     *         true if the thread entered the component, false otherwise
+     * @throws HyracksDataException
+     *             if the attempted operation is not allowed on the component
+     */
+    boolean threadEnter(LSMOperationType opType, boolean isMutableComponent) 
throws HyracksDataException;
 
-    public void threadExit(LSMOperationType opType, boolean failedOperation, 
boolean isMutableComponent)
+    /**
+     * Exit the component
+     *
+     * @param opType
+     *            the operation over the whole LSM index under which the 
thread is running
+     * @param failedOperation
+     *            whether the operation failed
+     * @param isMutableComponent
+     *            true if the thread intended to modify the component
+     * @throws HyracksDataException
+     */
+    void threadExit(LSMOperationType opType, boolean failedOperation, boolean 
isMutableComponent)
             throws HyracksDataException;
 
-    public LSMComponentType getType();
-
-    public ComponentState getState();
+    /**
+     * @return the component type (memory vs, disk)
+     */
+    LSMComponentType getType();
 
-    public ILSMComponentFilter getLSMComponentFilter();
+    /**
+     * @return the component state
+     */
+    ComponentState getState();
 
-    public void setMostRecentMarkerLSN(long lsn);
+    /**
+     * @return the metadata associated with the component
+     */
+    IComponentMetadata getMetadata();
 
-    public long getMostRecentMarkerLSN();
+    /**
+     * Note: the component filter is a special case of component metadata in 
the sense that it is
+     * strongly connected with the index and is used by the index logic when 
doing read and write operations
+     * hence, we're leaving this call here
+     *
+     * @return the component filter
+     */
+    ILSMComponentFilter getLSMComponentFilter();
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFactory.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFactory.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFactory.java
deleted file mode 100644
index 7906082..0000000
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hyracks.storage.am.lsm.common.api;
-
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.storage.am.common.api.IndexException;
-import 
org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFileReferences;
-import org.apache.hyracks.storage.common.buffercache.IBufferCache;
-
-public interface ILSMComponentFactory {
-    public ILSMComponent createLSMComponentInstance(LSMComponentFileReferences 
cfr) throws IndexException,
-            HyracksDataException;
-
-    public IBufferCache getBufferCache();
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilter.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilter.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilter.java
index 0bfa466..1bb20c5 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilter.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilter.java
@@ -25,16 +25,15 @@ import 
org.apache.hyracks.storage.am.common.ophelpers.MultiComparator;
 
 public interface ILSMComponentFilter {
 
-    public void update(ITupleReference tuple, MultiComparator cmp) throws 
HyracksDataException;
+    void update(ITupleReference tuple, MultiComparator cmp) throws 
HyracksDataException;
 
-    public boolean satisfy(ITupleReference minTuple, ITupleReference maxTuple, 
MultiComparator filterCmp)
-            throws HyracksDataException;
+    boolean satisfy(ITupleReference min, ITupleReference max, MultiComparator 
cmp) throws HyracksDataException;
 
-    public ITupleReference getMinTuple();
+    ITupleReference getMinTuple();
 
-    public ITupleReference getMaxTuple();
+    ITupleReference getMaxTuple();
 
-    public IBinaryComparatorFactory[] getFilterCmpFactories();
+    IBinaryComparatorFactory[] getFilterCmpFactories();
 
-    public void reset();
+    void reset();
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFactory.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFactory.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFactory.java
index 1fa2175..64562bd 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFactory.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFactory.java
@@ -18,7 +18,8 @@
  */
 package org.apache.hyracks.storage.am.lsm.common.api;
 
+@FunctionalInterface
 public interface ILSMComponentFilterFactory {
-    public ILSMComponentFilter createLSMComponentFilter();
+    ILSMComponentFilter createFilter();
 
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFrameFactory.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFrameFactory.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFrameFactory.java
index 1c853c8..17eb51e 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFrameFactory.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFrameFactory.java
@@ -18,6 +18,7 @@
  */
 package org.apache.hyracks.storage.am.lsm.common.api;
 
+@FunctionalInterface
 public interface ILSMComponentFilterFrameFactory {
-    public ILSMComponentFilterReference createFrame();
+    ILSMComponentFilterReference createFrame();
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterManager.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterManager.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterManager.java
index 12cafef..f310b4e 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterManager.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterManager.java
@@ -26,12 +26,10 @@ import org.apache.hyracks.storage.am.common.api.ITreeIndex;
 
 public interface ILSMComponentFilterManager {
 
-    public void updateFilterInfo(ILSMComponentFilter filter, 
List<ITupleReference> filterTuples)
-            throws HyracksDataException;
+    void updateFilter(ILSMComponentFilter filter, List<ITupleReference> 
filterTuples) throws HyracksDataException;
 
-    public boolean readFilterInfo(ILSMComponentFilter filter, ITreeIndex 
treeIndex) throws HyracksDataException;
+    boolean readFilter(ILSMComponentFilter filter, ITreeIndex index) throws 
HyracksDataException;
 
-    public void writeFilterInfo(ILSMComponentFilter filter, ITreeIndex 
treeIndex)
-            throws HyracksDataException;
+    void writeFilter(ILSMComponentFilter filter, ITreeIndex index) throws 
HyracksDataException;
 
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMDiskComponent.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMDiskComponent.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMDiskComponent.java
new file mode 100644
index 0000000..335e84e
--- /dev/null
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMDiskComponent.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hyracks.storage.am.lsm.common.api;
+
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.storage.am.lsm.common.impls.DiskComponentMetadata;
+
+public interface ILSMDiskComponent extends ILSMComponent {
+    @Override
+    default LSMComponentType getType() {
+        return LSMComponentType.DISK;
+    }
+
+    @Override
+    DiskComponentMetadata getMetadata();
+
+    /**
+     * @return the on disk size of this component
+     */
+    long getComponentSize();
+
+    /**
+     * @return the reference count for the component
+     */
+    int getFileReferenceCount();
+
+    /**
+     * Delete the component from disk
+     *
+     * @throws HyracksDataException
+     */
+    void destroy() throws HyracksDataException;
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMDiskComponentFactory.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMDiskComponentFactory.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMDiskComponentFactory.java
new file mode 100644
index 0000000..9daf30b
--- /dev/null
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMDiskComponentFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hyracks.storage.am.lsm.common.api;
+
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import 
org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFileReferences;
+
+@FunctionalInterface
+public interface ILSMDiskComponentFactory {
+
+    /**
+     * Create a disk component from the file references
+     *
+     * @param cfr
+     *            the disk file references which points to the different 
physical files of the index
+     * @return a disk component
+     * @throws HyracksDataException
+     */
+    ILSMDiskComponent createComponent(LSMComponentFileReferences cfr) throws 
HyracksDataException;
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMHarness.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMHarness.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMHarness.java
index 4c4ed28..7a2bc7c 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMHarness.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMHarness.java
@@ -28,38 +28,34 @@ import 
org.apache.hyracks.storage.am.common.api.IndexException;
 
 public interface ILSMHarness {
 
-    public void forceModify(ILSMIndexOperationContext ctx, ITupleReference 
tuple)
-            throws HyracksDataException, IndexException;
+    void forceModify(ILSMIndexOperationContext ctx, ITupleReference tuple) 
throws HyracksDataException, IndexException;
 
-    public boolean modify(ILSMIndexOperationContext ctx, boolean tryOperation, 
ITupleReference tuple)
+    boolean modify(ILSMIndexOperationContext ctx, boolean tryOperation, 
ITupleReference tuple)
             throws HyracksDataException, IndexException;
 
-    public void search(ILSMIndexOperationContext ctx, IIndexCursor cursor, 
ISearchPredicate pred)
+    void search(ILSMIndexOperationContext ctx, IIndexCursor cursor, 
ISearchPredicate pred)
             throws HyracksDataException, IndexException;
 
-    public void endSearch(ILSMIndexOperationContext ctx) throws 
HyracksDataException;
+    void endSearch(ILSMIndexOperationContext ctx) throws HyracksDataException;
 
-    public void scheduleMerge(ILSMIndexOperationContext ctx, 
ILSMIOOperationCallback callback)
+    void scheduleMerge(ILSMIndexOperationContext ctx, ILSMIOOperationCallback 
callback)
             throws HyracksDataException, IndexException;
 
-    public void scheduleFullMerge(ILSMIndexOperationContext ctx, 
ILSMIOOperationCallback callback)
+    void scheduleFullMerge(ILSMIndexOperationContext ctx, 
ILSMIOOperationCallback callback)
             throws HyracksDataException, IndexException;
 
-    public void merge(ILSMIndexOperationContext ctx, ILSMIOOperation operation)
-            throws HyracksDataException, IndexException;
+    void merge(ILSMIndexOperationContext ctx, ILSMIOOperation operation) 
throws HyracksDataException, IndexException;
 
-    public void scheduleFlush(ILSMIndexOperationContext ctx, 
ILSMIOOperationCallback callback)
-            throws HyracksDataException;
+    void scheduleFlush(ILSMIndexOperationContext ctx, ILSMIOOperationCallback 
callback) throws HyracksDataException;
 
-    public void flush(ILSMIndexOperationContext ctx, ILSMIOOperation operation)
-            throws HyracksDataException, IndexException;
+    void flush(ILSMIndexOperationContext ctx, ILSMIOOperation operation) 
throws HyracksDataException, IndexException;
 
-    public void addBulkLoadedComponent(ILSMComponent index) throws 
HyracksDataException, IndexException;
+    void addBulkLoadedComponent(ILSMDiskComponent index) throws 
HyracksDataException, IndexException;
 
-    public ILSMOperationTracker getOperationTracker();
+    ILSMOperationTracker getOperationTracker();
 
-    public void scheduleReplication(ILSMIndexOperationContext ctx, 
List<ILSMComponent> lsmComponents, boolean bulkload,
+    void scheduleReplication(ILSMIndexOperationContext ctx, 
List<ILSMDiskComponent> diskComponents, boolean bulkload,
             LSMOperationType opType) throws HyracksDataException;
 
-    public void endReplication(ILSMIndexOperationContext ctx) throws 
HyracksDataException;
+    void endReplication(ILSMIndexOperationContext ctx) throws 
HyracksDataException;
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperation.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperation.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperation.java
index 0743e4a..d768122 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperation.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperation.java
@@ -27,20 +27,21 @@ import 
org.apache.hyracks.storage.am.common.api.IndexException;
 
 public interface ILSMIOOperation extends Callable<Boolean> {
 
-    public enum LSMIOOpertionType {
+    enum LSMIOOpertionType {
         FLUSH,
         MERGE
     }
 
-    public Set<IODeviceHandle> getReadDevices();
+    Set<IODeviceHandle> getReadDevices();
 
-    public Set<IODeviceHandle> getWriteDevices();
+    Set<IODeviceHandle> getWriteDevices();
 
-    public Boolean call() throws HyracksDataException, IndexException;
+    @Override
+    Boolean call() throws HyracksDataException, IndexException;
 
-    public ILSMIOOperationCallback getCallback();
+    ILSMIOOperationCallback getCallback();
 
-    public String getIndexUniqueIdentifier();
+    String getIndexUniqueIdentifier();
 
-    public LSMIOOpertionType getIOOpertionType();
+    LSMIOOpertionType getIOOpertionType();
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallback.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallback.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallback.java
index 6315124..7cfd268 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallback.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallback.java
@@ -25,20 +25,23 @@ import 
org.apache.hyracks.api.exceptions.HyracksDataException;
 public interface ILSMIOOperationCallback {
 
     /**
-     * This method is called on an IO operation sometime before the operation 
is executed.
+     * This method is called on an IO operation before the operation starts.
      * (i.e. IO operations could be flush or merge operations.)
      */
-    public void beforeOperation(LSMOperationType opType) throws 
HyracksDataException;
+    void beforeOperation(LSMOperationType opType) throws HyracksDataException;
 
     /**
      * This method is called on an IO operation sometime after the operation 
was completed.
      * (i.e. IO operations could be flush or merge operations.)
      *
+     * Copying content of metadata page from memory component to disk 
component should be done in this call
+     * Merging content of metadata pages from disk components to new disk 
component should be done in this call
+     *
      * @param oldComponents
      * @param newComponent
      * @throws HyracksDataException
      */
-    public void afterOperation(LSMOperationType opType, List<ILSMComponent> 
oldComponents, ILSMComponent newComponent)
+    void afterOperation(LSMOperationType opType, List<ILSMComponent> 
oldComponents, ILSMDiskComponent newComponent)
             throws HyracksDataException;
 
     /**
@@ -49,7 +52,7 @@ public interface ILSMIOOperationCallback {
      * @param newComponent
      * @throws HyracksDataException
      */
-    public void afterFinalize(LSMOperationType opType, ILSMComponent 
newComponent) throws HyracksDataException;
+    void afterFinalize(LSMOperationType opType, ILSMDiskComponent 
newComponent) throws HyracksDataException;
 
-    public void setNumOfMutableComponents(int count);
+    void setNumOfMutableComponents(int count);
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallbackFactory.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallbackFactory.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallbackFactory.java
index c91fa8b..ef76415 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallbackFactory.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallbackFactory.java
@@ -22,5 +22,5 @@ import java.io.Serializable;
 
 @FunctionalInterface
 public interface ILSMIOOperationCallbackFactory extends Serializable {
-    ILSMIOOperationCallback createIOOperationCallback();
+    ILSMIOOperationCallback createIoOpCallback();
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallbackProvider.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallbackProvider.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallbackProvider.java
index 684be6d..11ff0bf 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallbackProvider.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIOOperationCallbackProvider.java
@@ -18,6 +18,7 @@
  */
 package org.apache.hyracks.storage.am.lsm.common.api;
 
+@FunctionalInterface
 public interface ILSMIOOperationCallbackProvider {
-    public ILSMIOOperationCallback getIOOperationCallback(ILSMIndex index);
+    ILSMIOOperationCallback getIOOperationCallback(ILSMIndex index);
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndex.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndex.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndex.java
index 11b933d..234006f 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndex.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndex.java
@@ -22,9 +22,15 @@ package org.apache.hyracks.storage.am.lsm.common.api;
 import java.util.List;
 
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.replication.IReplicationJob.ReplicationOperation;
+import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
 import org.apache.hyracks.storage.am.common.api.IIndex;
+import org.apache.hyracks.storage.am.common.api.IIndexCursor;
+import org.apache.hyracks.storage.am.common.api.IIndexOperationContext;
 import org.apache.hyracks.storage.am.common.api.IModificationOperationCallback;
 import org.apache.hyracks.storage.am.common.api.ISearchOperationCallback;
+import org.apache.hyracks.storage.am.common.api.ISearchPredicate;
+import org.apache.hyracks.storage.am.common.api.IndexException;
 import org.apache.hyracks.storage.am.lsm.common.impls.LSMHarness;
 
 /**
@@ -37,24 +43,94 @@ import 
org.apache.hyracks.storage.am.lsm.common.impls.LSMHarness;
  */
 public interface ILSMIndex extends IIndex {
 
-    public void deactivate(boolean flushOnExit) throws HyracksDataException;
+    void deactivate(boolean flushOnExit) throws HyracksDataException;
 
     @Override
-    public ILSMIndexAccessor createAccessor(IModificationOperationCallback 
modificationCallback,
+    ILSMIndexAccessor createAccessor(IModificationOperationCallback 
modificationCallback,
             ISearchOperationCallback searchCallback) throws 
HyracksDataException;
 
-    public ILSMOperationTracker getOperationTracker();
+    ILSMOperationTracker getOperationTracker();
 
-    public ILSMIOOperationScheduler getIOScheduler();
+    ILSMIOOperationScheduler getIOScheduler();
 
-    public ILSMIOOperationCallback getIOOperationCallback();
+    ILSMIOOperationCallback getIOOperationCallback();
 
-    public List<ILSMComponent> getImmutableComponents();
+    /**
+     * components with lower indexes are newer than components with higher 
index
+     */
+    List<ILSMDiskComponent> getImmutableComponents();
+
+    boolean isPrimaryIndex();
+
+    void modify(IIndexOperationContext ictx, ITupleReference tuple) throws 
HyracksDataException, IndexException;
+
+    void search(ILSMIndexOperationContext ictx, IIndexCursor cursor, 
ISearchPredicate pred)
+            throws HyracksDataException, IndexException;
+
+    void scheduleFlush(ILSMIndexOperationContext ctx, ILSMIOOperationCallback 
callback) throws HyracksDataException;
+
+    ILSMDiskComponent flush(ILSMIOOperation operation) throws 
HyracksDataException, IndexException;
+
+    void scheduleMerge(ILSMIndexOperationContext ctx, ILSMIOOperationCallback 
callback)
+            throws HyracksDataException, IndexException;
+
+    ILSMDiskComponent merge(ILSMIOOperation operation) throws 
HyracksDataException, IndexException;
+
+    void addDiskComponent(ILSMDiskComponent index) throws HyracksDataException;
+
+    void subsumeMergedComponents(ILSMDiskComponent newComponent, 
List<ILSMComponent> mergedComponents)
+            throws HyracksDataException;
+
+    void changeMutableComponent();
+
+    void changeFlushStatusForCurrentMutableCompoent(boolean needsFlush);
+
+    boolean hasFlushRequestForCurrentMutableComponent();
+
+    /**
+     * Populates the context's component holder with a snapshot of the 
components involved in the operation.
+     *
+     * @param ctx
+     *            - the operation's context
+     * @throws HyracksDataException
+     */
+    void getOperationalComponents(ILSMIndexOperationContext ctx) throws 
HyracksDataException;
+
+    List<ILSMDiskComponent> getInactiveDiskComponents();
+
+    void addInactiveDiskComponent(ILSMDiskComponent diskComponent);
+
+    /**
+     * Persist the LSM component
+     *
+     * @param lsmComponent
+     *            , the component to be persistent
+     * @throws HyracksDataException
+     */
+    void markAsValid(ILSMDiskComponent lsmComponent) throws 
HyracksDataException;
+
+    boolean isCurrentMutableComponentEmpty() throws HyracksDataException;
+
+    void scheduleReplication(ILSMIndexOperationContext ctx, 
List<ILSMDiskComponent> diskComponents, boolean bulkload,
+            ReplicationOperation operation, LSMOperationType opType) throws 
HyracksDataException;
+
+    boolean isMemoryComponentsAllocated();
+
+    /**
+     * Allocates the memory components of an LSM index in the buffer cache.
+     *
+     * @throws HyracksDataException
+     */
+    void allocateMemoryComponents() throws HyracksDataException;
+
+    ILSMMemoryComponent getCurrentMemoryComponent();
+
+    int getCurrentMemoryComponentIndex();
 
-    public boolean isPrimaryIndex();
+    List<ILSMMemoryComponent> getMemoryComponents();
 
     /**
      * @return true if the index is durable. Otherwise false.
      */
-    public boolean isDurable();
+    boolean isDurable();
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexAccessor.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexAccessor.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexAccessor.java
index 439a020..fecc674 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexAccessor.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexAccessor.java
@@ -24,6 +24,7 @@ import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
 import org.apache.hyracks.storage.am.common.api.IIndexAccessor;
 import org.apache.hyracks.storage.am.common.api.IndexException;
+import org.apache.hyracks.storage.am.common.api.TreeIndexException;
 
 /**
  * Client handle for performing operations
@@ -33,12 +34,12 @@ import 
org.apache.hyracks.storage.am.common.api.IndexException;
  * concurrent operations).
  */
 public interface ILSMIndexAccessor extends IIndexAccessor {
-    public void scheduleFlush(ILSMIOOperationCallback callback) throws 
HyracksDataException;
+    void scheduleFlush(ILSMIOOperationCallback callback) throws 
HyracksDataException;
 
-    public void scheduleMerge(ILSMIOOperationCallback callback, 
List<ILSMComponent> components)
+    void scheduleMerge(ILSMIOOperationCallback callback, 
List<ILSMDiskComponent> components)
             throws HyracksDataException, IndexException;
 
-    public void scheduleFullMerge(ILSMIOOperationCallback callback) throws 
HyracksDataException, IndexException;
+    void scheduleFullMerge(ILSMIOOperationCallback callback) throws 
HyracksDataException, IndexException;
 
     /**
      * Deletes the tuple from the memory component only.
@@ -46,7 +47,7 @@ public interface ILSMIndexAccessor extends IIndexAccessor {
      * @throws HyracksDataException
      * @throws IndexException
      */
-    public void physicalDelete(ITupleReference tuple) throws 
HyracksDataException, IndexException;
+    void physicalDelete(ITupleReference tuple) throws HyracksDataException, 
IndexException;
 
     /**
      * Attempts to insert the given tuple.
@@ -62,7 +63,7 @@ public interface ILSMIndexAccessor extends IIndexAccessor {
      *             If an index-specific constraint is violated, e.g., the key
      *             already exists.
      */
-    public boolean tryInsert(ITupleReference tuple) throws 
HyracksDataException, IndexException;
+    boolean tryInsert(ITupleReference tuple) throws HyracksDataException, 
IndexException;
 
     /**
      * Attempts to delete the given tuple.
@@ -77,7 +78,7 @@ public interface ILSMIndexAccessor extends IIndexAccessor {
      * @throws IndexException
      *             If there is no matching tuple in the index.
      */
-    public boolean tryDelete(ITupleReference tuple) throws 
HyracksDataException, IndexException;
+    boolean tryDelete(ITupleReference tuple) throws HyracksDataException, 
IndexException;
 
     /**
      * Attempts to update the given tuple.
@@ -93,7 +94,7 @@ public interface ILSMIndexAccessor extends IIndexAccessor {
      * @throws IndexException
      *             If there is no matching tuple in the index.
      */
-    public boolean tryUpdate(ITupleReference tuple) throws 
HyracksDataException, IndexException;
+    boolean tryUpdate(ITupleReference tuple) throws HyracksDataException, 
IndexException;
 
     /**
      * This operation is only supported by indexes with the notion of a unique 
key.
@@ -110,14 +111,30 @@ public interface ILSMIndexAccessor extends IIndexAccessor 
{
      * @throws IndexException
      *             If there is no matching tuple in the index.
      */
-    public boolean tryUpsert(ITupleReference tuple) throws 
HyracksDataException, IndexException;
+    boolean tryUpsert(ITupleReference tuple) throws HyracksDataException, 
IndexException;
 
-    public void forcePhysicalDelete(ITupleReference tuple) throws 
HyracksDataException, IndexException;
+    void forcePhysicalDelete(ITupleReference tuple) throws 
HyracksDataException, IndexException;
 
-    public void forceInsert(ITupleReference tuple) throws 
HyracksDataException, IndexException;
+    void forceInsert(ITupleReference tuple) throws HyracksDataException, 
IndexException;
 
-    public void forceDelete(ITupleReference tuple) throws 
HyracksDataException, IndexException;
+    void forceDelete(ITupleReference tuple) throws HyracksDataException, 
IndexException;
 
-    public void scheduleReplication(List<ILSMComponent> lsmComponents, boolean 
bulkload, LSMOperationType opType)
+    void scheduleReplication(List<ILSMDiskComponent> diskComponents, boolean 
bulkload, LSMOperationType opType)
             throws HyracksDataException;
+
+    /**
+     * Force a flush of the in-memory component.
+     *
+     * @throws HyracksDataException
+     * @throws TreeIndexException
+     */
+    void flush(ILSMIOOperation operation) throws HyracksDataException, 
IndexException;
+
+    /**
+     * Merge all on-disk components.
+     *
+     * @throws HyracksDataException
+     * @throws TreeIndexException
+     */
+    void merge(ILSMIOOperation operation) throws HyracksDataException, 
IndexException;
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexAccessorInternal.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexAccessorInternal.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexAccessorInternal.java
deleted file mode 100644
index 4df1180..0000000
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexAccessorInternal.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hyracks.storage.am.lsm.common.api;
-
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.storage.am.common.api.IndexException;
-import org.apache.hyracks.storage.am.common.api.TreeIndexException;
-
-public interface ILSMIndexAccessorInternal extends ILSMIndexAccessor {
-
-    /**
-     * Force a flush of the in-memory component.
-     *
-     * @throws HyracksDataException
-     * @throws TreeIndexException
-     */
-    public void flush(ILSMIOOperation operation) throws HyracksDataException, 
IndexException;
-
-    /**
-     * Merge all on-disk components.
-     *
-     * @throws HyracksDataException
-     * @throws TreeIndexException
-     */
-    public void merge(ILSMIOOperation operation) throws HyracksDataException, 
IndexException;
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexInternal.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexInternal.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexInternal.java
deleted file mode 100644
index e69c714..0000000
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexInternal.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hyracks.storage.am.lsm.common.api;
-
-import java.util.List;
-
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.api.replication.IReplicationJob.ReplicationOperation;
-import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
-import org.apache.hyracks.storage.am.common.api.IIndexCursor;
-import org.apache.hyracks.storage.am.common.api.IIndexOperationContext;
-import org.apache.hyracks.storage.am.common.api.IModificationOperationCallback;
-import org.apache.hyracks.storage.am.common.api.ISearchOperationCallback;
-import org.apache.hyracks.storage.am.common.api.ISearchPredicate;
-import org.apache.hyracks.storage.am.common.api.IndexException;
-
-public interface ILSMIndexInternal extends ILSMIndex {
-    @Override
-    public ILSMIndexAccessorInternal 
createAccessor(IModificationOperationCallback modificationCallback,
-            ISearchOperationCallback searchCallback) throws 
HyracksDataException;
-
-    public void modify(IIndexOperationContext ictx, ITupleReference tuple) 
throws HyracksDataException, IndexException;
-
-    public void search(ILSMIndexOperationContext ictx, IIndexCursor cursor, 
ISearchPredicate pred)
-            throws HyracksDataException, IndexException;
-
-    public void scheduleFlush(ILSMIndexOperationContext ctx, 
ILSMIOOperationCallback callback)
-            throws HyracksDataException;
-
-    public ILSMComponent flush(ILSMIOOperation operation) throws 
HyracksDataException, IndexException;
-
-    public void scheduleMerge(ILSMIndexOperationContext ctx, 
ILSMIOOperationCallback callback)
-            throws HyracksDataException, IndexException;
-
-    public ILSMComponent merge(ILSMIOOperation operation) throws 
HyracksDataException, IndexException;
-
-    public void addComponent(ILSMComponent index) throws HyracksDataException;
-
-    public void subsumeMergedComponents(ILSMComponent newComponent, 
List<ILSMComponent> mergedComponents)
-            throws HyracksDataException;
-
-    public void changeMutableComponent();
-
-    public void changeFlushStatusForCurrentMutableCompoent(boolean needsFlush);
-
-    public boolean hasFlushRequestForCurrentMutableComponent();
-
-    /**
-     * Populates the context's component holder with a snapshot of the 
components involved in the operation.
-     *
-     * @param ctx
-     *            - the operation's context
-     * @throws HyracksDataException
-     */
-    public void getOperationalComponents(ILSMIndexOperationContext ctx) throws 
HyracksDataException;
-
-    public List<ILSMComponent> getInactiveDiskComponents();
-
-    public void addInactiveDiskComponent(ILSMComponent diskComponent);
-
-    /**
-     * Persist the LSM component
-     *
-     * @param lsmComponent
-     *            , the component to be persistent
-     * @throws HyracksDataException
-     */
-    public void markAsValid(ILSMComponent lsmComponent) throws 
HyracksDataException;
-
-    public boolean isCurrentMutableComponentEmpty() throws 
HyracksDataException;
-
-    public void scheduleReplication(ILSMIndexOperationContext ctx, 
List<ILSMComponent> lsmComponents, boolean bulkload,
-            ReplicationOperation operation, LSMOperationType opType) throws 
HyracksDataException;
-
-    /**
-     * Allocates the memory components of an LSM index in the buffer cache.
-     * @throws HyracksDataException
-     */
-    public void allocateMemoryComponents() throws HyracksDataException;
-
-    public boolean isMemoryComponentsAllocated();
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexOperationContext.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexOperationContext.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexOperationContext.java
index acf2233..9c5701a 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexOperationContext.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMIndexOperationContext.java
@@ -26,26 +26,26 @@ import 
org.apache.hyracks.storage.am.common.api.ISearchOperationCallback;
 import org.apache.hyracks.storage.am.common.api.ISearchPredicate;
 
 public interface ILSMIndexOperationContext extends IIndexOperationContext {
-    public List<ILSMComponent> getComponentHolder();
+    List<ILSMComponent> getComponentHolder();
 
-    public List<ILSMComponent> getComponentsToBeMerged();
+    List<ILSMDiskComponent> getComponentsToBeMerged();
 
-    public ISearchOperationCallback getSearchOperationCallback();
+    ISearchOperationCallback getSearchOperationCallback();
 
-    public IModificationOperationCallback getModificationCallback();
+    IModificationOperationCallback getModificationCallback();
 
-    public void setCurrentMutableComponentId(int currentMutableComponentId);
+    void setCurrentMutableComponentId(int currentMutableComponentId);
 
-    public void setSearchPredicate(ISearchPredicate searchPredicate);
+    void setSearchPredicate(ISearchPredicate searchPredicate);
 
-    public ISearchPredicate getSearchPredicate();
+    ISearchPredicate getSearchPredicate();
 
-    public List<ILSMComponent> getComponentsToBeReplicated();
+    List<ILSMDiskComponent> getComponentsToBeReplicated();
 
     /**
      * @return true if this operation entered the components. Otherwise false.
      */
-    public boolean isAccessingComponents();
+    boolean isAccessingComponents();
 
-    public void setAccessingComponents(boolean accessingComponents);
+    void setAccessingComponents(boolean accessingComponents);
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMemoryComponent.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMemoryComponent.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMemoryComponent.java
new file mode 100644
index 0000000..18121e0
--- /dev/null
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMemoryComponent.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hyracks.storage.am.lsm.common.api;
+
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.storage.am.lsm.common.impls.MemoryComponentMetadata;
+
+public interface ILSMMemoryComponent extends ILSMComponent {
+    @Override
+    default LSMComponentType getType() {
+        return LSMComponentType.MEMORY;
+    }
+
+    @Override
+    MemoryComponentMetadata getMetadata();
+
+    /**
+     * @return true if the component can be entered for reading
+     */
+    boolean isReadable();
+
+    /**
+     * @return the number of writers inside the component
+     */
+    int getWriterCount();
+
+    /**
+     * Clear the component and its metadata page completely
+     *
+     * @throws HyracksDataException
+     */
+    void reset() throws HyracksDataException;
+
+    /**
+     * @return true if the memory budget has been exceeded
+     */
+    boolean isFull();
+
+    /**
+     * @return true if there are data in the memory component, false otherwise
+     */
+    boolean isModified();
+
+    /**
+     * Set the component as modified
+     */
+    void setModified();
+
+    /**
+     * request the component to be active
+     */
+    void activate();
+
+    /**
+     * Set the component state
+     *
+     * @param state
+     *            the new state
+     */
+    void setState(ComponentState state);
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMergePolicy.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMergePolicy.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMergePolicy.java
index c64fe63..c2bd45d 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMergePolicy.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMergePolicy.java
@@ -25,10 +25,9 @@ import 
org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.storage.am.common.api.IndexException;
 
 public interface ILSMMergePolicy {
-    public void diskComponentAdded(ILSMIndex index, boolean 
fullMergeIsRequested)
-            throws HyracksDataException, IndexException;
+    void diskComponentAdded(ILSMIndex index, boolean fullMergeIsRequested) 
throws HyracksDataException, IndexException;
 
-    public void configure(Map<String, String> properties);
+    void configure(Map<String, String> properties);
 
     /**
      * This method is used for flush-operation flow control:
@@ -55,5 +54,5 @@ public interface ILSMMergePolicy {
      * @throws HyracksDataException
      * @throws IndexException
      */
-    public boolean isMergeLagging(ILSMIndex index) throws 
HyracksDataException, IndexException;
+    boolean isMergeLagging(ILSMIndex index) throws HyracksDataException, 
IndexException;
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMergePolicyFactory.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMergePolicyFactory.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMergePolicyFactory.java
index c047777..3e605bd 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMergePolicyFactory.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMMergePolicyFactory.java
@@ -30,11 +30,11 @@ public interface ILSMMergePolicyFactory extends 
Serializable {
     // because we want to have an access to the IIndexLifecycleManager inside 
some of the merge policies. However,
     // in order to get the IIndexLifecycleManager instance, we need to cast to 
IAsterixAppRuntimeContext which exist
     // in asterix and cannot be seen in hyracks. Thus we pass 
IHyracksTaskContext and let the merge policy do the casting.
-    public ILSMMergePolicy createMergePolicy(Map<String, String> 
configuration, IHyracksTaskContext ctx);
+    ILSMMergePolicy createMergePolicy(Map<String, String> configuration, 
IHyracksTaskContext ctx);
 
-    public ILSMMergePolicy createMergePolicy(Map<String, String> 
configuration, IResourceLifecycleManager ilcm);
+    ILSMMergePolicy createMergePolicy(Map<String, String> configuration, 
IResourceLifecycleManager ilcm);
 
-    public String getName();
+    String getName();
 
-    public Set<String> getPropertiesNames();
+    Set<String> getPropertiesNames();
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMOperationTracker.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMOperationTracker.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMOperationTracker.java
index e523f52..d3f33af 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMOperationTracker.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMOperationTracker.java
@@ -27,8 +27,6 @@ import 
org.apache.hyracks.storage.am.common.api.ISearchOperationCallback;
  * This interface exposes methods for tracking and setting the status of 
operations for the purpose
  * of coordinating flushes/merges in {@link ILSMIndex}.
  * Note that 'operation' below refers to {@link IIndexAccessor} methods.
- *
- * @author zheilbron
  */
 public interface ILSMOperationTracker {
 
@@ -39,7 +37,7 @@ public interface ILSMOperationTracker {
      * then this method does not block and returns false.
      * Otherwise, this method returns true, and the operation is considered 
'active' in the index.
      */
-    public void beforeOperation(ILSMIndex index, LSMOperationType opType, 
ISearchOperationCallback searchCallback,
+    void beforeOperation(ILSMIndex index, LSMOperationType opType, 
ISearchOperationCallback searchCallback,
             IModificationOperationCallback modificationCallback) throws 
HyracksDataException;
 
     /**
@@ -48,7 +46,7 @@ public interface ILSMOperationTracker {
      * After this method has been called, the operation is still considered 
'active',
      * until the issuer of the operation declares it completed by calling 
completeOperation().
      */
-    public void afterOperation(ILSMIndex index, LSMOperationType opType, 
ISearchOperationCallback searchCallback,
+    void afterOperation(ILSMIndex index, LSMOperationType opType, 
ISearchOperationCallback searchCallback,
             IModificationOperationCallback modificationCallback) throws 
HyracksDataException;
 
     /**
@@ -56,6 +54,6 @@ public interface ILSMOperationTracker {
      * The use of this method indicates that the operation is no longer 
'active'
      * for the purpose of coordinating flushes/merges.
      */
-    public void completeOperation(ILSMIndex index, LSMOperationType opType, 
ISearchOperationCallback searchCallback,
+    void completeOperation(ILSMIndex index, LSMOperationType opType, 
ISearchOperationCallback searchCallback,
             IModificationOperationCallback modificationCallback) throws 
HyracksDataException;
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ITwoPCIndex.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ITwoPCIndex.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ITwoPCIndex.java
index 95e95e4..65e91b2 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ITwoPCIndex.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ITwoPCIndex.java
@@ -53,22 +53,24 @@ public interface ITwoPCIndex {
     /**
      * This function is used to add the committed disk component to the 
appropriate list and reflect the changes
      */
-    public void commitTransactionDiskComponent(ILSMComponent newComponent) 
throws IndexException, HyracksDataException;
+    public void commitTransactionDiskComponent(ILSMDiskComponent newComponent)
+            throws IndexException, HyracksDataException;
 
     /**
      * This function is used to create a version specific accessor to search a 
specific version
      */
-    public ILSMIndexAccessorInternal createAccessor(ISearchOperationCallback 
searchCallback, int targetIndexVersion) throws HyracksDataException;
+    public ILSMIndexAccessor createAccessor(ISearchOperationCallback 
searchCallback, int targetIndexVersion)
+            throws HyracksDataException;
 
     /**
      * This function is used to get the first components list
      */
-    public List<ILSMComponent> getFirstComponentList();
+    public List<ILSMDiskComponent> getFirstComponentList();
 
     /**
      * This function is used to get teh second components list
      */
-    public List<ILSMComponent> getSecondComponentList();
+    public List<ILSMDiskComponent> getSecondComponentList();
 
     /**
      * This function is used to get the current version id of the index

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IVirtualBufferCache.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IVirtualBufferCache.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IVirtualBufferCache.java
index 09cdb61..ff7bfb5 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IVirtualBufferCache.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IVirtualBufferCache.java
@@ -23,11 +23,11 @@ import 
org.apache.hyracks.storage.common.buffercache.IBufferCache;
 import org.apache.hyracks.storage.common.file.IFileMapManager;
 
 public interface IVirtualBufferCache extends IBufferCache {
-    public void open() throws HyracksDataException;
+    void open() throws HyracksDataException;
 
-    public boolean isFull();
+    boolean isFull();
 
-    public void reset();
+    void reset();
 
-    public IFileMapManager getFileMapProvider();
+    IFileMapManager getFileMapProvider();
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IVirtualBufferCacheProvider.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IVirtualBufferCacheProvider.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IVirtualBufferCacheProvider.java
index ca61075..c1a6887 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IVirtualBufferCacheProvider.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IVirtualBufferCacheProvider.java
@@ -25,7 +25,8 @@ import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.std.file.IFileSplitProvider;
 
+@FunctionalInterface
 public interface IVirtualBufferCacheProvider extends Serializable {
-    public List<IVirtualBufferCache> 
getVirtualBufferCaches(IHyracksTaskContext ctx,
-            IFileSplitProvider fileSplitProvider) throws HyracksDataException;
+    List<IVirtualBufferCache> getVirtualBufferCaches(IHyracksTaskContext ctx, 
IFileSplitProvider fileSplitProvider)
+            throws HyracksDataException;
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractDiskLSMComponent.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractDiskLSMComponent.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractDiskLSMComponent.java
deleted file mode 100644
index 54ec029..0000000
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractDiskLSMComponent.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hyracks.storage.am.lsm.common.impls;
-
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilter;
-import org.apache.hyracks.storage.am.lsm.common.api.LSMOperationType;
-
-public abstract class AbstractDiskLSMComponent extends AbstractLSMComponent {
-
-    public AbstractDiskLSMComponent(ILSMComponentFilter filter) {
-        super(filter);
-        state = ComponentState.READABLE_UNWRITABLE;
-    }
-
-    public AbstractDiskLSMComponent() {
-        this(null);
-    }
-
-    @Override
-    public boolean threadEnter(LSMOperationType opType, boolean 
isMutableComponent) {
-        if (state == ComponentState.INACTIVE) {
-            throw new IllegalStateException("Trying to enter an inactive disk 
component");
-        }
-
-        switch (opType) {
-            case FORCE_MODIFICATION:
-            case MODIFICATION:
-            case REPLICATE:
-            case SEARCH:
-                readerCount++;
-                break;
-            case MERGE:
-                if (state == ComponentState.READABLE_MERGING) {
-                    // This should never happen unless there are two 
concurrent merges that were scheduled
-                    // concurrently and they have interleaving components to 
be merged.
-                    // This should be handled properly by the merge policy, 
but we guard against that here anyway.
-                    return false;
-                }
-                state = ComponentState.READABLE_MERGING;
-                readerCount++;
-                break;
-            default:
-                throw new UnsupportedOperationException("Unsupported operation 
" + opType);
-        }
-        return true;
-    }
-
-    @Override
-    public void threadExit(LSMOperationType opType, boolean failedOperation, 
boolean isMutableComponent)
-            throws HyracksDataException {
-        switch (opType) {
-            case MERGE:
-                // In case two merge operations were scheduled to merge an 
overlapping set of components, the second merge will fail and it must
-                // reset those components back to their previous state.
-                if (failedOperation) {
-                    state = ComponentState.READABLE_UNWRITABLE;
-                }
-            case FORCE_MODIFICATION:
-            case MODIFICATION:
-            case REPLICATE:
-            case SEARCH:
-                readerCount--;
-                if (readerCount == 0 && state == 
ComponentState.READABLE_MERGING) {
-                    state = ComponentState.INACTIVE;
-                }
-                break;
-            default:
-                throw new UnsupportedOperationException("Unsupported operation 
" + opType);
-        }
-
-        if (readerCount <= -1) {
-            throw new IllegalStateException("Invalid LSM disk component 
readerCount: " + readerCount);
-        }
-    }
-
-    @Override
-    public LSMComponentType getType() {
-        return LSMComponentType.DISK;
-    }
-
-    @Override
-    public ComponentState getState() {
-        return state;
-    }
-
-    protected abstract void destroy() throws HyracksDataException;
-
-    public abstract long getComponentSize();
-
-    public abstract int getFileReferenceCount();
-
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d718dc4a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMComponent.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMComponent.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMComponent.java
index cf50c00..d69a78c 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMComponent.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMComponent.java
@@ -19,35 +19,22 @@
 package org.apache.hyracks.storage.am.lsm.common.impls;
 
 import org.apache.hyracks.data.std.primitive.LongPointable;
-import 
org.apache.hyracks.storage.am.common.freepage.MutableArrayValueReference;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilter;
 
 public abstract class AbstractLSMComponent implements ILSMComponent {
-
-    public static final MutableArrayValueReference MARKER_LSN_KEY = new 
MutableArrayValueReference("Marker"
-            .getBytes());
-
+    // Finals
+    protected final LongPointable pointable = 
LongPointable.FACTORY.createPointable();
+    protected final ILSMComponentFilter filter;
+    // Mutables
     protected ComponentState state;
     protected int readerCount;
-    protected final ILSMComponentFilter filter;
-    protected long mostRecentMarkerLSN;
-    protected final LongPointable pointable = (LongPointable) 
LongPointable.FACTORY.createPointable();
 
-    public AbstractLSMComponent(ILSMComponentFilter filter, long 
mostRecentMarkerLSN) {
+    public AbstractLSMComponent(ILSMComponentFilter filter) {
         this.filter = filter;
-        this.mostRecentMarkerLSN = mostRecentMarkerLSN;
         readerCount = 0;
     }
 
-    public AbstractLSMComponent(ILSMComponentFilter filter) {
-        this(filter, -1L);
-    }
-
-    public AbstractLSMComponent() {
-        this(null);
-    }
-
     @Override
     public ComponentState getState() {
         return state;
@@ -57,14 +44,4 @@ public abstract class AbstractLSMComponent implements 
ILSMComponent {
     public ILSMComponentFilter getLSMComponentFilter() {
         return filter;
     }
-
-    @Override
-    public long getMostRecentMarkerLSN() {
-        return mostRecentMarkerLSN;
-    }
-
-    @Override
-    public void setMostRecentMarkerLSN(long lsn) {
-        this.mostRecentMarkerLSN = lsn;
-    }
 }

Reply via email to