Repository: asterixdb Updated Branches: refs/heads/master 89e6a9327 -> d46165542
[NO ISSUE][STO] Ensure IFrameTupleProcessor Finish is Called - user model changes: no - storage format changes: no - interface changes: no Details: Currently when an exception is encountered while processing the frame in LSMHarness, IFrameTupleProcessor finish is not called which results in "Operation already has access to components of index" exception. Change-Id: I5f4188fa3de3c91f5f6aae95716db016a315ddd6 Reviewed-on: https://asterix-gerrit.ics.uci.edu/2083 Reviewed-by: abdullah alamoudi <[email protected]> Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/d4616554 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/d4616554 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/d4616554 Branch: refs/heads/master Commit: d46165542d69d0ff84b459e5cfc36de9625bde62 Parents: 89e6a93 Author: Murtadha Hubail <[email protected]> Authored: Fri Oct 20 00:33:33 2017 +0300 Committer: Murtadha Hubail <[email protected]> Committed: Fri Oct 20 00:26:57 2017 -0700 ---------------------------------------------------------------------- .../storage/am/lsm/common/impls/LSMHarness.java | 35 +++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d4616554/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java ---------------------------------------------------------------------- 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 c8be9b9..ac38cba 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 @@ -643,9 +643,9 @@ public class LSMHarness implements ILSMHarness { exitComponents(ctx, LSMOperationType.REPLICATE, null, false); } - protected void validateOperationEnterComponentsState(ILSMIndexOperationContext ctx) throws HyracksDataException { + protected void validateOperationEnterComponentsState(ILSMIndexOperationContext ctx) { if (ctx.isAccessingComponents()) { - throw new HyracksDataException("Opeartion already has access to components of index " + lsmIndex); + throw new IllegalStateException("Operation already has access to components of index " + lsmIndex); } } @@ -684,17 +684,17 @@ public class LSMHarness implements ILSMHarness { processor.start(); enter(ctx); try { - int tupleCount = accessor.getTupleCount(); - int i = 0; - while (i < tupleCount) { - tuple.reset(accessor, i); - processor.process(tuple, i); - i++; + try { + processFrame(accessor, tuple, processor); + frameOpCallback.frameCompleted(); + } finally { + processor.finish(); } - frameOpCallback.frameCompleted(); - processor.finish(); - } catch (Exception e) { - throw HyracksDataException.create(e); + } catch (HyracksDataException e) { + if (LOGGER.isLoggable(Level.SEVERE)) { + LOGGER.log(Level.SEVERE, "Failed to process frame", e); + } + throw e; } finally { exit(ctx); } @@ -853,6 +853,17 @@ public class LSMHarness implements ILSMHarness { return false; } + private static void processFrame(FrameTupleAccessor accessor, FrameTupleReference tuple, + IFrameTupleProcessor processor) throws HyracksDataException { + int tupleCount = accessor.getTupleCount(); + int i = 0; + while (i < tupleCount) { + tuple.reset(accessor, i); + processor.process(tuple, i); + i++; + } + } + @Override public String toString() { return getClass().getSimpleName() + ":" + lsmIndex;
