[jboss-cvs] JBoss Messaging SVN: r7511 - in branches/clebert_temp_expirement: examples/core/perf/server0 and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jul 1 19:44:05 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-07-01 19:44:04 -0400 (Wed, 01 Jul 2009)
New Revision: 7511

Added:
   branches/clebert_temp_expirement/examples/core/perf/perf2.properties
   branches/clebert_temp_expirement/examples/core/perf/perf3.properties
Modified:
   branches/clebert_temp_expirement/examples/core/perf/build.xml
   branches/clebert_temp_expirement/examples/core/perf/perf.properties
   branches/clebert_temp_expirement/examples/core/perf/server0/jbm-configuration.xml
   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/tests/src/org/jboss/messaging/tests/integration/journal/NIOJournalCompactTest.java
Log:
compact fixes from tests

Modified: branches/clebert_temp_expirement/examples/core/perf/build.xml
===================================================================
--- branches/clebert_temp_expirement/examples/core/perf/build.xml	2009-07-01 18:37:58 UTC (rev 7510)
+++ branches/clebert_temp_expirement/examples/core/perf/build.xml	2009-07-01 23:44:04 UTC (rev 7511)
@@ -35,8 +35,11 @@
    <path id="extra.classpath">
        <path location="server0"/>
    </path>
+
+
+   <property name="file.name" value="perf.properties"/>
    
-   <property name="perf.properties.file.name" value="perf.properties" />
+   <property name="perf.properties.file.name" value="${file.name}" />
 
    <target name="runSender" depends="compile">
       <java classname="org.jboss.core.example.PerfSender" fork="true" resultproperty="example-result">
@@ -78,4 +81,4 @@
       </java>
    </target>
 
-</project>
\ No newline at end of file
+</project>

Modified: branches/clebert_temp_expirement/examples/core/perf/perf.properties
===================================================================
--- branches/clebert_temp_expirement/examples/core/perf/perf.properties	2009-07-01 18:37:58 UTC (rev 7510)
+++ branches/clebert_temp_expirement/examples/core/perf/perf.properties	2009-07-01 23:44:04 UTC (rev 7511)
@@ -1,10 +1,10 @@
-num-messages=1000000
+num-messages=200000
 num-warmup-messages=20000
 message-size=1024
 durable=true
-transacted=false
+transacted=true
 batch-size=1000
-drain-queue=false
+drain-queue=true
 queue-name=perfQueue
 throttle-rate=-1
 address=perfAddress

Added: branches/clebert_temp_expirement/examples/core/perf/perf2.properties
===================================================================
--- branches/clebert_temp_expirement/examples/core/perf/perf2.properties	                        (rev 0)
+++ branches/clebert_temp_expirement/examples/core/perf/perf2.properties	2009-07-01 23:44:04 UTC (rev 7511)
@@ -0,0 +1,18 @@
+num-messages=1000
+num-warmup-messages=0
+message-size=1024
+durable=true
+transacted=false
+batch-size=1000
+drain-queue=true
+throttle-rate=10
+address=perfAddress2
+queue-name=perfQueue2
+host=localhost
+port=5445
+tcp-buffer=1048576
+tcp-no-delay=false
+send-window=1048576
+pre-ack=true
+block-ack=false
+block-persistent=false

Added: branches/clebert_temp_expirement/examples/core/perf/perf3.properties
===================================================================
--- branches/clebert_temp_expirement/examples/core/perf/perf3.properties	                        (rev 0)
+++ branches/clebert_temp_expirement/examples/core/perf/perf3.properties	2009-07-01 23:44:04 UTC (rev 7511)
@@ -0,0 +1,18 @@
+num-messages=1000
+num-warmup-messages=0
+message-size=1024
+durable=true
+transacted=false
+batch-size=1000
+drain-queue=false
+throttle-rate=-1
+address=perfAddress2
+queue-name=perfQueue2
+host=localhost
+port=5445
+tcp-buffer=1048576
+tcp-no-delay=false
+send-window=1048576
+pre-ack=true
+block-ack=false
+block-persistent=false

Modified: branches/clebert_temp_expirement/examples/core/perf/server0/jbm-configuration.xml
===================================================================
--- branches/clebert_temp_expirement/examples/core/perf/server0/jbm-configuration.xml	2009-07-01 18:37:58 UTC (rev 7510)
+++ branches/clebert_temp_expirement/examples/core/perf/server0/jbm-configuration.xml	2009-07-01 23:44:04 UTC (rev 7511)
@@ -21,11 +21,14 @@
    <journal-type>ASYNCIO</journal-type>
    <journal-min-files>20</journal-min-files>
    <journal-aio-buffer-timeout>20000</journal-aio-buffer-timeout>
-   <log-journal-write-rate>true</log-journal-write-rate>
+   <log-journal-write-rate>false</log-journal-write-rate>
    <!-- <perf-blast-pages>5000</perf-blast-pages> -->
 
    
    <queues>
+	   <queue name="perfQueue2">
+	   	<address>perfAddress2</address>
+	   </queue>
 	   <queue name="perfQueue">
 	   	<address>perfAddress</address>
 	   </queue>

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-07-01 18:37:58 UTC (rev 7510)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalCompactor.java	2009-07-01 23:44:04 UTC (rev 7511)
@@ -96,20 +96,6 @@
                                                  final List<JournalFile> newFiles) throws Exception
    {
 
-      System.out.println("****************************** controlFiles (deleted)");
-
-      for (JournalFile file : files)
-      {
-         System.out.println("To be deleted:" + file.getFile().getFileName());
-      }
-
-      System.out.println("****************************** controlFiles (renamed)");
-
-      for (JournalFile file : newFiles)
-      {
-         System.out.println("To be renamed:" + file.getFile().getFileName());
-      }
-
       SequentialFile controlFile = fileFactory.createSequentialFile(FILE_COMPACT_CONTROL, 1);
 
       try
@@ -253,7 +239,6 @@
     */
    public void addCommandCommit(final JournalTransaction liveTransaction, final JournalFile currentFile)
    {
-      log.info("Adding commit command");
       pendingCommands.add(new CommitCompactCommand(liveTransaction, currentFile));
 
       long ids[] = liveTransaction.getPositiveArray();
@@ -287,7 +272,6 @@
 
    public void addCommandRollback(final JournalTransaction liveTransaction, final JournalFile currentFile)
    {
-      log.info("Adding rollback command");
       pendingCommands.add(new RollbackCompactCommand(liveTransaction, currentFile));
    }
 
@@ -297,7 +281,6 @@
     */
    public void addCommandDelete(final long id, final JournalFile usedFile)
    {
-      log.info("Adding delete command");
       pendingCommands.add(new DeleteCompactCommand(id, usedFile));
    }
 
@@ -307,7 +290,6 @@
     */
    public void addCommandUpdate(final long id, final JournalFile usedFile, final int size)
    {
-      log.info("Adding update command");
       pendingCommands.add(new UpdateCompactCommand(id, usedFile, size));
    }
 
@@ -352,7 +334,6 @@
    {
       for (CompactCommand command : pendingCommands)
       {
-         log.info("Replaying " + command.getClass().getName());
          try
          {
             command.execute();
@@ -607,7 +588,6 @@
       @Override
       void execute() throws Exception
       {
-         System.out.println("Deleting command " + id);
          JournalRecord deleteRecord = journal.getRecords().remove(id);
          deleteRecord.delete(usedFile);
       }

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-07-01 18:37:58 UTC (rev 7510)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2009-07-01 23:44:04 UTC (rev 7511)
@@ -91,25 +91,24 @@
    
    
    private static final float COMPACT_MARGIN = 0.3f;
+   
+   private static final int COMPACT_MINIMAL_FILES = 10;
 
    // Static --------------------------------------------------------
 
    private static final Logger log = Logger.getLogger(JournalImpl.class);
 
-   // private static final boolean trace = log.isTraceEnabled();
+   private static final boolean trace = log.isTraceEnabled();
 
    /** This is to be set to true at DEBUG & development only */
    private static final boolean LOAD_TRACE = false;
 
-   private static final boolean trace = true;
-
    // This method exists just to make debug easier.
    // I could replace log.trace by log.info temporarily while I was debugging
    // Journal
    private static final void trace(final String message)
    {
-      System.out.println(message);
-      // log.trace(message);
+      log.trace(message);
    }
 
    // The sizes of primitive types
@@ -901,6 +900,8 @@
          {
             compactingLock.writeLock().unlock();
          }
+         
+         Collections.sort(dataFilesToProcess, new JournalFileComparator());
 
          // Read the files, and use the JournalCompactor class to create the new outputFiles, and the new collections as
          // well
@@ -983,12 +984,6 @@
                   liveTransaction.merge(newTransaction);
                }
             }
-
-            for (Map.Entry<Long, JournalRecord> record : records.entrySet())
-            {
-               trace("We have " + record.getKey() + " on the list now");
-            }
-
          }
          finally
          {
@@ -1030,7 +1025,6 @@
    {
       for (JournalFile file : oldFiles)
       {
-         System.out.println("Reinitializing file " + file);
          dataFiles.remove(file);
          freeFiles.add(reinitializeFile(file));
       }
@@ -1039,9 +1033,6 @@
       {
          String newName = file.getFile().getFileName();
          newName = newName.substring(0, newName.lastIndexOf(".cmp"));
-
-         System.out.println("Renaming file " + newName);
-
          file.getFile().renameTo(newName);
       }
 
@@ -1707,25 +1698,38 @@
    {
       JournalFile[] dataFiles = getDataFiles();
       
-      long totalSize = 0;
+      long totalLiveSize = 0;
       
       for (JournalFile file : dataFiles)
       {
-         totalSize += file.getLiveSize();
+         totalLiveSize += file.getLiveSize();
       }
       
       long totalBytes = (long)dataFiles.length * (long)fileSize;
       
       long compactMargin = (long)(totalBytes * COMPACT_MARGIN);
 
-      if (totalBytes < compactMargin)
+      if (totalLiveSize < compactMargin && compactor == null && dataFiles.length > COMPACT_MINIMAL_FILES)
       {
-         System.out.println("IT SHOULD COMPACT NOW!!!!!!!!!!!!!!!!!!!!"); // deleteme
+
+         log.info("Compacting being started, numberOfDataFiles = " + dataFiles.length + ", liveSize = " + totalLiveSize + ", margin to start compacting = " + compactMargin);
+         Thread t = new Thread()
+         {
+            public void run()
+            {
+               try
+               {
+                  JournalImpl.this.compact();
+               }
+               catch (Exception e)
+               {
+                  log.error(e.getMessage(), e);
+               }
+            }
+         };
+         
+         t.start();
       }
-      else
-      {
-         System.out.println("Total bytes = " + totalBytes + " > compactMarging=" + compactMargin); // deleteme
-      }
    }
 
    public int getDataFilesCount()
@@ -2035,6 +2039,12 @@
 
             if (recordType == PREPARE_RECORD || recordType == COMMIT_RECORD)
             {
+               if (isInvalidSize(journalFileSize, wholeFileBuffer.position(), DataConstants.SIZE_INT))
+               {
+                  wholeFileBuffer.position(pos + 1);
+                  continue;
+               }
+
                transactionCheckNumberOfRecords = wholeFileBuffer.getInt();
 
                if (recordType == PREPARE_RECORD)

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-07-01 18:37:58 UTC (rev 7510)
+++ branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/NIOJournalCompactTest.java	2009-07-01 23:44:04 UTC (rev 7511)
@@ -51,7 +51,7 @@
  */
 public class NIOJournalCompactTest extends JournalImplTestBase
 {
-   private static final Logger log = Logger.getLogger(NIOJournalCompactTest.class);
+   private final Logger log = Logger.getLogger(this.getClass());
 
    private static final int NUMBER_OF_RECORDS = 1000;
 
@@ -251,6 +251,9 @@
             System.out.println("Done");
          }
       };
+      
+      journal.setAutoReclaim(false);
+      
       startJournal();
       load();
 
@@ -780,11 +783,6 @@
 
    }
 
-   protected int getAlignment()
-   {
-      return 1;
-   }
-
    @Override
    protected void setUp() throws Exception
    {




More information about the jboss-cvs-commits mailing list