resolve https://issues.apache.org/activemq/browse/AMQ-2736, logic issue in code that keeps data files with acks around pending message file gc. thanks jgenender - test case to follow

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1005806 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2010-10-08 12:28:42 +00:00
parent 8e83b7f123
commit dd68c61e65
1 changed files with 2 additions and 1 deletions

View File

@ -1202,13 +1202,14 @@ public class MessageDatabase extends ServiceSupport implements BrokerServiceAwar
}
// check we are not deleting file with ack for in-use journal files
final TreeSet<Integer> gcCandidates = new TreeSet<Integer>(gcCandidateSet);
Iterator<Integer> candidates = gcCandidateSet.iterator();
while (candidates.hasNext()) {
Integer candidate = candidates.next();
Set<Integer> referencedFileIds = ackMessageFileMap.get(candidate);
if (referencedFileIds != null) {
for (Integer referencedFileId : referencedFileIds) {
if (journal.getFileMap().containsKey(referencedFileId) && !gcCandidateSet.contains(referencedFileId)) {
if (journal.getFileMap().containsKey(referencedFileId) && !gcCandidates.contains(referencedFileId)) {
// active file that is not targeted for deletion is referenced so don't delete
candidates.remove();
break;