cassandra git commit: Introduce test-burn ant target
Repository: cassandra Updated Branches: refs/heads/trunk aa811c393 -> a3e041848 Introduce test-burn ant target patch by ariel for CASSANDRA-9307 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a3e04184 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a3e04184 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a3e04184 Branch: refs/heads/trunk Commit: a3e041848bd6410f0627dce52725811602fd579f Parents: aa811c3 Author: Benedict Elliott Smith Authored: Wed May 6 17:51:48 2015 +0100 Committer: Benedict Elliott Smith Committed: Wed May 6 17:51:48 2015 +0100 -- .../cassandra/concurrent/LongOpOrderTest.java | 240 + .../concurrent/LongSharedExecutorPoolTest.java | 226 + .../apache/cassandra/utils/LongBTreeTest.java | 502 +++ 3 files changed, 968 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/a3e04184/test/burn/org/apache/cassandra/concurrent/LongOpOrderTest.java -- diff --git a/test/burn/org/apache/cassandra/concurrent/LongOpOrderTest.java b/test/burn/org/apache/cassandra/concurrent/LongOpOrderTest.java new file mode 100644 index 000..d7105df --- /dev/null +++ b/test/burn/org/apache/cassandra/concurrent/LongOpOrderTest.java @@ -0,0 +1,240 @@ +package org.apache.cassandra.concurrent; +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + + +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import org.cliffc.high_scale_lib.NonBlockingHashMap; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.cassandra.utils.concurrent.OpOrder; + +import static org.junit.Assert.assertTrue; + +// TODO: we don't currently test SAFE functionality at all! +// TODO: should also test markBlocking and SyncOrdered +public class LongOpOrderTest +{ + +private static final Logger logger = LoggerFactory.getLogger(LongOpOrderTest.class); + +static final int CONSUMERS = 4; +static final int PRODUCERS = 32; + +static final long RUNTIME = TimeUnit.MINUTES.toMillis(5); +static final long REPORT_INTERVAL = TimeUnit.MINUTES.toMillis(1); + +static final Thread.UncaughtExceptionHandler handler = new Thread.UncaughtExceptionHandler() +{ +@Override +public void uncaughtException(Thread t, Throwable e) +{ +System.err.println(t.getName() + ": " + e.getMessage()); +e.printStackTrace(); +} +}; + +final OpOrder order = new OpOrder(); +final AtomicInteger errors = new AtomicInteger(); + +class TestOrdering implements Runnable +{ + +final int[] waitNanos = new int[1 << 16]; +volatile State state = new State(); +final ScheduledExecutorService sched; + +TestOrdering(ExecutorService exec, ScheduledExecutorService sched) +{ +this.sched = sched; +final ThreadLocalRandom rnd = ThreadLocalRandom.current(); +for (int i = 0 ; i < waitNanos.length ; i++) +waitNanos[i] = rnd.nextInt(5000); +for (int i = 0 ; i < PRODUCERS / CONSUMERS ; i++) +exec.execute(new Producer()); +exec.execute(this); +} + +@Override +public void run() +{ +final long until = System.currentTimeMillis() + RUNTIME; +long lastReport = System.currentTimeMillis(); +long count = 0; +long opCount = 0; +while (true) +{ +long now = System.currentTimeMillis(); +if (now > until) +break; +if (now > lastReport + REPORT_INTERVAL) +{ +
cassandra git commit: Introduce test-burn ant target
Repository: cassandra Updated Branches: refs/heads/trunk 4dbe1e0c7 -> aa811c393 Introduce test-burn ant target patch by ariel for CASSANDRA-9307 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/aa811c39 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/aa811c39 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/aa811c39 Branch: refs/heads/trunk Commit: aa811c393653e92212458ef147a675f396f53173 Parents: 4dbe1e0 Author: Benedict Elliott Smith Authored: Wed May 6 17:24:56 2015 +0100 Committer: Benedict Elliott Smith Committed: Wed May 6 17:24:56 2015 +0100 -- build.xml | 11 +- .../cassandra/concurrent/LongOpOrderTest.java | 240 - .../concurrent/LongSharedExecutorPoolTest.java | 226 - .../apache/cassandra/utils/LongBTreeTest.java | 502 --- 4 files changed, 10 insertions(+), 969 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/aa811c39/build.xml -- diff --git a/build.xml b/build.xml index a5f195f..c019025 100644 --- a/build.xml +++ b/build.xml @@ -62,6 +62,7 @@ + @@ -96,6 +97,7 @@ + @@ -1092,6 +1094,7 @@ + @@ -1302,6 +1305,12 @@ + + + + + @@ -1389,7 +1398,7 @@ + description="Run all tests except for those under test-burn" /> http://git-wip-us.apache.org/repos/asf/cassandra/blob/aa811c39/test/long/org/apache/cassandra/concurrent/LongOpOrderTest.java -- diff --git a/test/long/org/apache/cassandra/concurrent/LongOpOrderTest.java b/test/long/org/apache/cassandra/concurrent/LongOpOrderTest.java deleted file mode 100644 index d7105df..000 --- a/test/long/org/apache/cassandra/concurrent/LongOpOrderTest.java +++ /dev/null @@ -1,240 +0,0 @@ -package org.apache.cassandra.concurrent; -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - - -import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - -import org.cliffc.high_scale_lib.NonBlockingHashMap; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.cassandra.utils.concurrent.OpOrder; - -import static org.junit.Assert.assertTrue; - -// TODO: we don't currently test SAFE functionality at all! -// TODO: should also test markBlocking and SyncOrdered -public class LongOpOrderTest -{ - -private static final Logger logger = LoggerFactory.getLogger(LongOpOrderTest.class); - -static final int CONSUMERS = 4; -static final int PRODUCERS = 32; - -static final long RUNTIME = TimeUnit.MINUTES.toMillis(5); -static final long REPORT_INTERVAL = TimeUnit.MINUTES.toMillis(1); - -static final Thread.UncaughtExceptionHandler handler = new Thread.UncaughtExceptionHandler() -{ -@Override -public void uncaughtException(Thread t, Throwable e) -{ -System.err.println(t.getName() + ": " + e.getMessage()); -e.printStackTrace(); -} -}; - -final OpOrder order = new OpOrder(); -final AtomicInteger errors = new AtomicInteger(); - -class TestOrdering implements Runnable -{ - -final int[] waitNanos = new int[1 << 16]; -volatile State state = new State(); -final ScheduledExecutorService sched; - -TestOrdering(ExecutorService exec, ScheduledExecutorService sched) -{ -this.sched = sched; -final ThreadLocalRandom rnd = ThreadLocalRandom.current(); -for (int i = 0 ; i < waitNanos.length ; i++) -