ARTEMIS-3354 journal-max-io cannot be set to 1 with ASYNCIO journal

This commit is contained in:
franz1981 2021-06-17 09:49:50 +02:00 committed by clebertsuconic
parent 7fc312ab5d
commit bb3f31340d
2 changed files with 7 additions and 1 deletions

View File

@ -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");
}

View File

@ -39,6 +39,11 @@ public class AIOSequentialFileFactoryTest extends SequentialFileFactoryTestBase
return new AIOSequentialFileFactory(new File(folder), 10);
}
@Test
public void canCreateFactoryWithMaxIOLessThenTwo() {
AIOSequentialFileFactory factory = new AIOSequentialFileFactory(new File("ignore"), 1);
}
@Test
public void testBuffer() throws Exception {
SequentialFile file = factory.createSequentialFile("filtetmp.log");