geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zho...@apache.org
Subject geode git commit: When the colocated child bucket failed to initialize, remove the leader bucket since all these buckets should be created atomically.
Date Sat, 29 Jul 2017 00:47:06 GMT
Repository: geode
Updated Branches:
  refs/heads/feature/GEM-1483 24c004d8a -> a828698b0


When the colocated child bucket failed to initialize, remove the leader
bucket since all these buckets should be created atomically.


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

Branch: refs/heads/feature/GEM-1483
Commit: a828698b0cb1b42516b9899060dd4ab61c9c3cff
Parents: 24c004d
Author: zhouxh <gzhou@pivotal.io>
Authored: Fri Jul 28 17:45:59 2017 -0700
Committer: zhouxh <gzhou@pivotal.io>
Committed: Fri Jul 28 17:45:59 2017 -0700

----------------------------------------------------------------------
 .../internal/cache/PRHARedundancyProvider.java  | 28 +++-----------------
 .../cache/PartitionedRegionDataStore.java       | 19 +++++++++++--
 2 files changed, 21 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/a828698b/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
index 2c1905f..c584b90 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
@@ -1798,30 +1798,10 @@ public class PRHARedundancyProvider {
   public void scheduleCreateMissingBuckets() {
     if (this.prRegion.getColocatedWith() != null
         && ColocationHelper.isColocationComplete(this.prRegion)) {
-      Runnable waitThread = new Runnable() {
-        @Override
-        public void run() {
-          boolean interrupted = false;
-          while (!PRHARedundancyProvider.this.isPersistentRecoveryComplete()) {
-            try {
-              prRegion.getLogger().info("GGG7:waiting for recovery:" + prRegion.getFullPath());
-              prRegion.getCancelCriterion().checkCancelInProgress(null);
-              Thread.sleep(100);
-            } catch (InterruptedException e) {
-              interrupted = true;
-            }
-          }
-
-          if (!interrupted) {
-            prRegion.getLogger().info("GGG7:waited for recovery:" + prRegion.getFullPath());
-            Runnable task = new CreateMissingBucketsTask(PRHARedundancyProvider.this);
-            final InternalResourceManager resourceManager =
-                prRegion.getGemFireCache().getInternalResourceManager();
-            resourceManager.getExecutor().execute(task);
-          }
-        }
-      };
-      waitThread.run();
+      Runnable task = new CreateMissingBucketsTask(PRHARedundancyProvider.this);
+      final InternalResourceManager resourceManager =
+          prRegion.getGemFireCache().getInternalResourceManager();
+      resourceManager.getExecutor().execute(task);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/a828698b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
index bf708a9..3050054 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
@@ -758,6 +758,17 @@ public class PartitionedRegionDataStore implements HasCachePerfStats
{
       }
       this.getPartitionedRegion().checkReadiness();
       throw e;
+    } catch (RuntimeException validationException) {
+      // GEODE-3055
+      PartitionedRegion leader = ColocationHelper.getLeaderRegion(this.partitionedRegion);
+      boolean isLeader = leader.equals(this.partitionedRegion);
+      if (!isLeader) {
+        leader.getDataStore().removeBucket(bucketId, true);
+        logger.info("For bucket " + bucketId + ", failed to create cololcated child bucket
for "
+            + this.partitionedRegion.getFullPath() + ", removed leader region "
+            + leader.getFullPath() + " bucket.");
+      }
+      throw validationException;
     }
     // Determine the size of the bucket (the Region in this case is mirrored,
     // get initial image has populated the bucket, compute the size of the
@@ -1517,17 +1528,21 @@ public class PartitionedRegionDataStore implements HasCachePerfStats
{
       // member is no longer hosting the bucket.
       writeLock.lock();
       try {
+        // forceRemovePrimary==true will enable remove the bucket even when:
+        // 1) it's primary
+        // 2) no other primary ready yet
+        // 3) colocated bucket and its child is not completely ready
         if (!forceRemovePrimary && bucketAdvisor.isPrimary()) {
           return false;
         }
 
         if (isLeader) {
-          if (!isRemotePrimaryReadyForColocatedChildren(bucketId)) {
+          if (!forceRemovePrimary && !isRemotePrimaryReadyForColocatedChildren(bucketId))
{
             return false;
           }
 
           InternalDistributedMember primary = bucketAdvisor.getPrimary();
-          if (primary == null || myId.equals(primary)) {
+          if (!forceRemovePrimary && (primary == null || myId.equals(primary))) {
             if (logger.isDebugEnabled()) {
               logger.debug("Bucket region " + bucketRegion
                   + " does not have a remote primary yet. Not to remove.");


Mime
View raw message