JBoss hornetq SVN: r10387 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-03-27 22:51:02 -0400 (Sun, 27 Mar 2011)
New Revision: 10387
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging/PageCursorStressTest.java
Log:
Removing invalid/broken tests
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging/PageCursorStressTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging/PageCursorStressTest.java 2011-03-28 01:25:31 UTC (rev 10386)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging/PageCursorStressTest.java 2011-03-28 02:51:02 UTC (rev 10387)
@@ -36,7 +36,6 @@
import org.hornetq.core.paging.cursor.PagedReference;
import org.hornetq.core.paging.cursor.impl.PageCursorProviderImpl;
import org.hornetq.core.paging.cursor.impl.PagePositionImpl;
-import org.hornetq.core.paging.cursor.impl.PageSubscriptionImpl;
import org.hornetq.core.paging.impl.PagingStoreImpl;
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.persistence.impl.journal.OperationContextImpl;
@@ -527,12 +526,10 @@
assertNull(iterator.next());
}
- server.stop();
-
OperationContextImpl.clearContext();
+
+ ctx = generateCTX();
- createServer();
-
pageStore = lookupPageStore(ADDRESS);
cursor = this.server.getPagingManager().getPageStore(ADDRESS).getCursorProvier().getSubscription(queue.getID());
@@ -563,12 +560,8 @@
assertEquals(i, readMessage.getMessage().getIntProperty("key").intValue());
}
- server.stop();
-
OperationContextImpl.clearContext();
- createServer();
-
pageStore = lookupPageStore(ADDRESS);
cursor = this.server.getPagingManager().getPageStore(ADDRESS).getCursorProvier().getSubscription(queue.getID());
@@ -919,63 +912,6 @@
}
- public void testCloseNonPersistentConsumer() throws Exception
- {
-
- final int NUM_MESSAGES = 100;
-
- PageCursorProvider cursorProvider = lookupCursorProvider();
-
- PageSubscription cursor = cursorProvider.createSubscription(11, null, false);
- PageSubscriptionImpl cursor2 = (PageSubscriptionImpl)cursorProvider.createSubscription(12, null, false);
-
- this.queueList.add(new FakeQueue(new SimpleString("a"), 11));
-
- this.queueList.add(new FakeQueue(new SimpleString("b"), 12));
-
- int numberOfPages = addMessages(NUM_MESSAGES, 1024 * 1024);
-
- System.out.println("NumberOfPages = " + numberOfPages);
-
- queue.getPageSubscription().close();
-
- PagedReference msg;
- LinkedListIterator<PagedReference> iterator = cursor.iterator();
- LinkedListIterator<PagedReference> iterator2 = cursor2.iterator();
-
- cursor2.bookmark(new PagePositionImpl(1, -1));
-
- int key = 0;
- while ((msg = iterator.next()) != null)
- {
- System.out.println("key = " + key);
- assertEquals(key++, msg.getMessage().getIntProperty("key").intValue());
- cursor.ack(msg);
- }
- assertEquals(NUM_MESSAGES, key);
-
- forceGC();
-
- for (int i = 0; i < 10; i++)
- {
- assertTrue(iterator2.hasNext());
- msg = iterator2.next();
- assertEquals(i, msg.getMessage().getIntProperty("key").intValue());
- }
-
- assertSame(cursor2.getProvider(), cursorProvider);
-
- cursor2.close();
-
- lookupPageStore(ADDRESS).flushExecutors();
-
- server.stop();
- createServer();
- waitCleanup();
- assertEquals(1, lookupPageStore(ADDRESS).getNumberOfPages());
-
- }
-
public void testNoCursors() throws Exception
{
@@ -1000,54 +936,6 @@
}
- public void testFirstMessageInTheMiddle() throws Exception
- {
-
- final int NUM_MESSAGES = 100;
-
- PageCursorProvider cursorProvider = lookupCursorProvider();
-
- PageSubscription cursor = cursorProvider.createSubscription(2, null, false);
-
- queueList.add(new FakeQueue(new SimpleString("tmp"), 2));
-
- int numberOfPages = addMessages(NUM_MESSAGES, 1024 * 1024);
-
- System.out.println("NumberOfPages = " + numberOfPages);
-
- PageCache cache = cursorProvider.getPageCache(new PagePositionImpl(5, 0));
-
- queue.getPageSubscription().close();
-
- PagePosition startingPos = new PagePositionImpl(5, cache.getNumberOfMessages() / 2);
- cursor.bookmark(startingPos);
- PagedMessage msg = cache.getMessage(startingPos.getMessageNr() + 1);
- msg.initMessage(server.getStorageManager());
- int key = msg.getMessage().getIntProperty("key").intValue();
-
- msg = null;
-
- cache = null;
- LinkedListIterator<PagedReference> iterator = cursor.iterator();
-
- PagedReference msgCursor = null;
- while ((msgCursor = iterator.next()) != null)
- {
- assertEquals(key++, msgCursor.getMessage().getIntProperty("key").intValue());
- cursor.ack(msgCursor);
- }
- assertEquals(NUM_MESSAGES, key);
-
- forceGC();
-
- // assertTrue(cursorProvider.getCacheSize() < numberOfPages);
-
- server.stop();
- createServer();
- waitCleanup();
- assertEquals(1, lookupPageStore(ADDRESS).getNumberOfPages());
- }
-
public void testFirstMessageInTheMiddlePersistent() throws Exception
{
@@ -1264,6 +1152,8 @@
server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<String, AddressSettings>());
server.start();
+
+ queueList.clear();
try
{
13 years, 10 months
JBoss hornetq SVN: r10386 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/journal.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-03-27 21:25:31 -0400 (Sun, 27 Mar 2011)
New Revision: 10386
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java
Log:
fixing test
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java 2011-03-28 01:20:38 UTC (rev 10385)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java 2011-03-28 01:25:31 UTC (rev 10386)
@@ -55,12 +55,12 @@
protected void setUp() throws Exception
{
super.setUp();
- setupServer(JournalType.ASYNCIO);
+ setupServer(JournalType.NIO);
}
public void testProduceAndConsume() throws Throwable
{
- int numberOfConsumers = 60;
+ int numberOfConsumers = 5;
// this test assumes numberOfConsumers == numberOfProducers
int numberOfProducers = numberOfConsumers;
int produceMessage = 10000;
@@ -120,7 +120,7 @@
server.stop();
- setupServer(JournalType.ASYNCIO);
+ setupServer(JournalType.NIO);
ClientSession sess = sf.createSession(true, true);
13 years, 10 months
JBoss hornetq SVN: r10385 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-03-27 21:20:38 -0400 (Sun, 27 Mar 2011)
New Revision: 10385
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java
Log:
fixing stress test
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java 2011-03-28 01:07:15 UTC (rev 10384)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java 2011-03-28 01:20:38 UTC (rev 10385)
@@ -221,15 +221,9 @@
ClientConsumer consumers[] = new ClientConsumer[] { session.createConsumer(queue[0]),
session.createConsumer(queue[1]) };
- int reads = 0;
-
while (true)
{
int msgs1 = readMessages(session, consumers[0], queue[0]);
- if (reads++ == 0)
- {
- Assert.assertTrue(msgs1 > 0 && msgs1 < NUMBER_OF_MESSAGES);
- }
int msgs2 = readMessages(session, consumers[1], queue[1]);
counters[0] += msgs1;
counters[1] += msgs2;
13 years, 10 months
JBoss hornetq SVN: r10384 - in branches/Branch_2_2_EAP: hornetq-rest and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-03-27 21:07:15 -0400 (Sun, 27 Mar 2011)
New Revision: 10384
Modified:
branches/Branch_2_2_EAP/build-maven.xml
branches/Branch_2_2_EAP/hornetq-rest/pom.xml
Log:
change version
Modified: branches/Branch_2_2_EAP/build-maven.xml
===================================================================
--- branches/Branch_2_2_EAP/build-maven.xml 2011-03-28 01:04:19 UTC (rev 10383)
+++ branches/Branch_2_2_EAP/build-maven.xml 2011-03-28 01:07:15 UTC (rev 10384)
@@ -13,7 +13,7 @@
-->
<project default="upload" name="HornetQ">
- <property name="hornetq.version" value="2.2.1.GA-10362"/>
+ <property name="hornetq.version" value="2.2.2.GA"/>
<property name="build.dir" value="build"/>
<property name="jars.dir" value="${build.dir}/jars"/>
Modified: branches/Branch_2_2_EAP/hornetq-rest/pom.xml
===================================================================
--- branches/Branch_2_2_EAP/hornetq-rest/pom.xml 2011-03-28 01:04:19 UTC (rev 10383)
+++ branches/Branch_2_2_EAP/hornetq-rest/pom.xml 2011-03-28 01:07:15 UTC (rev 10384)
@@ -10,7 +10,7 @@
<properties>
<resteasy.version>2.0.1.GA</resteasy.version>
- <hornetq.version>2.2.1.GA-10362</hornetq.version>
+ <hornetq.version>2.2.2.GA</hornetq.version>
</properties>
<licenses>
13 years, 10 months
JBoss hornetq SVN: r10383 - branches/Branch_2_2_EAP/src/config/common.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-03-27 21:04:19 -0400 (Sun, 27 Mar 2011)
New Revision: 10383
Modified:
branches/Branch_2_2_EAP/src/config/common/hornetq-version.properties
Log:
changing version name
Modified: branches/Branch_2_2_EAP/src/config/common/hornetq-version.properties
===================================================================
--- branches/Branch_2_2_EAP/src/config/common/hornetq-version.properties 2011-03-28 00:07:43 UTC (rev 10382)
+++ branches/Branch_2_2_EAP/src/config/common/hornetq-version.properties 2011-03-28 01:04:19 UTC (rev 10383)
@@ -1,7 +1,7 @@
-hornetq.version.versionName=Zmmmmmmmm
+hornetq.version.versionName=Favo de Mel
hornetq.version.majorVersion=2
hornetq.version.minorVersion=2
-hornetq.version.microVersion=1
+hornetq.version.microVersion=2
hornetq.version.incrementingVersion=121
hornetq.version.versionSuffix=GA
hornetq.version.versionTag=GA
13 years, 10 months
JBoss hornetq SVN: r10382 - branches/Branch_2_2_EAP.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-03-27 20:07:43 -0400 (Sun, 27 Mar 2011)
New Revision: 10382
Modified:
branches/Branch_2_2_EAP/build-hornetq.xml
Log:
changing svn url on build and manifest
Modified: branches/Branch_2_2_EAP/build-hornetq.xml
===================================================================
--- branches/Branch_2_2_EAP/build-hornetq.xml 2011-03-27 12:28:29 UTC (rev 10381)
+++ branches/Branch_2_2_EAP/build-hornetq.xml 2011-03-28 00:07:43 UTC (rev 10382)
@@ -42,7 +42,7 @@
<!-- Version properties are read from hornetq-version.properties instead of duplicating them here -->
<property file="src/config/common/hornetq-version.properties"/>
<property name="hornetq.version.revision" value="0" />
- <property name="hornetq.version.svnurl" value="https://svn.jboss.org/repos/hornetq/trunk"/>
+ <property name="hornetq.version.svnurl" value="https://svn.jboss.org/repos/hornetq/branches/Branch_2_2_EAP"/>
<property name="hornetq.version.string"
value="${hornetq.version.majorVersion}.${hornetq.version.minorVersion}.${hornetq.version.microVersion}.${hornetq.version.versionSuffix} (${hornetq.version.versionName}, ${hornetq.version.incrementingVersion})"/>
<property name="module.version"
13 years, 10 months
JBoss hornetq SVN: r10381 - trunk/tests/src/org/hornetq/tests/integration/journal.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-03-27 08:28:29 -0400 (Sun, 27 Mar 2011)
New Revision: 10381
Modified:
trunk/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java
Log:
removing mistake
Modified: trunk/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java 2011-03-27 12:26:13 UTC (rev 10380)
+++ trunk/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java 2011-03-27 12:28:29 UTC (rev 10381)
@@ -39,18 +39,6 @@
// Public --------------------------------------------------------
// Package protected ---------------------------------------------
-
- public void testLoop() throws Exception
- {
- int i = 0 ;
- while (true)
- {
- System.out.println("#test " + (i++));
- testOnRollback();
- tearDown();
- setUp();
- }
- }
// Protected -----------------------------------------------------
@Override
13 years, 10 months
JBoss hornetq SVN: r10380 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/journal.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-03-27 08:26:13 -0400 (Sun, 27 Mar 2011)
New Revision: 10380
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java
Log:
removing mistakenly committed code
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java 2011-03-27 04:58:43 UTC (rev 10379)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java 2011-03-27 12:26:13 UTC (rev 10380)
@@ -39,18 +39,6 @@
// Public --------------------------------------------------------
// Package protected ---------------------------------------------
-
- public void testLoop() throws Exception
- {
- int i = 0 ;
- while (true)
- {
- System.out.println("#test " + (i++));
- testOnRollback();
- tearDown();
- setUp();
- }
- }
// Protected -----------------------------------------------------
@Override
13 years, 10 months
JBoss hornetq SVN: r10379 - in trunk: tests/src/org/hornetq/tests/integration/journal and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-03-27 00:58:43 -0400 (Sun, 27 Mar 2011)
New Revision: 10379
Modified:
trunk/src/main/org/hornetq/core/journal/impl/JournalFilesRepository.java
trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java
trunk/src/main/org/hornetq/core/journal/impl/JournalTransaction.java
trunk/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java
Log:
-r10376:10378 from branch_2_2_eap
Modified: trunk/src/main/org/hornetq/core/journal/impl/JournalFilesRepository.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/JournalFilesRepository.java 2011-03-27 04:55:20 UTC (rev 10378)
+++ trunk/src/main/org/hornetq/core/journal/impl/JournalFilesRepository.java 2011-03-27 04:58:43 UTC (rev 10379)
@@ -59,8 +59,6 @@
private final BlockingDeque<JournalFile> dataFiles = new LinkedBlockingDeque<JournalFile>();
- private final BlockingQueue<JournalFile> pendingCloseFiles = new LinkedBlockingDeque<JournalFile>();
-
private final ConcurrentLinkedQueue<JournalFile> freeFiles = new ConcurrentLinkedQueue<JournalFile>();
private final BlockingQueue<JournalFile> openedFiles = new LinkedBlockingQueue<JournalFile>();
@@ -80,8 +78,6 @@
private final int userVersion;
private Executor openFilesExecutor;
-
- private Executor closeFilesExecutor;
// Static --------------------------------------------------------
@@ -106,18 +102,15 @@
// Public --------------------------------------------------------
- public void setExecutor(final Executor fileExecutor, final Executor closeExecutor)
+ public void setExecutor(final Executor fileExecutor)
{
this.openFilesExecutor = fileExecutor;
- this.closeFilesExecutor = closeExecutor;
}
- public void clear()
+ public void clear() throws Exception
{
dataFiles.clear();
- drainClosedFiles();
-
freeFiles.clear();
for (JournalFile file : openedFiles)
@@ -269,8 +262,19 @@
*/
public synchronized void addFreeFile(final JournalFile file, final boolean renameTmp) throws Exception
{
- if (file.getFile().size() != fileSize)
+ long calculatedSize = 0;
+ try
{
+ calculatedSize = file.getFile().size();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.out.println("Can't get file size on " + file);
+ System.exit(-1);
+ }
+ if (calculatedSize != fileSize)
+ {
JournalFilesRepository.log.warn("Deleting " + file + ".. as it doesn't have the configured size");
file.getFile().delete();
}
@@ -317,23 +321,6 @@
return openedFiles.size();
}
- public void drainClosedFiles()
- {
- JournalFile file;
- try
- {
- while ((file = pendingCloseFiles.poll()) != null)
- {
- file.getFile().close();
- }
- }
- catch (Exception e)
- {
- JournalFilesRepository.log.warn(e.getMessage(), e);
- }
-
- }
-
/**
* <p>This method will instantly return the opened file, and schedule opening and reclaiming.</p>
* <p>In case there are no cached opened files, this method will block until the file was opened,
@@ -406,31 +393,11 @@
openedFiles.offer(nextOpenedFile);
}
- public void closeFile(final JournalFile file)
+ public void closeFile(final JournalFile file) throws Exception
{
fileFactory.deactivateBuffer();
- pendingCloseFiles.add(file);
+ file.getFile().close();
dataFiles.add(file);
-
- Runnable run = new Runnable()
- {
- public void run()
- {
- drainClosedFiles();
- }
- };
-
- // We can't close files while the compactor is running
- // as we may be closing files that are being read by the compactor
- if (closeFilesExecutor == null)
- {
- run.run();
- }
- else
- {
- closeFilesExecutor.execute(run);
- }
-
}
/**
Modified: trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java 2011-03-27 04:55:20 UTC (rev 10378)
+++ trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java 2011-03-27 04:58:43 UTC (rev 10379)
@@ -1655,8 +1655,6 @@
// We need to move to the next file, as we need a clear start for negatives and positives counts
moveNextFile(false);
- filesRepository.drainClosedFiles();
-
// Take the snapshots and replace the structures
dataFilesToProcess.addAll(filesRepository.getDataFiles());
@@ -2544,7 +2542,7 @@
}
});
- filesRepository.setExecutor(filesExecutor, compactorExecutor);
+ filesRepository.setExecutor(filesExecutor);
fileFactory.start();
@@ -2576,7 +2574,7 @@
filesExecutor.shutdown();
- filesRepository.setExecutor(null, null);
+ filesRepository.setExecutor(null);
if (!filesExecutor.awaitTermination(60, TimeUnit.SECONDS))
{
@@ -2590,8 +2588,6 @@
currentFile.getFile().close();
}
- filesRepository.drainClosedFiles();
-
filesRepository.clear();
fileFactory.stop();
@@ -2947,14 +2943,6 @@
callback = null;
}
- if (sync && !compactorRunning.get())
- {
- // In an edge case the transaction could still have pending data from previous files.
- // This shouldn't cause any blocking issues, as this is here to guarantee we cover all possibilities
- // on guaranteeing the data is on the disk
- tx.syncPreviousFiles(fileFactory.isSupportsCallbacks(), currentFile);
- }
-
// We need to add the number of records on currentFile if prepare or commit
if (completeTransaction)
{
@@ -2983,7 +2971,7 @@
}
// You need to guarantee lock.acquire() before calling this method
- private void moveNextFile(final boolean scheduleReclaim) throws InterruptedException
+ private void moveNextFile(final boolean scheduleReclaim) throws Exception
{
filesRepository.closeFile(currentFile);
@@ -3017,7 +3005,6 @@
{
try
{
- filesRepository.drainClosedFiles();
if (!checkReclaimStatus())
{
checkCompact();
Modified: trunk/src/main/org/hornetq/core/journal/impl/JournalTransaction.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/JournalTransaction.java 2011-03-27 04:55:20 UTC (rev 10378)
+++ trunk/src/main/org/hornetq/core/journal/impl/JournalTransaction.java 2011-03-27 04:58:43 UTC (rev 10379)
@@ -193,38 +193,6 @@
data.setNumberOfRecords(getCounter(currentFile));
}
- /** 99.99 % of the times previous files will be already synced, since they are scheduled to be closed.
- * Because of that, this operation should be almost very fast.*/
- public void syncPreviousFiles(final boolean callbacks, final JournalFile currentFile) throws Exception
- {
- if (callbacks)
- {
- if (callbackList != null)
- {
- for (Map.Entry<JournalFile, TransactionCallback> entry : callbackList.entrySet())
- {
- if (entry.getKey() != currentFile)
- {
- entry.getValue().waitCompletion();
- }
- }
- }
- }
- else
- {
- if (pendingFiles != null)
- {
- for (JournalFile file : pendingFiles)
- {
- if (file != currentFile)
- {
- file.getFile().waitForClose();
- }
- }
- }
- }
- }
-
public TransactionCallback getCallback(final JournalFile file) throws Exception
{
if (callbackList == null)
Modified: trunk/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java 2011-03-27 04:55:20 UTC (rev 10378)
+++ trunk/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java 2011-03-27 04:58:43 UTC (rev 10379)
@@ -39,6 +39,18 @@
// Public --------------------------------------------------------
// Package protected ---------------------------------------------
+
+ public void testLoop() throws Exception
+ {
+ int i = 0 ;
+ while (true)
+ {
+ System.out.println("#test " + (i++));
+ testOnRollback();
+ tearDown();
+ setUp();
+ }
+ }
// Protected -----------------------------------------------------
@Override
13 years, 10 months
JBoss hornetq SVN: r10378 - in branches/Branch_2_2_EAP: tests/src/org/hornetq/tests/integration/journal and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-03-27 00:55:20 -0400 (Sun, 27 Mar 2011)
New Revision: 10378
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalFilesRepository.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalTransaction.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java
Log:
https://issues.jboss.org/browse/JBPAPP-6198 - fixing compactor tests
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalFilesRepository.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalFilesRepository.java 2011-03-27 00:43:12 UTC (rev 10377)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalFilesRepository.java 2011-03-27 04:55:20 UTC (rev 10378)
@@ -59,8 +59,6 @@
private final BlockingDeque<JournalFile> dataFiles = new LinkedBlockingDeque<JournalFile>();
- private final BlockingQueue<JournalFile> pendingCloseFiles = new LinkedBlockingDeque<JournalFile>();
-
private final ConcurrentLinkedQueue<JournalFile> freeFiles = new ConcurrentLinkedQueue<JournalFile>();
private final BlockingQueue<JournalFile> openedFiles = new LinkedBlockingQueue<JournalFile>();
@@ -80,8 +78,6 @@
private final int userVersion;
private Executor openFilesExecutor;
-
- private Executor closeFilesExecutor;
// Static --------------------------------------------------------
@@ -106,18 +102,15 @@
// Public --------------------------------------------------------
- public void setExecutor(final Executor fileExecutor, final Executor closeExecutor)
+ public void setExecutor(final Executor fileExecutor)
{
this.openFilesExecutor = fileExecutor;
- this.closeFilesExecutor = closeExecutor;
}
- public void clear()
+ public void clear() throws Exception
{
dataFiles.clear();
- drainClosedFiles();
-
freeFiles.clear();
for (JournalFile file : openedFiles)
@@ -269,8 +262,19 @@
*/
public synchronized void addFreeFile(final JournalFile file, final boolean renameTmp) throws Exception
{
- if (file.getFile().size() != fileSize)
+ long calculatedSize = 0;
+ try
{
+ calculatedSize = file.getFile().size();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.out.println("Can't get file size on " + file);
+ System.exit(-1);
+ }
+ if (calculatedSize != fileSize)
+ {
JournalFilesRepository.log.warn("Deleting " + file + ".. as it doesn't have the configured size");
file.getFile().delete();
}
@@ -317,23 +321,6 @@
return openedFiles.size();
}
- public void drainClosedFiles()
- {
- JournalFile file;
- try
- {
- while ((file = pendingCloseFiles.poll()) != null)
- {
- file.getFile().close();
- }
- }
- catch (Exception e)
- {
- JournalFilesRepository.log.warn(e.getMessage(), e);
- }
-
- }
-
/**
* <p>This method will instantly return the opened file, and schedule opening and reclaiming.</p>
* <p>In case there are no cached opened files, this method will block until the file was opened,
@@ -406,31 +393,11 @@
openedFiles.offer(nextOpenedFile);
}
- public void closeFile(final JournalFile file)
+ public void closeFile(final JournalFile file) throws Exception
{
fileFactory.deactivateBuffer();
- pendingCloseFiles.add(file);
+ file.getFile().close();
dataFiles.add(file);
-
- Runnable run = new Runnable()
- {
- public void run()
- {
- drainClosedFiles();
- }
- };
-
- // We can't close files while the compactor is running
- // as we may be closing files that are being read by the compactor
- if (closeFilesExecutor == null)
- {
- run.run();
- }
- else
- {
- closeFilesExecutor.execute(run);
- }
-
}
/**
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalImpl.java 2011-03-27 00:43:12 UTC (rev 10377)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalImpl.java 2011-03-27 04:55:20 UTC (rev 10378)
@@ -1655,8 +1655,6 @@
// We need to move to the next file, as we need a clear start for negatives and positives counts
moveNextFile(false);
- filesRepository.drainClosedFiles();
-
// Take the snapshots and replace the structures
dataFilesToProcess.addAll(filesRepository.getDataFiles());
@@ -2544,7 +2542,7 @@
}
});
- filesRepository.setExecutor(filesExecutor, compactorExecutor);
+ filesRepository.setExecutor(filesExecutor);
fileFactory.start();
@@ -2576,7 +2574,7 @@
filesExecutor.shutdown();
- filesRepository.setExecutor(null, null);
+ filesRepository.setExecutor(null);
if (!filesExecutor.awaitTermination(60, TimeUnit.SECONDS))
{
@@ -2590,8 +2588,6 @@
currentFile.getFile().close();
}
- filesRepository.drainClosedFiles();
-
filesRepository.clear();
fileFactory.stop();
@@ -2947,14 +2943,6 @@
callback = null;
}
- if (sync && !compactorRunning.get())
- {
- // In an edge case the transaction could still have pending data from previous files.
- // This shouldn't cause any blocking issues, as this is here to guarantee we cover all possibilities
- // on guaranteeing the data is on the disk
- tx.syncPreviousFiles(fileFactory.isSupportsCallbacks(), currentFile);
- }
-
// We need to add the number of records on currentFile if prepare or commit
if (completeTransaction)
{
@@ -2983,7 +2971,7 @@
}
// You need to guarantee lock.acquire() before calling this method
- private void moveNextFile(final boolean scheduleReclaim) throws InterruptedException
+ private void moveNextFile(final boolean scheduleReclaim) throws Exception
{
filesRepository.closeFile(currentFile);
@@ -3017,7 +3005,6 @@
{
try
{
- filesRepository.drainClosedFiles();
if (!checkReclaimStatus())
{
checkCompact();
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalTransaction.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalTransaction.java 2011-03-27 00:43:12 UTC (rev 10377)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalTransaction.java 2011-03-27 04:55:20 UTC (rev 10378)
@@ -193,38 +193,6 @@
data.setNumberOfRecords(getCounter(currentFile));
}
- /** 99.99 % of the times previous files will be already synced, since they are scheduled to be closed.
- * Because of that, this operation should be almost very fast.*/
- public void syncPreviousFiles(final boolean callbacks, final JournalFile currentFile) throws Exception
- {
- if (callbacks)
- {
- if (callbackList != null)
- {
- for (Map.Entry<JournalFile, TransactionCallback> entry : callbackList.entrySet())
- {
- if (entry.getKey() != currentFile)
- {
- entry.getValue().waitCompletion();
- }
- }
- }
- }
- else
- {
- if (pendingFiles != null)
- {
- for (JournalFile file : pendingFiles)
- {
- if (file != currentFile)
- {
- file.getFile().waitForClose();
- }
- }
- }
- }
- }
-
public TransactionCallback getCallback(final JournalFile file) throws Exception
{
if (callbackList == null)
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java 2011-03-27 00:43:12 UTC (rev 10377)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/journal/NIOBufferedJournalCompactTest.java 2011-03-27 04:55:20 UTC (rev 10378)
@@ -39,6 +39,18 @@
// Public --------------------------------------------------------
// Package protected ---------------------------------------------
+
+ public void testLoop() throws Exception
+ {
+ int i = 0 ;
+ while (true)
+ {
+ System.out.println("#test " + (i++));
+ testOnRollback();
+ tearDown();
+ setUp();
+ }
+ }
// Protected -----------------------------------------------------
@Override
13 years, 10 months