diff --git a/pixels-common/src/main/java/io/pixelsdb/pixels/common/index/LocalIndexService.java b/pixels-common/src/main/java/io/pixelsdb/pixels/common/index/LocalIndexService.java
index 9328f638cf..6af6a82bef 100644
--- a/pixels-common/src/main/java/io/pixelsdb/pixels/common/index/LocalIndexService.java
+++ b/pixels-common/src/main/java/io/pixelsdb/pixels/common/index/LocalIndexService.java
@@ -495,6 +495,10 @@ public boolean purgeIndexEntries(long tableId, long indexId, ListFor better performance, use consistent numRowIds when calling this method.
* @param tableId the table id of single point index
* @param numRowIds the number of row ids to allocate
@@ -136,7 +136,8 @@ public boolean equals(Scheme other)
/**
* Delete a range of row ids from the main index. This method only has effect on the persistent storage
- * of the main index.
+ * of the main index. {@link #flushCache(long fileId)} should be called before this method
+ * delete the row ids from both cache and persistent storage.
* {@link #getLocation(long)} of a row id within a deleted range returns null.
* @param rowIdRange the row id range to be deleted
* @return true on success
@@ -154,7 +155,7 @@ public boolean equals(Scheme other)
boolean flushCache(long fileId) throws MainIndexException;
/**
- * Flush the main index cache if exists and close the main index instance.
+ * Flush the main index cache (if exists) and close the main index instance.
* This method is to be used by the main index factory to close the
* managed main index instances when the process is shutting down.
*
diff --git a/pixels-common/src/main/java/io/pixelsdb/pixels/common/index/MainIndexBuffer.java b/pixels-common/src/main/java/io/pixelsdb/pixels/common/index/MainIndexBuffer.java
index 60ae77903a..5ee71ba582 100644
--- a/pixels-common/src/main/java/io/pixelsdb/pixels/common/index/MainIndexBuffer.java
+++ b/pixels-common/src/main/java/io/pixelsdb/pixels/common/index/MainIndexBuffer.java
@@ -125,8 +125,7 @@ protected IndexProto.RowLocation lookup(long fileId, long rowId) throws MainInde
*/
public IndexProto.RowLocation lookup(long rowId) throws MainIndexException
{
- IndexProto.RowLocation location = null;
- location = this.indexCache.lookup(rowId);
+ IndexProto.RowLocation location = this.indexCache.lookup(rowId);
if (location == null)
{
for (Map.Entry> entry : this.indexBuffer.entrySet())
diff --git a/pixels-common/src/main/java/io/pixelsdb/pixels/common/index/MainIndexCache.java b/pixels-common/src/main/java/io/pixelsdb/pixels/common/index/MainIndexCache.java
index b481b6a7b0..a089b03447 100644
--- a/pixels-common/src/main/java/io/pixelsdb/pixels/common/index/MainIndexCache.java
+++ b/pixels-common/src/main/java/io/pixelsdb/pixels/common/index/MainIndexCache.java
@@ -52,6 +52,11 @@ public class MainIndexCache implements Closeable
*/
private final List