You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2021/07/07 16:17:46 UTC
[activemq-artemis] 01/02: ARTEMIS-3354 journal-max-io cannot be set
to 1 with ASYNCIO journal
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
commit bb3f31340da15fa3e7c6f93b4eb5cb0db2badb4a
Author: franz1981 <ni...@gmail.com>
AuthorDate: Thu Jun 17 09:49:50 2021 +0200
ARTEMIS-3354 journal-max-io cannot be set to 1 with ASYNCIO journal
---
.../activemq/artemis/core/io/aio/AIOSequentialFileFactory.java | 3 ++-
.../tests/integration/journal/AIOSequentialFileFactoryTest.java | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
index bfa25be..94e2eb4 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
@@ -112,7 +112,8 @@ public final class AIOSequentialFileFactory extends AbstractSequentialFileFactor
final IOCriticalErrorListener listener,
final CriticalAnalyzer analyzer) {
super(journalDir, true, bufferSize, bufferTimeout, maxIO, logRates, listener, analyzer);
- callbackPool = PlatformDependent.hasUnsafe() ? new MpmcArrayQueue<>(maxIO) : new MpmcAtomicArrayQueue<>(maxIO);
+ final int adjustedMaxIO = Math.max(2, maxIO);
+ callbackPool = PlatformDependent.hasUnsafe() ? new MpmcArrayQueue<>(adjustedMaxIO) : new MpmcAtomicArrayQueue<>(adjustedMaxIO);
if (logger.isTraceEnabled()) {
logger.trace("New AIO File Created");
}
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/AIOSequentialFileFactoryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/AIOSequentialFileFactoryTest.java
index 4e7f315..2193f7f 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/AIOSequentialFileFactoryTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/AIOSequentialFileFactoryTest.java
@@ -40,6 +40,11 @@ public class AIOSequentialFileFactoryTest extends SequentialFileFactoryTestBase
}
@Test
+ public void canCreateFactoryWithMaxIOLessThenTwo() {
+ AIOSequentialFileFactory factory = new AIOSequentialFileFactory(new File("ignore"), 1);
+ }
+
+ @Test
public void testBuffer() throws Exception {
SequentialFile file = factory.createSequentialFile("filtetmp.log");
file.open();