This is an automated email from the ASF dual-hosted git repository.

mivanac pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 9bc288a  GEODE-8421: replace clean with destroy region (#5445)
9bc288a is described below

commit 9bc288a6c421315e8da4fb00d8461f6312fa0ced
Author: Mario Ivanac <48509724+miva...@users.noreply.github.com>
AuthorDate: Tue Oct 6 09:22:38 2020 +0200

    GEODE-8421: replace clean with destroy region (#5445)
---
 .../wan/parallel/ParallelGatewaySenderQueue.java   | 28 ++++++++--------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
 
b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
index 300de32..108eff5 100644
--- 
a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
+++ 
b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
@@ -482,6 +482,12 @@ public class ParallelGatewaySenderQueue implements 
RegionQueue {
 
       final String prQName = sender.getId() + QSTRING + 
convertPathToName(userPR.getFullPath());
       prQ = (PartitionedRegion) cache.getRegion(prQName);
+
+      if ((prQ != null) && (this.index == 0) && this.cleanQueues) {
+        prQ.destroyRegion(null);
+        prQ = null;
+      }
+
       if (prQ == null) {
         RegionShortcut regionShortcut;
         if (sender.isPersistenceEnabled() && !isAccessor) {
@@ -549,20 +555,14 @@ public class ParallelGatewaySenderQueue implements 
RegionQueue {
         // Add the overflow statistics to the mbean
         addOverflowStatisticsToMBean(cache, prQ);
 
-        // Wait for buckets to be recovered.
-        prQ.shadowPRWaitForBucketRecovery();
+        if (!this.cleanQueues) {
+          // Wait for buckets to be recovered.
+          prQ.shadowPRWaitForBucketRecovery();
+        }
 
         if (logger.isDebugEnabled()) {
           logger.debug("{}: Created queue region: {}", this, prQ);
         }
-        if (this.cleanQueues) {
-          // now, clean up the shadowPR's buckets on this node (primary as 
well as
-          // secondary) for a fresh start
-          Set<BucketRegion> localBucketRegions = 
prQ.getDataStore().getAllLocalBucketRegions();
-          for (BucketRegion bucketRegion : localBucketRegions) {
-            bucketRegion.clear();
-          }
-        }
 
       } else {
         if (isAccessor)
@@ -629,14 +629,6 @@ public class ParallelGatewaySenderQueue implements 
RegionQueue {
       logger.debug("{}: No need to create the region as the region has been 
retrieved: {}", this,
           prQ);
     }
-    // now, clean up the shadowPR's buckets on this node (primary as well as
-    // secondary) for a fresh start
-    if (this.cleanQueues) {
-      Set<BucketRegion> localBucketRegions = 
prQ.getDataStore().getAllLocalBucketRegions();
-      for (BucketRegion bucketRegion : localBucketRegions) {
-        bucketRegion.clear();
-      }
-    }
   }
 
   protected void afterRegionAdd(PartitionedRegion userPR) {

Reply via email to