activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [4/6] activemq-artemis git commit: ARTEMIS-474 fixing page.close() deadlock with replica
Date Fri, 15 Apr 2016 01:14:50 GMT
ARTEMIS-474 fixing page.close() deadlock with replica


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

Branch: refs/heads/master
Commit: 2e894554ca8d0e518f254b22ff3f4cccc9a59475
Parents: 86a81d3
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Thu Apr 7 15:53:52 2016 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Thu Apr 14 18:55:01 2016 -0400

----------------------------------------------------------------------
 .../core/paging/cursor/impl/PageCursorProviderImpl.java   |  6 +++---
 .../apache/activemq/artemis/core/paging/impl/Page.java    | 10 ++++++++--
 .../artemis/core/paging/impl/PagingStoreImpl.java         |  8 ++++----
 .../artemis/core/replication/ReplicationEndpoint.java     |  4 ++--
 4 files changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2e894554/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java
index 5f5e1b3..7dad12b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java
@@ -174,7 +174,7 @@ public class PageCursorProviderImpl implements PageCursorProvider {
       finally {
          try {
             if (page != null) {
-               page.close();
+               page.close(false);
             }
          }
          catch (Throwable ignored) {
@@ -448,14 +448,14 @@ public class PageCursorProviderImpl implements PageCursorProvider {
                }
                finally {
                   try {
-                     depagedPage.close();
+                     depagedPage.close(false);
                   }
                   catch (Exception e) {
                   }
 
                   storageManager.afterPageRead();
                }
-               depagedPage.close();
+               depagedPage.close(false);
                pgdMessages = pgdMessagesList.toArray(new PagedMessage[pgdMessagesList.size()]);
             }
             else {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2e894554/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java
index b2373c9..07579a2 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java
@@ -216,8 +216,14 @@ public final class Page implements Comparable<Page> {
       file.position(0);
    }
 
-   public synchronized void close() throws Exception {
-      if (storageManager != null) {
+   public void close() throws Exception {
+      close(false);
+   }
+
+   /** sendEvent means it's a close happening from a major event such moveNext.
+    *  While reading the cache we don't need (and shouldn't inform the backup */
+   public synchronized void close(boolean sendEvent) throws Exception {
+      if (sendEvent && storageManager != null) {
          storageManager.pageClosed(storeName, pageId);
       }
       if (pageCache != null) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2e894554/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 9a0af15..85a2dc2 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
@@ -348,7 +348,7 @@ public class PagingStoreImpl implements PagingStore {
          flushExecutors();
 
          if (currentPage != null) {
-            currentPage.close();
+            currentPage.close(false);
             currentPage = null;
          }
       }
@@ -390,7 +390,7 @@ public class PagingStoreImpl implements PagingStore {
 
                currentPageId = 0;
                if (currentPage != null) {
-                  currentPage.close();
+                  currentPage.close(false);
                }
                currentPage = null;
 
@@ -589,7 +589,7 @@ public class PagingStoreImpl implements PagingStore {
                }
 
                returnPage = currentPage;
-               returnPage.close();
+               returnPage.close(false);
                currentPage = null;
 
                // The current page is empty... which means we reached the end of the pages
@@ -1021,7 +1021,7 @@ public class PagingStoreImpl implements PagingStore {
          int tmpCurrentPageId = currentPageId + 1;
 
          if (currentPage != null) {
-            currentPage.close();
+            currentPage.close(true);
          }
 
          currentPage = createPage(tmpCurrentPageId);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2e894554/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java
index dabe9fd..7cf5450 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java
@@ -306,7 +306,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
          for (Page page : map.values()) {
             try {
                page.sync();
-               page.close();
+               page.close(false);
             }
             catch (Exception e) {
                ActiveMQServerLogger.LOGGER.errorClosingPageOnReplication(e);
@@ -698,7 +698,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
             }
          }
          else {
-            page.close();
+            page.close(false);
          }
       }
 


Mime
View raw message