[jboss-cvs] JBoss Messaging SVN: r7503 - in branches/clebert_temp_expirement: tests/src/org/jboss/messaging/tests/integration/journal and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 30 13:42:50 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-06-30 13:42:50 -0400 (Tue, 30 Jun 2009)
New Revision: 7503

Modified:
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalCompactor.java
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalTransaction.java
   branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/NIOJournalCompactTest.java
Log:
tweaks

Modified: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalCompactor.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalCompactor.java	2009-06-30 06:07:44 UTC (rev 7502)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalCompactor.java	2009-06-30 17:42:50 UTC (rev 7503)
@@ -112,7 +112,7 @@
    /** This methods informs the Compactor about the existence of a pending (non committed) transaction */
    public void addPendingTransaction(final long transactionID, final long ids[])
    {
-      pendingTransactions.put(transactionID, new PendingTransaction(transactionID, ids));
+      pendingTransactions.put(transactionID, new PendingTransaction(ids));
    }
 
    /**
@@ -436,7 +436,7 @@
       ByteBuffer bufferWrite = fileFactory.newBuffer(journal.getFileSize());
       channelWrapper = ChannelBuffers.wrappedBuffer(bufferWrite);
 
-      currentFile = journal.getFile(false, false);
+      currentFile = journal.getFile(false, false, false);
       sequentialFile = currentFile.getFile();
       sequentialFile.renameTo(sequentialFile.getFileName() + ".cmp");
       sequentialFile.open(1);
@@ -475,13 +475,10 @@
 
    private class PendingTransaction
    {
-      long transactionID;
-
       long pendingIDs[];
 
-      PendingTransaction(final long transactionID, final long ids[])
+      PendingTransaction(final long ids[])
       {
-         this.transactionID = transactionID;
          pendingIDs = ids;
       }
 

Modified: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2009-06-30 06:07:44 UTC (rev 7502)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2009-06-30 17:42:50 UTC (rev 7503)
@@ -1436,7 +1436,7 @@
          for (int i = 0; i < filesToCreate; i++)
          {
             // Keeping all files opened can be very costly (mainly on AIO)
-            freeFiles.add(createFile(false, false));
+            freeFiles.add(createFile(false, false, true));
          }
       }
 
@@ -2547,7 +2547,7 @@
     * @return
     * @throws Exception
     */
-   private JournalFile createFile(final boolean keepOpened, final boolean multiAIO) throws Exception
+   private JournalFile createFile(final boolean keepOpened, final boolean multiAIO, final boolean fill) throws Exception
    {
       int fileID = generateFileID();
 
@@ -2569,17 +2569,20 @@
          sequentialFile.open(1);
       }
 
-      sequentialFile.fill(0, fileSize, FILL_CHARACTER);
+      if (fill)
+      {
+         sequentialFile.fill(0, fileSize, FILL_CHARACTER);
+   
+         ByteBuffer bb = fileFactory.newBuffer(SIZE_HEADER);
+   
+         bb.putInt(fileID);
+         bb.putInt(fileID);
+   
+         bb.rewind();
+   
+         sequentialFile.write(bb, true);
+      }
 
-      ByteBuffer bb = fileFactory.newBuffer(SIZE_HEADER);
-
-      bb.putInt(fileID);
-      bb.putInt(fileID);
-
-      bb.rewind();
-
-      sequentialFile.write(bb, true);
-
       JournalFile info = new JournalFileImpl(sequentialFile, fileID, fileID);
 
       if (!keepOpened)
@@ -2690,7 +2693,7 @@
     * */
    private void pushOpenedFile() throws Exception
    {
-      JournalFile nextOpenedFile = getFile(true, true);
+      JournalFile nextOpenedFile = getFile(true, true, true);
 
       openedFiles.offer(nextOpenedFile);
    }
@@ -2699,7 +2702,7 @@
     * @return
     * @throws Exception
     */
-   JournalFile getFile(boolean keepOpened, boolean multiAIO) throws Exception
+   JournalFile getFile(boolean keepOpened, boolean multiAIO, boolean fill) throws Exception
    {
       JournalFile nextOpenedFile = null;
       try
@@ -2712,7 +2715,7 @@
 
       if (nextOpenedFile == null)
       {
-         nextOpenedFile = createFile(keepOpened, multiAIO);
+         nextOpenedFile = createFile(keepOpened, multiAIO, fill);
       }
       else
       {

Modified: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalTransaction.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalTransaction.java	2009-06-30 06:07:44 UTC (rev 7502)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalTransaction.java	2009-06-30 17:42:50 UTC (rev 7503)
@@ -333,8 +333,6 @@
             for (Pair<JournalFile, Long> trDelete : neg)
             {
                JournalImpl.JournalRecord posFiles = journal.getRecords().remove(trDelete.b);
-
-               System.out.println("Deleting record " + trDelete.b + " posFiles = " + posFiles);
                
                if (posFiles != null)
                {

Modified: branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/NIOJournalCompactTest.java
===================================================================
--- branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/NIOJournalCompactTest.java	2009-06-30 06:07:44 UTC (rev 7502)
+++ branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/NIOJournalCompactTest.java	2009-06-30 17:42:50 UTC (rev 7503)
@@ -58,6 +58,10 @@
    public void testCrashRenamingFiles() throws Exception
    {
    }
+   
+   public void testCrashDuringCompacting() throws Exception
+   {
+   }
 
    public void testCompactwithPendingXACommit() throws Exception
    {




More information about the jboss-cvs-commits mailing list