You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by mi...@apache.org on 2019/08/19 15:47:33 UTC

[activemq-artemis] branch master updated: ARTEMIS-2407 Large message file not deleted if broker crashes between page deleted and pending large message written

This is an automated email from the ASF dual-hosted git repository.

michaelpearce pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new e537fbf  ARTEMIS-2407 Large message file not deleted if broker crashes between page deleted and pending large message written
     new 9cb689f  This closes #2738
e537fbf is described below

commit e537fbfde06a5a09ef369401e715970c4003bd32
Author: yang wei <wy...@gmail.com>
AuthorDate: Tue Jul 2 14:40:12 2019 +0800

    ARTEMIS-2407 Large message file not deleted if broker crashes between page deleted and pending large message written
---
 .../main/java/org/apache/activemq/artemis/core/paging/impl/Page.java | 5 +++++
 .../apache/activemq/artemis/core/server/ActiveMQServerLogger.java    | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java
index ca6ad9a..a7a164d 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java
@@ -491,6 +491,7 @@ public final class Page implements Comparable<Page> {
          logger.debug("Deleting pageNr=" + pageId + " on store " + storeName);
       }
 
+      List<Long> largeMessageIds = new ArrayList<>();
       if (messages != null) {
          for (PagedMessage msg : messages) {
             if (msg.getMessage() instanceof ICoreMessage && (msg.getMessage()).isLargeMessage()) {
@@ -500,11 +501,15 @@ public final class Page implements Comparable<Page> {
                // Because the large-message may be linked to another message
                // or it may still being delivered even though it has been acked already
                lmsg.decrementDelayDeletionCount();
+               largeMessageIds.add(lmsg.getMessageID());
             }
          }
       }
 
       try {
+         if (!storageManager.waitOnOperations(5000)) {
+            ActiveMQServerLogger.LOGGER.timedOutWaitingForLargeMessagesDeletion(largeMessageIds);
+         }
          if (suspiciousRecords) {
             ActiveMQServerLogger.LOGGER.pageInvalid(file.getFileName(), file.getFileName());
             file.renameTo(file.getFileName() + ".invalidPage");
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
index babf60c..e37e2bf 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
@@ -2016,4 +2016,9 @@ public interface ActiveMQServerLogger extends BasicLogger {
    @Message(id = 224099, value = "Message with ID {0} has a header too large. More information available on debug level for class {1}",
       format = Message.Format.MESSAGE_FORMAT)
    void messageWithHeaderTooLarge(Long messageID, String loggerClass);
+
+   @LogMessage(level = Logger.Level.INFO)
+   @Message(id = 224100, value = "Timed out waiting for large messages deletion with IDs {0}, might not be deleted if broker crashes atm",
+      format = Message.Format.MESSAGE_FORMAT)
+   void timedOutWaitingForLargeMessagesDeletion(List<Long> largeMessageIds);
 }