From do-not-reply at jboss.org Fri Jul 30 14:12:12 2010 Content-Type: multipart/mixed; boundary="===============1439771303414423028==" MIME-Version: 1.0 From: do-not-reply at jboss.org To: hornetq-commits at lists.jboss.org Subject: [hornetq-commits] JBoss hornetq SVN: r9491 - in trunk/tests/src/org/hornetq/tests: stress/journal and 1 other directory. Date: Fri, 30 Jul 2010 14:12:12 -0400 Message-ID: <201007301812.o6UICCgJ011487@svn01.web.mwc.hst.phx2.redhat.com> --===============1439771303414423028== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: clebert.suconic(a)jboss.com Date: 2010-07-30 14:12:11 -0400 (Fri, 30 Jul 2010) New Revision: 9491 Added: trunk/tests/src/org/hornetq/tests/soak/journal/JournalCleanupCompactSoak= Test.java Modified: trunk/tests/src/org/hornetq/tests/stress/journal/JournalCleanupCompactSt= ressTest.java Log: avoid OutOfMemoryException on soak test for very long runs (maximizing numb= er of pending records with a semaphore) Added: trunk/tests/src/org/hornetq/tests/soak/journal/JournalCleanupCompact= SoakTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/tests/src/org/hornetq/tests/soak/journal/JournalCleanupCompactSoa= kTest.java (rev 0) +++ trunk/tests/src/org/hornetq/tests/soak/journal/JournalCleanupCompactSoa= kTest.java 2010-07-30 18:12:11 UTC (rev 9491) @@ -0,0 +1,54 @@ +/* + * Copyright 2010 Red Hat, Inc. + * Red Hat 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. + */ + +package org.hornetq.tests.soak.journal; + +import java.util.concurrent.TimeUnit; + +import org.hornetq.tests.stress.journal.JournalCleanupCompactStressTest; + +/** + * A JournalCleanupCompactSoakTest + * + * @author Clebert Suconic<= /a> + * + * + */ +public class JournalCleanupCompactSoakTest extends JournalCleanupCompactSt= ressTest +{ + + // Constants ----------------------------------------------------- + + // Attributes ---------------------------------------------------- + + // Static -------------------------------------------------------- + + // Constructors -------------------------------------------------- + + // Public -------------------------------------------------------- + = + protected long getTotalTimeMilliseconds() + { + return TimeUnit.SECONDS.toMillis(1); + } + + + // Package protected --------------------------------------------- + + // Protected ----------------------------------------------------- + + // Private ------------------------------------------------------- + + // Inner classes ------------------------------------------------- + +} Modified: trunk/tests/src/org/hornetq/tests/stress/journal/JournalCleanupCo= mpactStressTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/tests/src/org/hornetq/tests/stress/journal/JournalCleanupCompactS= tressTest.java 2010-07-30 17:20:25 UTC (rev 9490) +++ trunk/tests/src/org/hornetq/tests/stress/journal/JournalCleanupCompactS= tressTest.java 2010-07-30 18:12:11 UTC (rev 9491) @@ -18,6 +18,7 @@ import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.Semaphore; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -51,6 +52,9 @@ { = public static SimpleIDGenerator idGen =3D new SimpleIDGenerator(1); + = + // We want to maximize the difference between appends and deles, or we = could get out of memory + public Semaphore maxRecords; = private volatile boolean running; = @@ -77,6 +81,8 @@ { super.setUp(); = + maxRecords =3D new Semaphore(20000); + = errors.set(0); = File dir =3D new File(getTemporaryDir()); @@ -235,6 +241,11 @@ LinkedBlockingDeque queue =3D new LinkedBlockingDeque(); = OperationContextImpl ctx =3D new OperationContextImpl(executorFactor= y.getExecutor()); + = + public FastAppenderTx() + { + super("FastAppenderTX"); + } = @Override public void run() @@ -255,7 +266,7 @@ long id =3D JournalCleanupCompactStressTest.idGen.genera= teID(); ids[i] =3D id; journal.appendAddRecordTransactional(txID, id, (byte)0, = generateRecord()); - Thread.sleep(1); + maxRecords.acquire(); } journal.appendCommitRecord(txID, true, ctx); ctx.executeOnCompletion(new IOAsyncTask() @@ -293,6 +304,7 @@ = public FastUpdateTx(final LinkedBlockingDeque queue) { + super("FastUpdateTX"); this.queue =3D queue; } = @@ -350,6 +362,7 @@ for (long id : ids) { journal.appendDeleteRecord(id, false); + maxRecords.release(); numberOfDeletes.incrementAndGet(); } } @@ -373,6 +386,12 @@ */ class SlowAppenderNoTX extends Thread { + = + public SlowAppenderNoTX() + { + super("SlowAppender"); + } + = @Override public void run() { @@ -386,6 +405,7 @@ { System.out.println("append slow"); ids[i] =3D JournalCleanupCompactStressTest.idGen.generat= eID(); + maxRecords.acquire(); journal.appendAddRecord(ids[i], (byte)1, generateRecord(= ), true); numberOfRecords.incrementAndGet(); = --===============1439771303414423028==--