activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [activemq-artemis] branch main updated: ARTEMIS-3324 JournalFilesRepository running out of open files while compacting
Date Tue, 01 Jun 2021 20:36:59 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
     new 24c6d90  ARTEMIS-3324 JournalFilesRepository running out of open files while compacting
24c6d90 is described below

commit 24c6d904b968851ab4708640ce20594cdaca0dd9
Author: Clebert Suconic <clebertsuconic@apache.org>
AuthorDate: Tue Jun 1 11:50:27 2021 -0400

    ARTEMIS-3324 JournalFilesRepository running out of open files while compacting
---
 .../artemis/core/journal/impl/JournalFilesRepository.java | 15 ++++++---------
 .../activemq/artemis/journal/ActiveMQJournalLogger.java   |  4 ++++
 .../tests/unit/core/journal/impl/JournalImplTestBase.java | 15 +++++++++++++++
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java
index 6cdf92c..c094a43 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java
@@ -96,13 +96,11 @@ public class JournalFilesRepository {
       @Override
       public void run() {
          // if there's already an opened file there is no need to push a new one
-         if (openedFiles.isEmpty()) {
-            try {
-               pushOpenedFile();
-            } catch (Exception e) {
-               ActiveMQJournalLogger.LOGGER.errorPushingFile(e);
-               fileFactory.onIOError(e, "unable to open ", null);
-            }
+         try {
+            pushOpenedFile();
+         } catch (Exception e) {
+            ActiveMQJournalLogger.LOGGER.errorPushingFile(e);
+            fileFactory.onIOError(e, "unable to open ", null);
          }
       }
    };
@@ -504,8 +502,7 @@ public class JournalFilesRepository {
       }
 
       if (nextFile == null) {
-
-         logger.debug("Could not get a file in " + journalFileOpenTimeout + " seconds, it
will retry directly, without an executor");
+         ActiveMQJournalLogger.LOGGER.cantOpenFileTimeout(journalFileOpenTimeout);
          try {
             nextFile = takeFile(true, true, true, false);
          } catch (Exception e) {
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java
b/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java
index fdd9eb1..53ba9f1 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java
@@ -284,4 +284,8 @@ public interface ActiveMQJournalLogger extends BasicLogger {
    @LogMessage(level = Logger.Level.WARN)
    @Message(id = 144008, value = "*******************************************************************************************************************************\nFile
{0}: was moved under attic, please review it and remove it.\n*******************************************************************************************************************************",
format = Message.Format.MESSAGE_FORMAT)
    void movingFileToAttic(String fileName);
+
+   @LogMessage(level = Logger.Level.WARN)
+   @Message(id = 144009, value = "Could not get a file in {0} seconds, System will retry
the open but you may see increased latency in your system", format = Message.Format.MESSAGE_FORMAT)
+   void cantOpenFileTimeout(long timeout);
 }
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java
index 1a5c866..34b2d9a 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java
@@ -38,6 +38,7 @@ import org.apache.activemq.artemis.core.journal.TestableJournal;
 import org.apache.activemq.artemis.core.journal.impl.JournalFile;
 import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
 import org.apache.activemq.artemis.core.journal.impl.JournalReaderCallback;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.activemq.artemis.utils.ReusableLatch;
 import org.apache.activemq.artemis.utils.collections.SparseArrayLinkedList;
@@ -48,6 +49,20 @@ import org.junit.Before;
 
 public abstract class JournalImplTestBase extends ActiveMQTestBase {
 
+   @Before
+   public void startLogger() {
+      AssertionLoggerHandler.startCapture();
+   }
+
+   @After
+   public void stopLogger() {
+      try {
+         Assert.assertFalse(AssertionLoggerHandler.findText("AMQ144009"));
+      } finally {
+         AssertionLoggerHandler.stopCapture();
+      }
+   }
+
    private static final Logger log = Logger.getLogger(JournalImplTestBase.class);
 
    protected List<RecordInfo> records = new LinkedList<>();

Mime
View raw message