ARTEMIS-3324 JournalFilesRepository running out of open files while compacting
This commit is contained in:
parent
7ce9030e9f
commit
24c6d904b9
|
@ -96,13 +96,11 @@ public class JournalFilesRepository {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// if there's already an opened file there is no need to push a new one
|
// if there's already an opened file there is no need to push a new one
|
||||||
if (openedFiles.isEmpty()) {
|
try {
|
||||||
try {
|
pushOpenedFile();
|
||||||
pushOpenedFile();
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
ActiveMQJournalLogger.LOGGER.errorPushingFile(e);
|
||||||
ActiveMQJournalLogger.LOGGER.errorPushingFile(e);
|
fileFactory.onIOError(e, "unable to open ", null);
|
||||||
fileFactory.onIOError(e, "unable to open ", null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -504,8 +502,7 @@ public class JournalFilesRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextFile == null) {
|
if (nextFile == null) {
|
||||||
|
ActiveMQJournalLogger.LOGGER.cantOpenFileTimeout(journalFileOpenTimeout);
|
||||||
logger.debug("Could not get a file in " + journalFileOpenTimeout + " seconds, it will retry directly, without an executor");
|
|
||||||
try {
|
try {
|
||||||
nextFile = takeFile(true, true, true, false);
|
nextFile = takeFile(true, true, true, false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -284,4 +284,8 @@ public interface ActiveMQJournalLogger extends BasicLogger {
|
||||||
@LogMessage(level = Logger.Level.WARN)
|
@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)
|
@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);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.JournalFile;
|
||||||
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
|
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
|
||||||
import org.apache.activemq.artemis.core.journal.impl.JournalReaderCallback;
|
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.tests.util.ActiveMQTestBase;
|
||||||
import org.apache.activemq.artemis.utils.ReusableLatch;
|
import org.apache.activemq.artemis.utils.ReusableLatch;
|
||||||
import org.apache.activemq.artemis.utils.collections.SparseArrayLinkedList;
|
import org.apache.activemq.artemis.utils.collections.SparseArrayLinkedList;
|
||||||
|
@ -48,6 +49,20 @@ import org.junit.Before;
|
||||||
|
|
||||||
public abstract class JournalImplTestBase extends ActiveMQTestBase {
|
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);
|
private static final Logger log = Logger.getLogger(JournalImplTestBase.class);
|
||||||
|
|
||||||
protected List<RecordInfo> records = new LinkedList<>();
|
protected List<RecordInfo> records = new LinkedList<>();
|
||||||
|
|
Loading…
Reference in New Issue