ARTEMIS-975: Add transactional records to deletedRecords to check for committed transactions that also hold references to

This commit is contained in:
Benjamin Graf 2020-03-23 13:10:12 +01:00 committed by Justin Bertram
parent 489e6b38e0
commit 4b49b3f371
2 changed files with 14 additions and 0 deletions

View File

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

View File

@ -178,6 +178,19 @@ public class JDBCJournalTest extends ActiveMQTestBase {
assertEquals(0, journal.getNumberOfRecords());
}
@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;