Repository: activemq-artemis
Updated Branches:
  refs/heads/master f329b5b3f -> 9b104930c


ARTEMIS-1663 Fixing Encoding on PageCountPendingImpl

The PageCountPendingImpl was increasing the encode size without using its full 
allocation.
This was causing issues on replication as the encode is also used to determine 
the size of the packets.
however the packets were not receive the full allocated data causing missing 
packets on the replication
and test failures.

This is fixing the issue


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

Branch: refs/heads/master
Commit: 9b104930c25beeba646d92ab38c6038a11f1e227
Parents: f329b5b
Author: Clebert Suconic <clebertsuco...@apache.org>
Authored: Tue Feb 13 11:38:16 2018 -0500
Committer: Clebert Suconic <clebertsuco...@apache.org>
Committed: Wed Feb 14 09:57:15 2018 -0500

----------------------------------------------------------------------
 .../core/paging/cursor/impl/PageSubscriptionCounterImpl.java     | 4 ++--
 .../apache/activemq/artemis/core/persistence/StorageManager.java | 2 +-
 .../persistence/impl/journal/AbstractJournalStorageManager.java  | 4 ++--
 .../persistence/impl/journal/codec/PageCountPendingImpl.java     | 4 ++--
 .../artemis/core/persistence/impl/nullpm/NullStorageManager.java | 2 +-
 .../artemis/core/transaction/impl/TransactionImplTest.java       | 2 +-
 .../artemis/tests/integration/client/SendAckFailTest.java        | 4 ++--
 7 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b104930/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java
index 3bb56f8..f7a82e1 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java
@@ -135,7 +135,7 @@ public class PageSubscriptionCounterImpl implements 
PageSubscriptionCounter {
          // We have to make sure this is sync here
          // not syncing this to disk may cause the page files to be out of 
sync on pages.
          // we can't afford the case where a page file is written without a 
record here
-         long id = storage.storePendingCounter(this.subscriptionID, 
page.getPageId(), increment);
+         long id = storage.storePendingCounter(this.subscriptionID, 
page.getPageId());
          pendingInfo = new PendingCounter(id, increment, size);
          pendingCounters.put((long) page.getPageId(), pendingInfo);
       } else {
@@ -422,7 +422,7 @@ public class PageSubscriptionCounterImpl implements 
PageSubscriptionCounter {
       /**
        * @param id
        * @param count
-       * @param size
+       * @param persistentSize
        */
       PendingCounter(long id, int count, long persistentSize) {
          super();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b104930/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java
index f9793d8..d025d5e 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java
@@ -338,7 +338,7 @@ public interface StorageManager extends IDGenerator, 
ActiveMQComponent {
     */
    long storePageCounter(long txID, long queueID, long value, long 
persistentSize) throws Exception;
 
-   long storePendingCounter(long queueID, long pageID, int inc) throws 
Exception;
+   long storePendingCounter(long queueID, long pageID) throws Exception;
 
    void deleteIncrementRecord(long txID, long recordID) throws Exception;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b104930/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
index ada5b90..970c926 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
@@ -1388,11 +1388,11 @@ public abstract class AbstractJournalStorageManager 
extends CriticalComponentImp
    }
 
    @Override
-   public long storePendingCounter(final long queueID, final long pageID, 
final int inc) throws Exception {
+   public long storePendingCounter(final long queueID, final long pageID) 
throws Exception {
       readLock();
       try {
          final long recordID = idGenerator.generateID();
-         PageCountPendingImpl pendingInc = new PageCountPendingImpl(queueID, 
pageID, inc);
+         PageCountPendingImpl pendingInc = new PageCountPendingImpl(queueID, 
pageID);
          // We must guarantee the record sync before we actually write on the 
page otherwise we may get out of sync
          // on the counter
          messageJournal.appendAddRecord(recordID, 
JournalRecordIds.PAGE_CURSOR_PENDING_COUNTER, pendingInc, true);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b104930/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountPendingImpl.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountPendingImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountPendingImpl.java
index e600d46..b5698d1 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountPendingImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountPendingImpl.java
@@ -33,7 +33,7 @@ public class PageCountPendingImpl implements EncodingSupport, 
PageCountPending {
 
    }
 
-   public PageCountPendingImpl(long queueID, long pageID, int inc) {
+   public PageCountPendingImpl(long queueID, long pageID) {
       this.queueID = queueID;
       this.pageID = pageID;
    }
@@ -65,7 +65,7 @@ public class PageCountPendingImpl implements EncodingSupport, 
PageCountPending {
 
    @Override
    public int getEncodeSize() {
-      return DataConstants.SIZE_LONG * 3;
+      return DataConstants.SIZE_LONG * 2;
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b104930/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java
index 8c5e11c..995e57b 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java
@@ -472,7 +472,7 @@ public class NullStorageManager implements StorageManager {
    }
 
    @Override
-   public long storePendingCounter(long queueID, long pageID, int inc) throws 
Exception {
+   public long storePendingCounter(long queueID, long pageID) throws Exception 
{
       return -1;
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b104930/artemis-server/src/test/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImplTest.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/test/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImplTest.java
 
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImplTest.java
index 3a9a785..b51be9a 100644
--- 
a/artemis-server/src/test/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImplTest.java
+++ 
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImplTest.java
@@ -592,7 +592,7 @@ public class TransactionImplTest extends ActiveMQTestBase {
       }
 
       @Override
-      public long storePendingCounter(long queueID, long pageID, int inc) 
throws Exception {
+      public long storePendingCounter(long queueID, long pageID) throws 
Exception {
          return 0;
       }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b104930/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java
----------------------------------------------------------------------
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java
index fe9ba17..68c3ea4 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java
@@ -673,8 +673,8 @@ public class SendAckFailTest extends ActiveMQTestBase {
       }
 
       @Override
-      public long storePendingCounter(long queueID, long pageID, int inc) 
throws Exception {
-         return manager.storePendingCounter(queueID, pageID, inc);
+      public long storePendingCounter(long queueID, long pageID) throws 
Exception {
+         return manager.storePendingCounter(queueID, pageID);
       }
 
       @Override

Reply via email to