added interface to get the first LSN for an in-memory component of an index

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_lsm_stabilization@1208 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/ioopcallbacks/AbstractLSMIOOperationCallback.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/ioopcallbacks/AbstractLSMIOOperationCallback.java
index cd5462f..587404d 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/ioopcallbacks/AbstractLSMIOOperationCallback.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/ioopcallbacks/AbstractLSMIOOperationCallback.java
@@ -30,7 +30,6 @@
 
 public abstract class AbstractLSMIOOperationCallback implements ILSMIOOperationCallback {
 
-    // Object on which blocked LSMIndex operations are waiting.
     protected final IndexOperationTracker opTracker;
 
     public AbstractLSMIOOperationCallback(IndexOperationTracker opTracker) {
@@ -43,8 +42,8 @@
     }
 
     @Override
-    public synchronized void afterFinalize(ILSMIOOperation operation, ILSMComponent newComponent) {
-        // Do nothing.
+    public void afterFinalize(ILSMIOOperation operation, ILSMComponent newComponent) {
+        opTracker.resetLSNs();
     }
 
     protected abstract long getComponentLSN(List<ILSMComponent> oldComponents) throws HyracksDataException;
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/IndexOperationTracker.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/IndexOperationTracker.java
index ecf4f96..5121f84 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/IndexOperationTracker.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/IndexOperationTracker.java
@@ -32,6 +32,7 @@
     // Number of active operations on a ILSMIndex instance.
     private int numActiveOperations = 0;
     private long lastLSN;
+    private long firstLSN;
     private final ILSMIndex index;
     private final ILSMIOOperationCallback ioOpCallback;
     private ILSMIndexAccessor accessor;
@@ -46,6 +47,7 @@
         } else {
             ioOpCallback = NoOpIOOperationCallback.INSTANCE;
         }
+        resetLSNs();
     }
 
     @Override
@@ -111,7 +113,19 @@
         return lastLSN;
     }
 
+    public long getFirstLSN() {
+        return firstLSN;
+    }
+
     public void updateLastLSN(long lastLSN) {
+        if (firstLSN == -1) {
+            firstLSN = lastLSN;
+        }
         this.lastLSN = Math.max(this.lastLSN, lastLSN);
     }
+
+    public void resetLSNs() {
+        lastLSN = -1;
+        firstLSN = -1;
+    }
 }