geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject incubator-geode git commit: GEODE-244: Adding debug logging for testRecoverRedundancyParallelAsyncEventQueueSimulation
Date Wed, 21 Oct 2015 00:06:36 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-409 c2db92008 -> ef5d9e2d6


GEODE-244: Adding debug logging for testRecoverRedundancyParallelAsyncEventQueueSimulation

This failure does not reproduce. I've enabled debug logging just for
this one test case so that if it does fail again, I can track down what
happened.


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

Branch: refs/heads/feature/GEODE-409
Commit: ef5d9e2d6c5820b2faf20367b7f4172e77b96efa
Parents: c2db920
Author: Dan Smith <upthewaterspout@apache.org>
Authored: Tue Oct 20 16:24:06 2015 -0700
Committer: Dan Smith <upthewaterspout@apache.org>
Committed: Tue Oct 20 17:06:09 2015 -0700

----------------------------------------------------------------------
 .../PartitionedRegionRebalanceOp.java           | 52 ++++++++++++++------
 .../control/RebalanceOperationDUnitTest.java    | 29 +++++------
 2 files changed, 49 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef5d9e2d/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
index 39f4e97..46eb3df 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
@@ -77,6 +77,7 @@ public class PartitionedRegionRebalanceOp {
   private static final Logger logger = LogService.getLogger();
   
   private static final int MAX_PARALLEL_OPERATIONS = Integer.getInteger("gemfire.MAX_PARALLEL_BUCKET_RECOVERIES",
8);
+  private final boolean DEBUG = Boolean.getBoolean("gemfire.LOG_REBALANCE");
   
   private final boolean simulate;
   private final boolean replaceOfflineData;
@@ -197,9 +198,7 @@ public class PartitionedRegionRebalanceOp {
           membershipChange = false;
           //refetch the partitioned region details after
           //a membership change.
-          if (logger.isDebugEnabled()) {
-            logger.debug("Rebalancing {} detected membership changes. Refetching details",
leaderRegion);
-          }
+          debug("Rebalancing {} detected membership changes. Refetching details", leaderRegion);
           if(this.stats != null) {
             this.stats.incRebalanceMembershipChanges(1);
           }
@@ -222,9 +221,7 @@ public class PartitionedRegionRebalanceOp {
         }
       }
       
-      if (logger.isDebugEnabled()) {
-        logger.debug("Rebalancing {} complete. Model:{}\n", leaderRegion, model);
-      }
+      debug("Rebalancing {} complete. Model:{}\n", leaderRegion, model);
       long end = System.nanoTime();
       
       for(PartitionRebalanceDetailsImpl details : serialOperator.getDetailSet()) {
@@ -444,22 +441,20 @@ public class PartitionedRegionRebalanceOp {
     int totalNumberOfBuckets = leaderRegion.getTotalNumberOfBuckets();
     Set<InternalDistributedMember> criticalMembers = resourceManager.getResourceAdvisor().adviseCritialMembers();;
     boolean removeOverRedundancy = true;
+    
+    debug("Building Model for rebalancing " + leaderRegion
+        + ". redundantCopies=" + redundantCopies + ", totalNumBuckets="
+        + totalNumberOfBuckets + ", criticalMembers=" + criticalMembers
+        + ", simulate=" + simulate);
+
+    
     model = new PartitionedRegionLoadModel(operator, redundantCopies, 
         totalNumberOfBuckets, comparor, criticalMembers, leaderRegion);
 
     for (Map.Entry<PartitionedRegion, InternalPRInfo> entry : detailsMap.entrySet())
{
       PartitionedRegion region = entry.getKey();
       InternalPRInfo details = entry.getValue();
-      if (isDebugEnabled) {
-        logger.debug("Added Region to model region={} details=", region);
-      }
-      for(PartitionMemberInfo memberDetails: details.getPartitionMemberInfo()) {
-        if (isDebugEnabled) {
-          logger.debug("Member: {} LOAD={}", memberDetails.getDistributedMember(), ((InternalPartitionDetails)
memberDetails).getPRLoad());
-        }
-      }
-      Set<InternalPartitionDetails> memberDetailSet = 
-          details.getInternalPartitionDetails();
+      
       OfflineMemberDetails offlineDetails;
       if(replaceOfflineData) {
         offlineDetails = OfflineMemberDetails.EMPTY_DETAILS;
@@ -467,13 +462,38 @@ public class PartitionedRegionRebalanceOp {
         offlineDetails = details.getOfflineMembers();
       }
       boolean enforceLocalMaxMemory = !region.isEntryEvictionPossible();
+
+      debug("Added Region to model region=" + region + ", offlineDetails=" + offlineDetails

+          + ", enforceLocalMaxMemory=" + enforceLocalMaxMemory);
+
+      for(PartitionMemberInfo memberDetails: details.getPartitionMemberInfo()) {
+        debug(
+            "For Region: " + region + ", Member: " + memberDetails.getDistributedMember()
+ "LOAD="
+                + ((InternalPartitionDetails) memberDetails).getPRLoad() 
+                +", equivalentMembers=" 
+                + dm.getMembersInSameZone((InternalDistributedMember) memberDetails.getDistributedMember()));
+      }
+      Set<InternalPartitionDetails> memberDetailSet = 
+          details.getInternalPartitionDetails();
+      
       model.addRegion(region.getFullPath(), memberDetailSet, offlineDetails, enforceLocalMaxMemory);
     }
     
     model.initialize();
     
+    debug("Rebalancing {} starting. Model:\n{}", leaderRegion, model);
+    
     return model;
   }
+  private void debug(String message, Object ...params) {
+    if(logger.isDebugEnabled()) {
+      logger.debug(message, params);
+    } else if(logger.isInfoEnabled() && DEBUG) {
+      logger.info(message, params);
+    }
+    
+  }
+
   /**
    * Create a redundant bucket on the target member
    * 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef5d9e2d/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/control/RebalanceOperationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/control/RebalanceOperationDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/control/RebalanceOperationDUnitTest.java
index 31d889c..e40222c 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/control/RebalanceOperationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/control/RebalanceOperationDUnitTest.java
@@ -17,8 +17,6 @@ import java.util.Properties;
 import java.util.Random;
 import java.util.Set;
 import java.util.TreeSet;
-import java.util.concurrent.BrokenBarrierException;
-import java.util.concurrent.Callable;
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.CyclicBarrier;
@@ -60,7 +58,6 @@ import com.gemstone.gemfire.internal.cache.DiskStoreImpl;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.cache.PartitionedRegion;
 import com.gemstone.gemfire.internal.cache.PartitionedRegionDataStore;
-import com.gemstone.gemfire.internal.cache.control.InternalResourceManager;
 import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceObserverAdapter;
 
 import dunit.AsyncInvocation;
@@ -1087,8 +1084,19 @@ public class RebalanceOperationDUnitTest extends CacheTestCase {
     }
   }
   
-  public void testRecoverRedundancyParallelAsyncEventQueueSimulation() {
-    recoverRedundancyParallelAsyncEventQueue(true);
+  public void testRecoverRedundancyParallelAsyncEventQueueSimulation() throws NoSuchFieldException,
SecurityException {
+    invokeInEveryVM(new SerializableRunnable() {
+
+      @Override
+      public void run () {
+        System.setProperty("gemfire.LOG_REBALANCE", "true");
+      }
+    });
+    try {
+      recoverRedundancyParallelAsyncEventQueue(true);
+    } finally {
+      System.setProperty("gemfire.LOG_REBALANCE", "false");
+    }
   }
   
   public void testRecoverRedundancyParallelAsyncEventQueue() {
@@ -1862,17 +1870,6 @@ public class RebalanceOperationDUnitTest extends CacheTestCase {
    * are correct and we still rebalance correctly
    */
   public void testMoveBucketsOverflowToDisk() throws Throwable {
-    
-    System.setProperty("gemfire.LOG_REBALANCE", "true");
-    invokeInEveryVM(new SerializableCallable() {
-      
-      @Override
-      public Object call() throws Exception {
-        System.setProperty("gemfire.LOG_REBALANCE", "true");
-        return null;
-      }
-    });
-
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);


Mime
View raw message