Skip to content

Commit 82e7725

Browse files
Test added - not reproducing an error
1 parent b5c8496 commit 82e7725

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/NIOJournalCompactTest.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,47 @@ public void testCompactPrepareRestart() throws Exception {
496496
loadAndCheck();
497497
}
498498

499+
@Test
500+
public void testCommitOnRolledBack() throws Exception {
501+
502+
ExecutorService executorService = Executors.newSingleThreadExecutor();
503+
runAfter(executorService::shutdownNow);
504+
505+
setup(2, 60 * 1024, false);
506+
507+
createJournal();
508+
509+
startJournal();
510+
511+
load();
512+
513+
addTx(1, 2);
514+
rollback(1);
515+
startCompact();
516+
517+
OperationContextImpl context = new OperationContextImpl(executorService);
518+
journal.appendCommitRecord(1, false, context);
519+
CountDownLatch latch = new CountDownLatch(1);
520+
context.executeOnCompletion(new IOCallback() {
521+
@Override
522+
public void done() {
523+
latch.countDown();
524+
}
525+
526+
@Override
527+
public void onError(int errorCode, String errorMessage) {
528+
latch.countDown();
529+
}
530+
});
531+
532+
assertTrue(latch.await(10, TimeUnit.SECONDS));
533+
534+
finishCompact();
535+
536+
stopJournal();
537+
}
538+
539+
499540
@Test
500541
public void testCompactPrepareRestart2() throws Exception {
501542
setup(2, 60 * 1024, false);

0 commit comments

Comments
 (0)