From: <tho...@us...> - 2011-01-14 14:51:34
|
Revision: 4098 http://bigdata.svn.sourceforge.net/bigdata/?rev=4098&view=rev Author: thompsonbry Date: 2011-01-14 14:51:28 +0000 (Fri, 14 Jan 2011) Log Message: ----------- Modified SubqueryOp to ignore an InterruptedException or BufferClosedException in the subquery. These exceptions are normal if the subquery employs a slice and should not cause the parent query to terminate. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/SubqueryOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/AbstractRunningQuery.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine_Slice.java Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/SubqueryOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/SubqueryOp.java 2011-01-14 14:47:56 UTC (rev 4097) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/SubqueryOp.java 2011-01-14 14:51:28 UTC (rev 4098) @@ -42,8 +42,10 @@ import com.bigdata.bop.engine.IRunningQuery; import com.bigdata.bop.engine.LocalChunkMessage; import com.bigdata.bop.engine.QueryEngine; +import com.bigdata.relation.accesspath.BufferClosedException; import com.bigdata.relation.accesspath.IAsynchronousIterator; import com.bigdata.relation.accesspath.ThickAsynchronousIterator; +import com.bigdata.util.InnerCause; import com.bigdata.util.concurrent.LatchedExecutor; /** @@ -361,6 +363,7 @@ public IRunningQuery call() throws Exception { IAsynchronousIterator<IBindingSet[]> subquerySolutionItr = null; + IRunningQuery runningQuery = null; try { final QueryEngine queryEngine = parentContext.getRunningQuery() @@ -376,7 +379,7 @@ final UUID queryId = UUID.randomUUID(); // execute the subquery, passing in the source binding set. - final IRunningQuery runningQuery = queryEngine + runningQuery = queryEngine .eval( queryId, (PipelineOp) subQueryOp, @@ -415,13 +418,25 @@ } catch (Throwable t) { /* - * If a subquery fails, then propagate the error to the - * parent and rethrow the first cause error out of the - * subquery. + * Note: SliceOp will cause other operators to be + * interrupted during normal evaluation but we do not want + * to terminate the parent query when this occurs. */ - throw new RuntimeException(ControllerTask.this.context - .getRunningQuery().halt(t)); + if (!InnerCause.isInnerCause(t, InterruptedException.class) + && !InnerCause.isInnerCause(t, BufferClosedException.class)) { + /* + * If a subquery fails, then propagate the error to the + * parent and rethrow the first cause error out of the + * subquery. + */ + throw new RuntimeException(ControllerTask.this.context + .getRunningQuery().halt(t)); + + } + + return runningQuery; + } finally { if (subquerySolutionItr != null) Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/AbstractRunningQuery.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/AbstractRunningQuery.java 2011-01-14 14:47:56 UTC (rev 4097) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/AbstractRunningQuery.java 2011-01-14 14:51:28 UTC (rev 4098) @@ -50,6 +50,7 @@ import com.bigdata.bop.solutions.SliceOp; import com.bigdata.journal.IIndexManager; import com.bigdata.journal.ITx; +import com.bigdata.relation.accesspath.BufferClosedException; import com.bigdata.relation.accesspath.IAsynchronousIterator; import com.bigdata.relation.accesspath.IBlockingBuffer; import com.bigdata.service.IBigdataFederation; @@ -798,7 +799,13 @@ try { - if (!InnerCause.isInnerCause(t, InterruptedException.class)) + /* + * Note: SliceOp will cause other operators to be interrupted + * during normal evaluation so it is not useful to log an + * InterruptedException @ ERROR. + */ + if (!InnerCause.isInnerCause(t, InterruptedException.class) + && !InnerCause.isInnerCause(t, BufferClosedException.class)) log.error(toString(), t); try { Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine.java 2011-01-14 14:47:56 UTC (rev 4097) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine.java 2011-01-14 14:51:28 UTC (rev 4098) @@ -1543,12 +1543,6 @@ * which do not succeed on the optional join are forwarded to the * {@link SliceOp} which is the target specified by the * {@link PipelineOp.Annotations#ALT_SINK_REF}. - * - * @todo Write unit test for optional join groups. Here the goal is to - * verify that intermediate results may skip more than one join. This - * was a problem for the old query evaluation approach since binding - * sets had to cascade through the query one join at a time. However, - * the new query engine design should handle this case. */ public void test_query_join2_optionals() throws Exception { Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine_Slice.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine_Slice.java 2011-01-14 14:47:56 UTC (rev 4097) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine_Slice.java 2011-01-14 14:51:28 UTC (rev 4098) @@ -123,6 +123,14 @@ } +// public void testStressThreadSafe() throws Exception { +// +// for(int i=0; i<1000; i++) { +// test_slice_threadSafe(); +// } +// +// } + public void test_slice_threadSafe() throws Exception { final long timeout = 10000; // ms This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |