From: <tho...@us...> - 2011-07-12 12:21:17
|
Revision: 4889 http://bigdata.svn.sourceforge.net/bigdata/?rev=4889&view=rev Author: thompsonbry Date: 2011-07-12 12:21:08 +0000 (Tue, 12 Jul 2011) Log Message: ----------- Modified the test to explicitly set a flag if there are no errors by the time we interrupt the running tasks. This allows the test to report failure only for errors encountered during normal execution of tasks and filters out any failures which might arise from the interruption of a large number of concurrent tasks. This is in response to [1]. [1] https://sourceforge.net/apps/trac/bigdata/ticket/343 (Stochastic assert in AbstractBTree#writeNodeOrLeaf() in CI) Modified Paths: -------------- branches/BIGDATA_RELEASE_1_0_0/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMROWTransactions.java branches/TERMS_REFACTOR_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMROWTransactions.java Modified: branches/BIGDATA_RELEASE_1_0_0/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMROWTransactions.java =================================================================== --- branches/BIGDATA_RELEASE_1_0_0/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMROWTransactions.java 2011-07-12 00:22:00 UTC (rev 4888) +++ branches/BIGDATA_RELEASE_1_0_0/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMROWTransactions.java 2011-07-12 12:21:08 UTC (rev 4889) @@ -6,16 +6,10 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; -import org.openrdf.model.BNode; -import org.openrdf.model.Resource; -import org.openrdf.model.Statement; import org.openrdf.model.URI; -import org.openrdf.model.Value; -import org.openrdf.model.impl.BNodeImpl; -import org.openrdf.model.impl.ContextStatementImpl; -import org.openrdf.model.impl.StatementImpl; import org.openrdf.model.impl.URIImpl; import com.bigdata.counters.CAT; @@ -87,18 +81,18 @@ return new URIImpl(BD.NAMESPACE + s); } - private BNode bnode(String id) { - return new BNodeImpl(id); - } +// private BNode bnode(String id) { +// return new BNodeImpl(id); +// } +// +// private Statement stmt(Resource s, URI p, Value o) { +// return new StatementImpl(s, p, o); +// } +// +// private Statement stmt(Resource s, URI p, Value o, Resource c) { +// return new ContextStatementImpl(s, p, o, c); +// } - private Statement stmt(Resource s, URI p, Value o) { - return new StatementImpl(s, p, o); - } - - private Statement stmt(Resource s, URI p, Value o, Resource c) { - return new ContextStatementImpl(s, p, o, c); - } - // public void test_multiple_transaction() throws Exception { // // final int nthreads = 10; // @@ -227,6 +221,8 @@ final CAT writes = new CAT(); final CAT reads = new CAT(); final AtomicReference<Throwable> failex = new AtomicReference<Throwable>(null); + // Set [true] iff there are no failures by the time we cancel the running tasks. + final AtomicBoolean success = new AtomicBoolean(false); final BigdataSail sail = getSail(); try { @@ -372,11 +368,18 @@ if (failex.get() != null) break; } + if (failex.get() == null) { + /* + * Note whether or not there are failures before we + * interrupt the running tasks. + */ + success.set(true); + } writers.shutdownNow(); readers.shutdownNow(); writers.awaitTermination(5, TimeUnit.SECONDS); readers.awaitTermination(5, TimeUnit.SECONDS); - { + if (!success.get()) { final Throwable ex = failex.get(); if (ex != null) { fail("Test failed: firstCause=" + ex, ex); Modified: branches/TERMS_REFACTOR_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMROWTransactions.java =================================================================== --- branches/TERMS_REFACTOR_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMROWTransactions.java 2011-07-12 00:22:00 UTC (rev 4888) +++ branches/TERMS_REFACTOR_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMROWTransactions.java 2011-07-12 12:21:08 UTC (rev 4889) @@ -6,16 +6,10 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; -import org.openrdf.model.BNode; -import org.openrdf.model.Resource; -import org.openrdf.model.Statement; import org.openrdf.model.URI; -import org.openrdf.model.Value; -import org.openrdf.model.impl.BNodeImpl; -import org.openrdf.model.impl.ContextStatementImpl; -import org.openrdf.model.impl.StatementImpl; import org.openrdf.model.impl.URIImpl; import com.bigdata.counters.CAT; @@ -87,18 +81,18 @@ return new URIImpl(BD.NAMESPACE + s); } - private BNode bnode(String id) { - return new BNodeImpl(id); - } +// private BNode bnode(String id) { +// return new BNodeImpl(id); +// } +// +// private Statement stmt(Resource s, URI p, Value o) { +// return new StatementImpl(s, p, o); +// } +// +// private Statement stmt(Resource s, URI p, Value o, Resource c) { +// return new ContextStatementImpl(s, p, o, c); +// } - private Statement stmt(Resource s, URI p, Value o) { - return new StatementImpl(s, p, o); - } - - private Statement stmt(Resource s, URI p, Value o, Resource c) { - return new ContextStatementImpl(s, p, o, c); - } - // public void test_multiple_transaction() throws Exception { // // final int nthreads = 10; // @@ -227,6 +221,8 @@ final CAT writes = new CAT(); final CAT reads = new CAT(); final AtomicReference<Throwable> failex = new AtomicReference<Throwable>(null); + // Set [true] iff there are no failures by the time we cancel the running tasks. + final AtomicBoolean success = new AtomicBoolean(false); final BigdataSail sail = getSail(); try { @@ -372,11 +368,18 @@ if (failex.get() != null) break; } + if (failex.get() == null) { + /* + * Note whether or not there are failures before we + * interrupt the running tasks. + */ + success.set(true); + } writers.shutdownNow(); readers.shutdownNow(); writers.awaitTermination(5, TimeUnit.SECONDS); readers.awaitTermination(5, TimeUnit.SECONDS); - { + if (!success.get()) { final Throwable ex = failex.get(); if (ex != null) { fail("Test failed: firstCause=" + ex, ex); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |