[1/2] activemq-artemis git commit: ARTEMIS-1287 Another fix on CorePluginTest

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[1/2] activemq-artemis git commit: ARTEMIS-1287 Another fix on CorePluginTest

clebertsuconic-2
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 593f99df3 -> f18b4ee0c


ARTEMIS-1287 Another fix on CorePluginTest

Trying to fix this test that's only failing on jenkins


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

Branch: refs/heads/master
Commit: baeca47b44a4b8c62b25b3e31b7b5032c542030b
Parents: 593f99d
Author: Clebert Suconic <[hidden email]>
Authored: Fri Jul 14 00:48:07 2017 -0400
Committer: Clebert Suconic <[hidden email]>
Committed: Fri Jul 14 00:48:12 2017 -0400

----------------------------------------------------------------------
 .../activemq/artemis/tests/integration/plugin/CorePluginTest.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/baeca47b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/CorePluginTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/CorePluginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/CorePluginTest.java
index fa73bcc..191869d 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/CorePluginTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/CorePluginTest.java
@@ -154,7 +154,7 @@ public class CorePluginTest extends JMSTestBase {
 
       conn.close();
 
-      verifier.validatePluginMethodsEquals(0, BEFORE_DELIVER, AFTER_DELIVER, BEFORE_DEPLOY_BRIDGE, AFTER_DEPLOY_BRIDGE);
+      verifier.validatePluginMethodsEquals(0, BEFORE_DEPLOY_BRIDGE, AFTER_DEPLOY_BRIDGE);
       verifier.validatePluginMethodsAtLeast(1, AFTER_CREATE_CONNECTION, AFTER_DESTROY_CONNECTION,
             BEFORE_CREATE_CONSUMER, AFTER_CREATE_CONSUMER, BEFORE_CLOSE_CONSUMER, AFTER_CLOSE_CONSUMER,
             BEFORE_SESSION_METADATA_ADDED, AFTER_SESSION_METADATA_ADDED,

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[2/2] activemq-artemis git commit: ARTEMIS-1287/ARTEMIS-1292 Complete Page on the Journal

clebertsuconic-2
ARTEMIS-1287/ARTEMIS-1292 Complete Page on the Journal

fixing PagingTest.testDeletePhysicalPages


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

Branch: refs/heads/master
Commit: f18b4ee0c9b48c7bad3cb071b43b4b835e8d2c9d
Parents: baeca47
Author: Clebert Suconic <[hidden email]>
Authored: Fri Jul 14 15:04:43 2017 -0400
Committer: Clebert Suconic <[hidden email]>
Committed: Fri Jul 14 15:04:45 2017 -0400

----------------------------------------------------------------------
 .../artemis/core/message/impl/CoreMessage.java      |  5 ++++-
 .../core/paging/cursor/PageSubscription.java        |  2 +-
 .../paging/cursor/impl/PageSubscriptionImpl.java    |  7 ++++++-
 .../artemis/core/paging/impl/PagingStoreImpl.java   | 16 +++++++++++++---
 .../impl/journal/AbstractJournalStorageManager.java |  7 ++++++-
 .../tests/integration/client/HangConsumerTest.java  |  2 ++
 .../tests/integration/paging/PagingTest.java        |  7 ++++---
 7 files changed, 36 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f18b4ee0/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
index 369de7d..0428a58 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
@@ -1079,10 +1079,13 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage {
    @Override
    public String toString() {
       try {
+         checkProperties();
          return "CoreMessage[messageID=" + messageID + ",durable=" + isDurable() + ",userID=" + getUserID() + ",priority=" + this.getPriority()  +
             ", timestamp=" + toDate(getTimestamp()) + ",expiration=" + toDate(getExpiration()) +
-            ", durable=" + durable + ", address=" + getAddress() + ",properties=" + properties.toString() + "]@" + System.identityHashCode(this);
+            ", durable=" + durable + ", address=" + getAddress() + ",properties=" + properties + "]@" + System.identityHashCode(this);
       } catch (Throwable e) {
+         e.printStackTrace();
+         System.exit(-1);
          return "ServerMessage[messageID=" + messageID + "]";
       }
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f18b4ee0/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageSubscription.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageSubscription.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageSubscription.java
index ee05f61..cec7f52 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageSubscription.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageSubscription.java
@@ -96,7 +96,7 @@ public interface PageSubscription {
     */
    void reloadACK(PagePosition position);
 
-   void reloadPageCompletion(PagePosition position) throws Exception;
+   boolean reloadPageCompletion(PagePosition position) throws Exception;
 
    void reloadPageInfo(long pageNr);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f18b4ee0/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
index 6ad4f48..f045151 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
@@ -190,7 +190,10 @@ final class PageSubscriptionImpl implements PageSubscription {
     * cursor/subscription.
     */
    @Override
-   public void reloadPageCompletion(PagePosition position) throws Exception {
+   public boolean reloadPageCompletion(PagePosition position) throws Exception {
+      if (!pageStore.checkPageFileExists((int)position.getPageNr())) {
+         return false;
+      }
       // if the current page is complete, we must move it out of the way
       if (pageStore != null && pageStore.getCurrentPage() != null &&
           pageStore.getCurrentPage().getPageId() == position.getPageNr()) {
@@ -201,6 +204,8 @@ final class PageSubscriptionImpl implements PageSubscription {
       synchronized (consumedPages) {
          consumedPages.put(Long.valueOf(position.getPageNr()), info);
       }
+
+      return true;
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f18b4ee0/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
index 6486ec9..ad9e218 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
@@ -520,6 +520,12 @@ public class PagingStoreImpl implements PagingStore {
    @Override
    public boolean checkPageFileExists(final int pageNumber) {
       String fileName = createFileName(pageNumber);
+
+      try {
+         checkFileFactory();
+      } catch (Exception ignored) {
+      }
+
       SequentialFile file = fileFactory.createSequentialFile(fileName);
       return file.exists();
    }
@@ -528,9 +534,7 @@ public class PagingStoreImpl implements PagingStore {
    public Page createPage(final int pageNumber) throws Exception {
       String fileName = createFileName(pageNumber);
 
-      if (fileFactory == null) {
-         fileFactory = storeFactory.newFileFactory(getStoreName());
-      }
+      checkFileFactory();
 
       SequentialFile file = fileFactory.createSequentialFile(fileName);
 
@@ -546,6 +550,12 @@ public class PagingStoreImpl implements PagingStore {
       return page;
    }
 
+   private void checkFileFactory() throws Exception {
+      if (fileFactory == null) {
+         fileFactory = storeFactory.newFileFactory(getStoreName());
+      }
+   }
+
    @Override
    public void forceAnotherPage() throws Exception {
       openNewPage();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f18b4ee0/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 0eb1dc3..dc399c1 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
@@ -1085,7 +1085,12 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
                   PageSubscription sub = locateSubscription(encoding.queueID, pageSubscriptions, queueInfos, pagingManager);
 
                   if (sub != null) {
-                     sub.reloadPageCompletion(encoding.position);
+                     if (!sub.reloadPageCompletion(encoding.position)) {
+                        if (logger.isDebugEnabled()) {
+                           logger.debug("Complete page " + encoding.position.getPageNr() + " doesn't exist on page manager " + sub.getPagingStore().getAddress());
+                        }
+                        messageJournal.appendDeleteRecord(record.id, false);
+                     }
                   } else {
                      ActiveMQServerLogger.LOGGER.cantFindQueueOnPageComplete(encoding.queueID);
                      messageJournal.appendDeleteRecord(record.id, false);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f18b4ee0/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java
index 2fa89fb..0de19a1 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java
@@ -71,6 +71,7 @@ import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager
 import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
 import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.apache.activemq.artemis.tests.util.Wait;
 import org.apache.activemq.artemis.utils.ExecutorFactory;
 import org.apache.activemq.artemis.utils.ReusableLatch;
 import org.junit.Assert;
@@ -151,6 +152,7 @@ public class HangConsumerTest extends ActiveMQTestBase {
 
          // a flush to guarantee any pending task is finished on flushing out delivery and pending msgs
          queue.flushExecutor();
+         Wait.waitFor(() -> getMessageCount(queue) == 2);
          Assert.assertEquals(2, getMessageCount(queue));
          Assert.assertEquals(2, getMessagesAdded(queue));
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f18b4ee0/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
index 0eb8a57..7eadeca 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
@@ -1430,14 +1430,14 @@ public class PagingTest extends ActiveMQTestBase {
 
       producer = session.createProducer(PagingTest.ADDRESS);
 
-      for (int i = 0; i < numberOfMessages; i++) {
+      for (int i = 0; i < numberOfMessages * 2; i++) {
          message = session.createMessage(true);
 
          ActiveMQBuffer bodyLocal = message.getBodyBuffer();
 
          bodyLocal.writeBytes(body);
 
-         message.putIntProperty(new SimpleString("id"), i);
+         message.putIntProperty(new SimpleString("theid"), i);
 
          producer.send(message);
          if (i % 1000 == 0) {
@@ -1466,12 +1466,13 @@ public class PagingTest extends ActiveMQTestBase {
       for (int msgCount = 0; msgCount < numberOfMessages; msgCount++) {
          log.info("Received " + msgCount);
          msgReceived++;
-         ClientMessage msg = consumer.receiveImmediate();
+         ClientMessage msg = consumer.receive(5000);
          if (msg == null) {
             log.info("It's null. leaving now");
             sessionConsumer.commit();
             fail("Didn't receive a message");
          }
+         System.out.println("Message " + msg.getIntProperty(SimpleString.toSimpleString("theid")));
          msg.acknowledge();
 
          if (msgCount % 5 == 0) {

Loading...