[hornetq-commits] JBoss hornetq SVN: r9477 - trunk/src/main/org/hornetq/core/journal/impl.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Jul 27 17:39:28 EDT 2010


Author: clebert.suconic at jboss.com
Date: 2010-07-27 17:39:27 -0400 (Tue, 27 Jul 2010)
New Revision: 9477

Modified:
   trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java
Log:
https://jira.jboss.org/browse/HORNETQ-440 - tweak on freeing prevoius compacted files

Modified: trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java	2010-07-27 21:15:29 UTC (rev 9476)
+++ trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java	2010-07-27 21:39:27 UTC (rev 9477)
@@ -2800,6 +2800,11 @@
    {
       
       // addFreeFiles has to be called through filesExecutor, or the fileID on the orderedFiles may end up in a wrong order
+      // These files are already freed, and are described on the compactor file control. 
+      // In case of crash they will be cleared anyways
+      
+      final CountDownLatch done = new CountDownLatch(1);
+      
       filesExecutor.execute(new Runnable()
       {
          public void run()
@@ -2810,14 +2815,19 @@
                {
                   addFreeFile(file);
                }
-               catch (Exception e)
+               catch (Throwable e)
                {
                   log.warn("Error reinitializing file "  + file, e);
                }
             }
+            done.countDown();
          }
       });
       
+      // need to wait all old files to be freed
+      // to avoid a race where the CTR file is deleted before the init for these files is already done
+      // what could cause a duplicate in case of a crash after the CTR is deleted and before the file is initialized
+      done.await();
 
       for (JournalFile file : newFiles)
       {



More information about the hornetq-commits mailing list