Return-Path: X-Original-To: apmail-asterixdb-commits-archive@minotaur.apache.org Delivered-To: apmail-asterixdb-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BF64618BB8 for ; Fri, 9 Oct 2015 07:37:36 +0000 (UTC) Received: (qmail 26091 invoked by uid 500); 9 Oct 2015 07:37:36 -0000 Delivered-To: apmail-asterixdb-commits-archive@asterixdb.apache.org Received: (qmail 26058 invoked by uid 500); 9 Oct 2015 07:37:36 -0000 Mailing-List: contact commits-help@asterixdb.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.incubator.apache.org Delivered-To: mailing list commits@asterixdb.incubator.apache.org Received: (qmail 26049 invoked by uid 99); 9 Oct 2015 07:37:36 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Oct 2015 07:37:36 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 381DD180A89 for ; Fri, 9 Oct 2015 07:37:36 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.771 X-Spam-Level: * X-Spam-Status: No, score=1.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 4yQJzDhzBsoR for ; Fri, 9 Oct 2015 07:37:27 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 8BA9B20944 for ; Fri, 9 Oct 2015 07:37:27 +0000 (UTC) Received: (qmail 25272 invoked by uid 99); 9 Oct 2015 07:37:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Oct 2015 07:37:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 04297DFF13; Fri, 9 Oct 2015 07:37:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ildar@apache.org To: commits@asterixdb.incubator.apache.org Message-Id: <3192d7a91d074f7d852b4b8e4359d17d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-asterixdb-hyracks git commit: ASTERIXDB-1002: Fix exception handling in EmptyTupleSourceRuntimeFactory Date: Fri, 9 Oct 2015 07:37:27 +0000 (UTC) Repository: incubator-asterixdb-hyracks Updated Branches: refs/heads/master c4118bd0c -> 87428ba48 ASTERIXDB-1002: Fix exception handling in EmptyTupleSourceRuntimeFactory Revisiting the previous fix by calling fail() on pipeline Change-Id: I19f8c8485e483e4d4efeff939e6bd82c7a04a101 Reviewed-on: https://asterix-gerrit.ics.uci.edu/443 Tested-by: Jenkins Reviewed-by: Murtadha Hubail Reviewed-by: Ian Maxon Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/commit/87428ba4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/tree/87428ba4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/diff/87428ba4 Branch: refs/heads/master Commit: 87428ba48ec358ef6eb5d5e6875bf13b886b8f66 Parents: c4118bd Author: Ildar Absalyamov Authored: Fri Oct 9 00:06:31 2015 -0700 Committer: Ildar Absalyamov Committed: Fri Oct 9 00:28:04 2015 -0700 ---------------------------------------------------------------------- .../meta/AlgebricksMetaOperatorDescriptor.java | 27 ++++++++++++-------- .../std/EmptyTupleSourceRuntimeFactory.java | 19 +++++++------- .../nc/partitions/PipelinedPartition.java | 4 ++- 3 files changed, 29 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/87428ba4/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/meta/AlgebricksMetaOperatorDescriptor.java ---------------------------------------------------------------------- diff --git a/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/meta/AlgebricksMetaOperatorDescriptor.java b/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/meta/AlgebricksMetaOperatorDescriptor.java index 6618326..1a7150e 100644 --- a/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/meta/AlgebricksMetaOperatorDescriptor.java +++ b/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/meta/AlgebricksMetaOperatorDescriptor.java @@ -20,9 +20,6 @@ package org.apache.hyracks.algebricks.runtime.operators.meta; import java.nio.ByteBuffer; -import org.json.JSONException; -import org.json.JSONObject; - import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.algebricks.runtime.base.AlgebricksPipeline; import org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory; @@ -36,6 +33,8 @@ import org.apache.hyracks.api.job.IOperatorDescriptorRegistry; import org.apache.hyracks.dataflow.std.base.AbstractSingleActivityOperatorDescriptor; import org.apache.hyracks.dataflow.std.base.AbstractUnaryInputUnaryOutputOperatorNodePushable; import org.apache.hyracks.dataflow.std.base.AbstractUnaryOutputSourceOperatorNodePushable; +import org.json.JSONException; +import org.json.JSONObject; public class AlgebricksMetaOperatorDescriptor extends AbstractSingleActivityOperatorDescriptor { @@ -93,10 +92,11 @@ public class AlgebricksMetaOperatorDescriptor extends AbstractSingleActivityOper final IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) { return new AbstractUnaryOutputSourceOperatorNodePushable() { + @Override public void initialize() throws HyracksDataException { IFrameWriter startOfPipeline; - RecordDescriptor pipelineOutputRecordDescriptor = outputArity > 0 ? AlgebricksMetaOperatorDescriptor.this.recordDescriptors[0] - : null; + RecordDescriptor pipelineOutputRecordDescriptor = outputArity > 0 + ? AlgebricksMetaOperatorDescriptor.this.recordDescriptors[0] : null; PipelineAssembler pa = new PipelineAssembler(pipeline, inputArity, outputArity, null, pipelineOutputRecordDescriptor); @@ -105,8 +105,13 @@ public class AlgebricksMetaOperatorDescriptor extends AbstractSingleActivityOper } catch (AlgebricksException e) { throw new HyracksDataException(e); } - startOfPipeline.open(); - startOfPipeline.close(); + try { + startOfPipeline.open(); + } catch (HyracksDataException e) { + startOfPipeline.fail(); + } finally { + startOfPipeline.close(); + } } }; } @@ -120,10 +125,10 @@ public class AlgebricksMetaOperatorDescriptor extends AbstractSingleActivityOper @Override public void open() throws HyracksDataException { if (startOfPipeline == null) { - RecordDescriptor pipelineOutputRecordDescriptor = outputArity > 0 ? AlgebricksMetaOperatorDescriptor.this.recordDescriptors[0] - : null; - RecordDescriptor pipelineInputRecordDescriptor = recordDescProvider.getInputRecordDescriptor( - AlgebricksMetaOperatorDescriptor.this.getActivityId(), 0); + RecordDescriptor pipelineOutputRecordDescriptor = outputArity > 0 + ? AlgebricksMetaOperatorDescriptor.this.recordDescriptors[0] : null; + RecordDescriptor pipelineInputRecordDescriptor = recordDescProvider + .getInputRecordDescriptor(AlgebricksMetaOperatorDescriptor.this.getActivityId(), 0); PipelineAssembler pa = new PipelineAssembler(pipeline, inputArity, outputArity, pipelineInputRecordDescriptor, pipelineOutputRecordDescriptor); try { http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/87428ba4/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/EmptyTupleSourceRuntimeFactory.java ---------------------------------------------------------------------- diff --git a/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/EmptyTupleSourceRuntimeFactory.java b/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/EmptyTupleSourceRuntimeFactory.java index 5b66736..a2b9652 100644 --- a/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/EmptyTupleSourceRuntimeFactory.java +++ b/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/EmptyTupleSourceRuntimeFactory.java @@ -43,20 +43,21 @@ public class EmptyTupleSourceRuntimeFactory implements IPushRuntimeFactory { public IPushRuntime createPushRuntime(final IHyracksTaskContext ctx) throws HyracksDataException { return new AbstractOneInputSourcePushRuntime() { - private ArrayTupleBuilder tb = new ArrayTupleBuilder(0); - private FrameTupleAppender appender = new FrameTupleAppender(new VSizeFrame(ctx)); + private final ArrayTupleBuilder tb = new ArrayTupleBuilder(0); + private final FrameTupleAppender appender = new FrameTupleAppender(new VSizeFrame(ctx)); @Override public void open() throws HyracksDataException { writer.open(); - try { - if (!appender.append(tb.getFieldEndOffsets(), tb.getByteArray(), 0, tb.getSize())) { - throw new IllegalStateException(); - } - appender.flush(writer, true); - } finally { - writer.close(); + if (!appender.append(tb.getFieldEndOffsets(), tb.getByteArray(), 0, tb.getSize())) { + throw new IllegalStateException(); } + appender.flush(writer, true); + } + + @Override + public void close() throws HyracksDataException { + writer.close(); } }; } http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/87428ba4/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/PipelinedPartition.java ---------------------------------------------------------------------- diff --git a/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/PipelinedPartition.java b/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/PipelinedPartition.java index 7f6dd10..2ca1e0f 100644 --- a/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/PipelinedPartition.java +++ b/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/PipelinedPartition.java @@ -81,7 +81,9 @@ public class PipelinedPartition implements IFrameWriter, IPartition { @Override public void nextFrame(ByteBuffer buffer) throws HyracksDataException { ensureConnected(); - delegate.nextFrame(buffer); + if (!failed) { + delegate.nextFrame(buffer); + } } private void ensureConnected() throws HyracksDataException {