activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-1085 Perform storelineup on appendRecord
Date Fri, 31 Mar 2017 14:56:21 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 33fff5265 -> 848090fad


ARTEMIS-1085 Perform storelineup on appendRecord


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/120b8aa7
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/120b8aa7
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/120b8aa7

Branch: refs/heads/master
Commit: 120b8aa7ad314b30bca082fb4f809bfa15a1dea1
Parents: 33fff52
Author: Martyn Taylor <mtaylor@redhat.com>
Authored: Thu Mar 30 16:25:17 2017 +0100
Committer: Martyn Taylor <mtaylor@redhat.com>
Committed: Fri Mar 31 15:50:02 2017 +0100

----------------------------------------------------------------------
 .../jdbc/store/journal/JDBCJournalImpl.java        | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/120b8aa7/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java
----------------------------------------------------------------------
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 2108be7..4df6a17 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
@@ -169,8 +169,6 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal
{
       boolean success = false;
       try {
          for (JDBCJournalRecord record : recordRef) {
-            record.storeLineUp();
-
             switch (record.getRecordType()) {
                case JDBCJournalRecord.DELETE_RECORD:
                   // Standard SQL Delete Record, Non transactional delete
@@ -224,16 +222,16 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal
{
             cleanupTxRecords(deletedRecords, committedTransactions);
       } catch (SQLException e) {
          logger.warn("Failed to remove the Tx Records", e.getMessage(), e);
+      } finally {
+         executeCallbacks(recordRef, success);
       }
 
-      executeCallbacks(recordRef, success);
       return recordRef.size();
    }
 
    /* We store Transaction reference in memory (once all records associated with a Tranascation
are Deleted,
       we remove the Tx Records (i.e. PREPARE, COMMIT). */
    private synchronized void cleanupTxRecords(List<Long> deletedRecords, List<Long>
committedTx) throws SQLException {
-      connection.rollback();
       List<RecordInfo> iterableCopy;
       List<TransactionHolder> iterableCopyTx = new ArrayList<>();
       iterableCopyTx.addAll(transactions.values());
@@ -264,6 +262,8 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal
{
 
    private void performRollback(List<JDBCJournalRecord> records) {
       try {
+         connection.rollback();
+
          for (JDBCJournalRecord record : records) {
             if (record.isTransactional() || record.getRecordType() == JDBCJournalRecord.PREPARE_RECORD)
{
                removeTxRecord(record);
@@ -299,9 +299,10 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal
{
    }
 
    private void appendRecord(JDBCJournalRecord record) throws Exception {
+      record.storeLineUp();
 
       SimpleWaitIOCallback callback = null;
-      if (record.isSync() && record.getIoCompletion() == null && !record.isTransactional())
{
+      if (record.isSync() && record.getIoCompletion() == null) {
          callback = new SimpleWaitIOCallback();
          record.setIoCompletion(callback);
       }
@@ -318,8 +319,9 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal
{
 
       syncTimer.delay();
 
-      if (callback != null)
+      if (callback != null) {
          callback.waitCompletion();
+      }
    }
 
    private synchronized void addTxRecord(JDBCJournalRecord record) {
@@ -510,6 +512,7 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal
{
    public void appendCommitRecord(long txID, boolean sync) throws Exception {
       JDBCJournalRecord r = new JDBCJournalRecord(-1, JDBCJournalRecord.COMMIT_RECORD, seq.incrementAndGet());
       r.setTxId(txID);
+      r.setSync(sync);
       appendRecord(r);
    }
 
@@ -517,6 +520,7 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal
{
    public void appendCommitRecord(long txID, boolean sync, IOCompletion callback) throws
Exception {
       JDBCJournalRecord r = new JDBCJournalRecord(-1, JDBCJournalRecord.COMMIT_RECORD, seq.incrementAndGet());
       r.setTxId(txID);
+      r.setSync(sync);
       r.setIoCompletion(callback);
       appendRecord(r);
    }
@@ -530,6 +534,7 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal
{
       r.setTxId(txID);
       r.setStoreLineUp(lineUpContext);
       r.setIoCompletion(callback);
+      r.setSync(sync);
       appendRecord(r);
    }
 


Mime
View raw message