Author: clebert.suconic(a)jboss.com
Date: 2011-06-06 11:33:59 -0400 (Mon, 06 Jun 2011)
New Revision: 10776
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
Log:
HORNETQ-714 - fixing testcase
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-06-06
03:15:13 UTC (rev 10775)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalFilesRepository.java 2011-06-06
15:33:59 UTC (rev 10776)
@@ -356,26 +356,22 @@
{
return freeFiles.size();
}
-
/**
- * Add directly to the freeFiles structure without reinitializing the file.
- * used on load() only
+ * @param file
+ * @throws Exception
*/
- public void addFreeFileNoInit(final JournalFile file)
+ public synchronized void addFreeFile(final JournalFile file, final boolean renameTmp)
throws Exception
{
- freeFiles.add(file);
-
- if (CHECK_CONSISTENCE)
- {
- checkDataFiles();
- }
+ addFreeFile(file, renameTmp, true);
}
/**
* @param file
+ * @param renameTmp - should rename the file as it's being added to free files
+ * @param checkDelete - should delete the file if max condition has been met
* @throws Exception
*/
- public synchronized void addFreeFile(final JournalFile file, final boolean renameTmp)
throws Exception
+ public synchronized void addFreeFile(final JournalFile file, final boolean renameTmp,
final boolean checkDelete) throws Exception
{
long calculatedSize = 0;
try
@@ -395,7 +391,7 @@
}
else
// FIXME - size() involves a scan!!!
- if (freeFiles.size() + dataFiles.size() + 1 + openedFiles.size() < minFiles)
+ if (!checkDelete || (freeFiles.size() + dataFiles.size() + 1 + openedFiles.size()
< minFiles))
{
// Re-initialise it
@@ -415,6 +411,17 @@
}
else
{
+ if (trace)
+ {
+ log.trace("DataFiles.size() = " + dataFiles.size());
+ log.trace("openedFiles.size() = " + openedFiles.size());
+ log.trace("minfiles = " + minFiles);
+ log.trace("Free Files = " + freeFiles.size());
+ log.trace("File " + file +
+ " being deleted as freeFiles.size() + dataFiles.size() + 1 +
openedFiles.size() (" +
+ (freeFiles.size() + dataFiles.size() + 1 + openedFiles.size()) +
+ ") < minFiles (" + minFiles + ")" );
+ }
file.getFile().delete();
}
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-06-06
03:15:13 UTC (rev 10775)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/JournalImpl.java 2011-06-06
15:33:59 UTC (rev 10776)
@@ -2155,7 +2155,7 @@
if (changeData)
{
// Empty dataFiles with no data
- filesRepository.addFreeFile(file, false);
+ filesRepository.addFreeFile(file, false, false);
}
}
}
Show replies by date