NO-JIRA fix AlignedJournalImplTest intermittent failure
This commit is contained in:
parent
81f89ae9f5
commit
5133e68ea7
|
@ -33,6 +33,7 @@ import org.apache.activemq.artemis.core.journal.PreparedTransactionInfo;
|
||||||
import org.apache.activemq.artemis.core.journal.RecordInfo;
|
import org.apache.activemq.artemis.core.journal.RecordInfo;
|
||||||
import org.apache.activemq.artemis.core.journal.TransactionFailureCallback;
|
import org.apache.activemq.artemis.core.journal.TransactionFailureCallback;
|
||||||
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
|
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
|
||||||
|
import org.apache.activemq.artemis.junit.Wait;
|
||||||
import org.apache.activemq.artemis.tests.unit.UnitTestLogger;
|
import org.apache.activemq.artemis.tests.unit.UnitTestLogger;
|
||||||
import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.FakeSequentialFileFactory;
|
import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.FakeSequentialFileFactory;
|
||||||
import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding;
|
import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding;
|
||||||
|
@ -998,10 +999,11 @@ public class AlignedJournalImplTest extends ActiveMQTestBase {
|
||||||
@Test
|
@Test
|
||||||
public void testReclaimAfterRollabck() throws Exception {
|
public void testReclaimAfterRollabck() throws Exception {
|
||||||
final int JOURNAL_SIZE = 2000;
|
final int JOURNAL_SIZE = 2000;
|
||||||
|
final int COUNT = 10;
|
||||||
|
|
||||||
setupAndLoadJournal(JOURNAL_SIZE, 1);
|
setupAndLoadJournal(JOURNAL_SIZE, 1);
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < COUNT; i++) {
|
||||||
journalImpl.appendAddRecordTransactional(1L, i, (byte) 0, new SimpleEncoding(1, (byte) 0));
|
journalImpl.appendAddRecordTransactional(1L, i, (byte) 0, new SimpleEncoding(1, (byte) 0));
|
||||||
journalImpl.forceMoveNextFile();
|
journalImpl.forceMoveNextFile();
|
||||||
}
|
}
|
||||||
|
@ -1010,6 +1012,9 @@ public class AlignedJournalImplTest extends ActiveMQTestBase {
|
||||||
|
|
||||||
journalImpl.forceMoveNextFile();
|
journalImpl.forceMoveNextFile();
|
||||||
|
|
||||||
|
// wait for the previous call to forceMoveNextFile() to complete
|
||||||
|
assertTrue(Wait.waitFor(() -> factory.listFiles("tt").size() == COUNT + 3, 2000, 50));
|
||||||
|
|
||||||
journalImpl.checkReclaimStatus();
|
journalImpl.checkReclaimStatus();
|
||||||
|
|
||||||
Assert.assertEquals(0, journalImpl.getDataFilesCount());
|
Assert.assertEquals(0, journalImpl.getDataFilesCount());
|
||||||
|
|
Loading…
Reference in New Issue