mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-3162 - ActiveMQ checkpoint worker makes unnecessary repeated calls to Journal.getFileMap(), leading to excessive memory usage
applied variation of the patch with thanks. Now make one call to find the current set of referenced files. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1063669 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ed6a4c7067
commit
62609f099a
|
@ -1137,8 +1137,9 @@ public class MessageDatabase extends ServiceSupport implements BrokerServiceAwar
|
|||
pageFile.flush();
|
||||
|
||||
if( cleanup ) {
|
||||
|
||||
final TreeSet<Integer> gcCandidateSet = new TreeSet<Integer>(journal.getFileMap().keySet());
|
||||
|
||||
final TreeSet<Integer> completeFileSet = new TreeSet<Integer>(journal.getFileMap().keySet());
|
||||
final TreeSet<Integer> gcCandidateSet = new TreeSet<Integer>(completeFileSet);
|
||||
|
||||
// Don't GC files under replication
|
||||
if( journalFilesBeingReplicated!=null ) {
|
||||
|
@ -1220,7 +1221,7 @@ public class MessageDatabase extends ServiceSupport implements BrokerServiceAwar
|
|||
Set<Integer> referencedFileIds = ackMessageFileMap.get(candidate);
|
||||
if (referencedFileIds != null) {
|
||||
for (Integer referencedFileId : referencedFileIds) {
|
||||
if (journal.getFileMap().containsKey(referencedFileId) && !gcCandidates.contains(referencedFileId)) {
|
||||
if (completeFileSet.contains(referencedFileId) && !gcCandidates.contains(referencedFileId)) {
|
||||
// active file that is not targeted for deletion is referenced so don't delete
|
||||
candidates.remove();
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue