Author: clebert.suconic(a)jboss.com
Date: 2010-11-11 17:23:30 -0500 (Thu, 11 Nov 2010)
New Revision: 9877
Modified:
branches/Branch_New_Paging/src/main/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java
branches/Branch_New_Paging/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java
branches/Branch_New_Paging/tests/src/org/hornetq/tests/integration/paging/PageCursorTest.java
Log:
tweaks
Modified:
branches/Branch_New_Paging/src/main/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java
===================================================================
---
branches/Branch_New_Paging/src/main/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java 2010-11-11
17:28:05 UTC (rev 9876)
+++
branches/Branch_New_Paging/src/main/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java 2010-11-11
22:23:30 UTC (rev 9877)
@@ -176,6 +176,8 @@
tx.addOperation(pgtxUpdate);
}
+ tx.setContainsPersistent();
+
pgtxUpdate.addUpdate(this);
}
Modified:
branches/Branch_New_Paging/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java
===================================================================
---
branches/Branch_New_Paging/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java 2010-11-11
17:28:05 UTC (rev 9876)
+++
branches/Branch_New_Paging/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java 2010-11-11
22:23:30 UTC (rev 9877)
@@ -953,8 +953,6 @@
pagingManager.addTransaction(pgTX);
tx.putProperty(TransactionPropertyIndexes.PAGE_TRANSACTION, pgTX);
tx.addOperation(new FinishPageMessageOperation(pgTX));
-
- tx.setContainsPersistent();
}
pgTX.increment(listCtx.getNumberOfQueues());
@@ -1013,7 +1011,8 @@
{
if (!stored)
{
- storageManager.storePageTransaction(tx.getID(), pageTransaction);
+ tx.setContainsPersistent();
+ pageTransaction.store(storageManager, pagingManager, tx);
stored = true;
}
}
Modified:
branches/Branch_New_Paging/tests/src/org/hornetq/tests/integration/paging/PageCursorTest.java
===================================================================
---
branches/Branch_New_Paging/tests/src/org/hornetq/tests/integration/paging/PageCursorTest.java 2010-11-11
17:28:05 UTC (rev 9876)
+++
branches/Branch_New_Paging/tests/src/org/hornetq/tests/integration/paging/PageCursorTest.java 2010-11-11
22:23:30 UTC (rev 9877)
@@ -682,20 +682,15 @@
StorageManager storage = this.server.getStorageManager();
- PageTransactionInfoImpl pgtxRollback = new
PageTransactionInfoImpl(storage.generateUniqueID());
- PageTransactionInfoImpl pgtxForgotten = new
PageTransactionInfoImpl(storage.generateUniqueID());
- PageTransactionInfoImpl pgtxCommit = new
PageTransactionInfoImpl(storage.generateUniqueID());
+ long pgtxRollback = storage.generateUniqueID();
+ long pgtxForgotten = storage.generateUniqueID();
+ long pgtxCommit = storage.generateUniqueID();
- System.out.println("Forgetting tx " + pgtxForgotten.getTransactionID());
-
- this.server.getPagingManager().addTransaction(pgtxRollback);
- this.server.getPagingManager().addTransaction(pgtxCommit);
-
- pgMessages(storage, pageStore, pgtxRollback, 0, NUM_MESSAGES, messageSize);
+ Transaction txRollback = pgMessages(storage, pageStore, pgtxRollback, 0,
NUM_MESSAGES, messageSize);
pageStore.forceAnotherPage();
- pgMessages(storage, pageStore, pgtxForgotten, 100, NUM_MESSAGES, messageSize);
+ Transaction txForgotten = pgMessages(storage, pageStore, pgtxForgotten, 100,
NUM_MESSAGES, messageSize);
pageStore.forceAnotherPage();
- pgMessages(storage, pageStore, pgtxCommit, 200, NUM_MESSAGES, messageSize);
+ Transaction txCommit = pgMessages(storage, pageStore, pgtxCommit, 200,
NUM_MESSAGES, messageSize);
pageStore.forceAnotherPage();
addMessages(300, NUM_MESSAGES, messageSize);
@@ -714,10 +709,12 @@
assertNull(iterator.next());
cursor.printDebug();
- pgtxRollback.rollback();
+
+ txCommit.commit();
- this.server.getPagingManager().removeTransaction(pgtxRollback.getTransactionID());
- pgtxCommit.commit();
+ txRollback.rollback();
+
+ storage.waitOnOperations();
// Second:after pgtxCommit was done
for (int i = 200; i < 300; i++)
@@ -761,11 +758,9 @@
StorageManager storage = this.server.getStorageManager();
- PageTransactionInfoImpl txLazy = new
PageTransactionInfoImpl(storage.generateUniqueID());
-
- server.getPagingManager().addTransaction(txLazy);
+ long pgtxLazy = storage.generateUniqueID();
- pgMessages(storage, pageStore, txLazy, 0, NUM_MESSAGES, messageSize);
+ Transaction txLazy = pgMessages(storage, pageStore, pgtxLazy, 0, NUM_MESSAGES,
messageSize);
addMessages(100, NUM_MESSAGES, messageSize);
@@ -783,6 +778,8 @@
assertNull(iterator.next());
txLazy.commit();
+
+ storage.waitOnOperations();
for (int i = 0; i < 100; i++)
{
@@ -1184,15 +1181,15 @@
* @param messageSize
* @throws Exception
*/
- private void pgMessages(StorageManager storage,
+ private Transaction pgMessages(StorageManager storage,
PagingStoreImpl pageStore,
- PageTransactionInfo pgParameter,
+ long pgParameter,
int start,
final int NUM_MESSAGES,
final int messageSize) throws Exception
{
- TransactionImpl txImpl = new TransactionImpl(pgParameter.getTransactionID(), null,
null);
+ TransactionImpl txImpl = new TransactionImpl(pgParameter, null, storage);
RoutingContext ctx = generateCTX(txImpl);
@@ -1204,6 +1201,8 @@
msg.putIntProperty("key", i);
pageStore.page(msg, ctx, ctx.getContextListing(ADDRESS));
}
+
+ return txImpl;
}