You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2020/03/24 14:42:32 UTC

[activemq-artemis] branch master updated: ARTEMIS-975: Add transactional records to deletedRecords to check for committed transactions that also hold references to

This is an automated email from the ASF dual-hosted git repository.

jbertram pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b49b3f  ARTEMIS-975: Add transactional records to deletedRecords to check for committed transactions that also hold references to
     new 265c8f0  This closes #3042
4b49b3f is described below

commit 4b49b3f3713001c94e5efeca017d8a9f3db499f3
Author: Benjamin Graf <be...@gmx.net>
AuthorDate: Mon Mar 23 13:10:12 2020 +0100

    ARTEMIS-975: Add transactional records to deletedRecords to check for committed transactions that also hold references to
---
 .../artemis/jdbc/store/journal/JDBCJournalImpl.java         |  1 +
 .../integration/jdbc/store/journal/JDBCJournalTest.java     | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java
index cde361e..181a61c 100644
--- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java
@@ -232,6 +232,7 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal {
                   holder = transactions.get(record.getTxId());
                   for (RecordInfo info : holder.recordsToDelete) {
                      deletedRecords.add(record.getId());
+                     deletedRecords.add(info.id);
                      deleteJournalRecords.setLong(1, info.id);
                      deleteJournalRecords.addBatch();
                   }
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jdbc/store/journal/JDBCJournalTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jdbc/store/journal/JDBCJournalTest.java
index 0b832a8..46a1027 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jdbc/store/journal/JDBCJournalTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jdbc/store/journal/JDBCJournalTest.java
@@ -179,6 +179,19 @@ public class JDBCJournalTest extends ActiveMQTestBase {
    }
 
    @Test
+   public void testCleanupTxRecords4TransactionalRecords() throws Exception {
+      // add committed transactional record e.g. paging
+      journal.appendAddRecordTransactional(152, 154, (byte) 13, new byte[0]);
+      journal.appendCommitRecord(152, true);
+      assertEquals(2, journal.getNumberOfRecords());
+
+      // delete transactional record in new transaction e.g. depaging
+      journal.appendDeleteRecordTransactional(236, 154);
+      journal.appendCommitRecord(236, true);
+      assertEquals(0, journal.getNumberOfRecords());
+   }
+
+   @Test
    public void testCallbacks() throws Exception {
       final int noRecords = 10;
       final CountDownLatch done = new CountDownLatch(noRecords);