abdullah alamoudi has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/2091

Change subject: [NO ISSUE][RT] Catch when tuple operation doesn't exit index 
components
......................................................................

[NO ISSUE][RT] Catch when tuple operation doesn't exit index components

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Currently, if a tuple operation doesn't exit index components,
  it is not caught. This change checks and throw a specific exception
  if that happens.

Change-Id: Ia697c5596fd3d35bb71f1baa9bf18a7f13550c7f
---
M 
hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
M 
hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
M 
hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
3 files changed, 21 insertions(+), 11 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/91/2091/1

diff --git 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
index a071345..d55e76e 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
@@ -133,6 +133,7 @@
     public static final int ILLEGAL_ATTEMPT_TO_EXIT_EMPTY_COMPONENT = 97;
     public static final int A_FLUSH_OPERATION_HAS_FAILED = 98;
     public static final int A_MERGE_OPERATION_HAS_FAILED = 99;
+    public static final int A_TUPLE_PROCESS_OPERATION_DID_NOT_EXIT_COMPONENTS 
= 100;
 
     // Compilation error codes.
     public static final int RULECOLLECTION_NOT_INSTANCE_OF_LIST = 10000;
diff --git 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
index ae579b4..5a6951b 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
+++ 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
@@ -116,5 +116,6 @@
 97 = Illegal attempt to exit empty component
 98 = A flush operation has failed
 99 = A merge operation has failed
+100 = A tuple level operation didn't exit index components
 
 10000 = The given rule collection %1$s is not an instance of the List class.
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
index ac38cba..d7b1e11 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
@@ -665,16 +665,13 @@
     }
 
     private void exit(ILSMIndexOperationContext ctx) throws 
HyracksDataException {
-        getAndExitComponentsAndComplete(ctx, LSMOperationType.MODIFICATION);
-    }
-
-    private void getAndExitComponentsAndComplete(ILSMIndexOperationContext 
ctx, LSMOperationType op)
-            throws HyracksDataException {
-        validateOperationEnterComponentsState(ctx);
+        if (ctx.isAccessingComponents()) {
+            throw 
HyracksDataException.create(ErrorCode.A_TUPLE_PROCESS_OPERATION_DID_NOT_EXIT_COMPONENTS);
+        }
         synchronized (opTracker) {
             lsmIndex.getOperationalComponents(ctx);
             ctx.setAccessingComponents(true);
-            exitAndComplete(ctx, op);
+            exitAndComplete(ctx, LSMOperationType.MODIFICATION);
         }
     }
 
@@ -683,20 +680,31 @@
             IFrameTupleProcessor processor, IFrameOperationCallback 
frameOpCallback) throws HyracksDataException {
         processor.start();
         enter(ctx);
+        HyracksDataException hde = null;
         try {
+            processFrame(accessor, tuple, processor);
             try {
-                processFrame(accessor, tuple, processor);
                 frameOpCallback.frameCompleted();
             } finally {
                 processor.finish();
             }
-        } catch (HyracksDataException e) {
+        } catch (Throwable e) {
             if (LOGGER.isLoggable(Level.SEVERE)) {
                 LOGGER.log(Level.SEVERE, "Failed to process frame", e);
             }
-            throw e;
+            hde = HyracksDataException.create(e);
         } finally {
-            exit(ctx);
+            try {
+                exit(ctx);
+            } catch (Throwable th) {
+                if (hde == null) {
+                    throw th;
+                }
+                hde.addSuppressed(th);
+            }
+        }
+        if (hde != null) {
+            throw hde;
         }
     }
 

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2091
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia697c5596fd3d35bb71f1baa9bf18a7f13550c7f
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <[email protected]>

Reply via email to