You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2017/07/18 18:26:50 UTC
[1/9] geode git commit: GEODE-3049: Add warning on loss of all
buckets in region
Repository: geode
Updated Branches:
refs/heads/feature/GEODE-3049 [created] b788c0a29
GEODE-3049: Add warning on loss of all buckets in region
* Add statistics for count of buckets that have no copies remaining
* Refactor logic for keeping track of redundancy statistics into
separate classes
* Remove dependency of tracking on the PartitionRegionStatistics
(since this can be turned off), but continue recording statistics
to that location
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/8683108d
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/8683108d
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/8683108d
Branch: refs/heads/feature/GEODE-3049
Commit: 8683108dd1ec21bb83001618f493c4eca6438f00
Parents: 65471c1
Author: Nick Reich <nr...@pivotal.io>
Authored: Mon Jun 12 17:29:16 2017 -0700
Committer: Nick Reich <nr...@pivotal.io>
Committed: Mon Jun 12 17:29:16 2017 -0700
----------------------------------------------------------------------
.../geode/internal/cache/BucketAdvisor.java | 118 +--------
.../internal/cache/BucketRedundancyTracker.java | 107 ++++++++
.../geode/internal/cache/PartitionedRegion.java | 9 +
.../PartitionedRegionRedundancyTracker.java | 132 ++++++++++
.../internal/cache/PartitionedRegionStats.java | 13 +
.../cache/partitioned/RegionAdvisor.java | 18 --
.../internal/GlobalCacheExpirationTest.java | 242 +++++++++++++++++++
.../cache/BucketRedundancyTrackerTest.java | 108 +++++++++
.../PartitionedRegionRedundancyTrackerTest.java | 127 ++++++++++
9 files changed, 749 insertions(+), 125 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/8683108d/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
index 0c58963..e8fabb7 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
@@ -89,6 +89,8 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
*/
protected final RegionAdvisor regionAdvisor;
+ private final BucketRedundancyTracker redundancyTracker;
+
/**
* The bucket primary will be holding this distributed lock. Protected by synchronized(this).
*/
@@ -128,25 +130,6 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
static private final Random myRand = new Random();
/**
- * Used by {@link #updateRedundancy()} to determine if stat change is required. Access and
- * mutation are done while synchronized on this advisor.
- *
- * @guarded.By this
- */
- private boolean redundancySatisfied = true;
-
- /**
- * Used by {@link #incLowRedundancyBucketCount(int)} to determine if redundancy for this bucket
- * has ever been satisfied. Only buckets which lose redundancy after having redundancy will
- * generate a redundancy loss alert.
- * <p>
- * Access and mutation are done while synchronized on this advisor.
- *
- * @guarded.By this
- */
- private boolean redundancyEverSatisfied = false;
-
- /**
* A read/write lock to prevent making this bucket not primary while a write is in progress on the
* bucket.
*/
@@ -160,8 +143,6 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
*/
private BucketAdvisor parentAdvisor;
- private volatile int redundancy = -1;
-
/**
* The member that is responsible for choosing the primary for this bucket. While this field is
* set and this member exists, this bucket won't try to become primary.
@@ -188,6 +169,8 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
super(bucket);
this.regionAdvisor = regionAdvisor;
this.pRegion = this.regionAdvisor.getPartitionedRegion();
+ this.redundancyTracker =
+ new BucketRedundancyTracker(pRegion.getRedundantCopies(), pRegion.getRedundancyTracker());
resetParentAdvisor(bucket.getId());
}
@@ -365,64 +348,6 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
}
/**
- * Increment or decrement lowRedundancyBucketCount stat and generate alert only once per loss of
- * redundancy for PR but only if redundancy has ever been satisfied.
- * <p>
- * Caller must synchronize on this BucketAdvisor.
- *
- * @param val the value to increment or decrement by
- * @guarded.By this
- */
- private void incLowRedundancyBucketCount(int val) {
- final int HAS_LOW_REDUNDANCY = 0;
- final int ALREADY_GENERATED_WARNING = 1;
-
- final PartitionedRegionStats stats = getPartitionedRegionStats();
- final boolean[] lowRedundancyFlags = this.regionAdvisor.getLowRedundancyFlags();
- final int configuredRedundancy = this.pRegion.getRedundantCopies();
-
- synchronized (lowRedundancyFlags) {
- stats.incLowRedundancyBucketCount(val);
-
- if (stats.getLowRedundancyBucketCount() == 0) {
- // all buckets are fully redundant
- lowRedundancyFlags[HAS_LOW_REDUNDANCY] = false; // reset
- lowRedundancyFlags[ALREADY_GENERATED_WARNING] = false; // reset
- stats.setActualRedundantCopies(configuredRedundancy);
- }
-
- else {
- // one or more buckets are not fully redundant
- int numBucketHosts = getBucketRedundancy() + 1;
- int actualRedundancy = Math.max(numBucketHosts - 1, 0); // zero or more
-
- if (actualRedundancy < stats.getActualRedundantCopies()) {
- // need to generate an alert for this lower actual redundancy
- lowRedundancyFlags[ALREADY_GENERATED_WARNING] = false;
- }
-
- if (!lowRedundancyFlags[HAS_LOW_REDUNDANCY]
- || !lowRedundancyFlags[ALREADY_GENERATED_WARNING]) {
- // either we have lower redundancy or we never generated an alert
-
- lowRedundancyFlags[HAS_LOW_REDUNDANCY] = true;
- stats.setActualRedundantCopies(actualRedundancy);
-
- // this bucket will only generate alert if redundancyEverSatisfied
- if (!lowRedundancyFlags[ALREADY_GENERATED_WARNING] && this.redundancyEverSatisfied) {
-
- lowRedundancyFlags[ALREADY_GENERATED_WARNING] = true;
- logger.warn(LocalizedMessage.create(
- LocalizedStrings.BucketAdvisor_REDUNDANCY_HAS_DROPPED_BELOW_0_CONFIGURED_COPIES_TO_1_ACTUAL_COPIES_FOR_2,
- new Object[] {Integer.valueOf(configuredRedundancy),
- Integer.valueOf(actualRedundancy), this.pRegion.getFullPath()}));
- }
- }
- }
- }
- }
-
- /**
* Return (and possibly choose) a thread-sticky member from whose data store this bucket's values
* should be read
*
@@ -1007,10 +932,7 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
wasPrimary = isPrimary();
super.close();
this.requestPrimaryState(CLOSED);
- if (!this.redundancySatisfied) {
- incLowRedundancyBucketCount(-1);
- this.redundancySatisfied = true;
- }
+ this.redundancyTracker.closeBucket();
this.localProfile = null;
}
if (wasPrimary) {
@@ -1797,32 +1719,14 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
}
/**
- * Determine if there has been a change in redundancy and alter the lowRedundancyBucketCount stat
- * as needed.
- *
- * Also updates a counter used to track the redundancy of this member
- *
- * @return current number of hosts for this bucket
- * @see #redundancySatisfied
- * @see PartitionedRegionStats#incLowRedundancyBucketCount(int)
- * @guarded.By this
+ * Get the current number of bucket hosts and update the redundancy statistics for the region
+ *
+ * @return number of current bucket hosts
*/
private int updateRedundancy() {
- int desiredRedundancy = this.pRegion.getRedundantCopies();
int numBucketHosts = getNumInitializedBuckets();
- if (isClosed()) {
- return numBucketHosts;
- }
- int actualRedundancy = numBucketHosts - 1;
- this.redundancy = actualRedundancy;
- if (this.redundancySatisfied && numBucketHosts > 0 && actualRedundancy < desiredRedundancy) {
- incLowRedundancyBucketCount(1);
- this.redundancySatisfied = false;
- } else if (!this.redundancySatisfied && numBucketHosts > 0
- && actualRedundancy >= desiredRedundancy) {
- incLowRedundancyBucketCount(-1);
- this.redundancySatisfied = true;
- this.redundancyEverSatisfied = true;
+ if (!isClosed()) {
+ redundancyTracker.updateStatistics(numBucketHosts);
}
return numBucketHosts;
}
@@ -1882,7 +1786,7 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
* @return current number of hosts of this bucket ; -1 if there are no hosts
*/
public int getBucketRedundancy() {
- return redundancy;
+ return redundancyTracker.getCurrentRedundancy();
}
public Set<InternalDistributedMember> adviseInitialized() {
http://git-wip-us.apache.org/repos/asf/geode/blob/8683108d/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
new file mode 100644
index 0000000..da36f9a
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+/**
+ * Keeps track of redundancy status for a PartitionedRegion and (if enabled) updates the statistics
+ * for the region.
+ */
+class BucketRedundancyTracker {
+ private boolean redundancySatisfied = false;
+ private boolean hasAnyCopies = false;
+ private boolean redundancyEverSatisfied = false;
+ private boolean hasEverHadCopies = false;
+ private volatile int currentRedundancy = -1;
+ private final int targetRedundancy;
+ private final PartitionedRegionRedundancyTracker regionRedundancyTracker;
+
+ /**
+ * Creates a new BucketRedundancyTracker
+ *
+ * @param redundantCopies the number of redundant copies specified for the
+ * {@link PartitionedRegion} of this bucket
+ * @param regionRedundancyTracker the redundancy tracker for the {@link PartitionedRegion} of this
+ * bucket
+ */
+ BucketRedundancyTracker(int redundantCopies,
+ PartitionedRegionRedundancyTracker regionRedundancyTracker) {
+ this.targetRedundancy = redundantCopies;
+ this.regionRedundancyTracker = regionRedundancyTracker;
+ }
+
+ /**
+ * Adjust statistics based on closing a bucket
+ */
+ void closeBucket() {
+ if (!redundancySatisfied) {
+ regionRedundancyTracker.decrementLowRedundancyBucketCount();
+ redundancySatisfied = true;
+ }
+ if (!hasAnyCopies) {
+ regionRedundancyTracker.decrementNoCopiesBucketCount();
+ hasAnyCopies = true;
+ }
+ }
+
+ /**
+ * Determines if there has been a change in current redundancy and updates statistics on
+ * redundancy for the region of the bucket for this tracker
+ *
+ * @param currentBucketHosts number of current hosts for the bucket
+ */
+ void updateStatistics(int currentBucketHosts) {
+ updateNoCopiesStatistics(currentBucketHosts);
+ updateRedundancyStatistics(currentBucketHosts);
+ }
+
+ /**
+ * Provides the current redundancy of the bucket for this tracker
+ * @return number of redundant copies of the bucket for this tracker
+ */
+ int getCurrentRedundancy() {
+ return currentRedundancy;
+ }
+
+ private void updateNoCopiesStatistics(int currentBucketHosts) {
+ if (hasAnyCopies && currentBucketHosts == 0) {
+ hasAnyCopies = false;
+ regionRedundancyTracker.incrementNoCopiesBucketCount();
+ } else if (!hasAnyCopies && currentBucketHosts > 0) {
+ if (hasEverHadCopies) {
+ regionRedundancyTracker.decrementNoCopiesBucketCount();
+ }
+ hasEverHadCopies = true;
+ hasAnyCopies = true;
+ }
+ }
+
+ private void updateRedundancyStatistics(int currentBucketHosts) {
+ int actualRedundancy = currentBucketHosts - 1;
+ currentRedundancy = actualRedundancy;
+ if (actualRedundancy < targetRedundancy) {
+ if (redundancySatisfied) {
+ regionRedundancyTracker.incrementLowRedundancyBucketCount();
+ redundancySatisfied = false;
+ }
+ regionRedundancyTracker.reportBucketCount(currentBucketHosts);
+ } else if (!redundancySatisfied && actualRedundancy >= targetRedundancy) {
+ if (redundancyEverSatisfied) {
+ regionRedundancyTracker.decrementLowRedundancyBucketCount();
+ }
+ redundancySatisfied = true;
+ redundancyEverSatisfied = true;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/8683108d/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
index 288f4a9..f1746ee 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
@@ -569,6 +569,10 @@ public class PartitionedRegion extends LocalRegion
}
};
+ PartitionedRegionRedundancyTracker getRedundancyTracker() {
+ return redundancyTracker;
+ }
+
public static class PRIdMap extends HashMap {
private static final long serialVersionUID = 3667357372967498179L;
@@ -713,6 +717,8 @@ public class PartitionedRegion extends LocalRegion
private AbstractGatewaySender parallelGatewaySender = null;
+ private final PartitionedRegionRedundancyTracker redundancyTracker;
+
/**
* Constructor for a PartitionedRegion. This has an accessor (Region API) functionality and
* contains a datastore for actual storage. An accessor can act as a local cache by having a local
@@ -754,6 +760,9 @@ public class PartitionedRegion extends LocalRegion
// getScope is overridden to return the correct scope.
// this.scope = Scope.LOCAL;
this.redundantCopies = regionAttributes.getPartitionAttributes().getRedundantCopies();
+ this.redundancyTracker =
+ new PartitionedRegionRedundancyTracker(this.totalNumberOfBuckets, this.redundantCopies,
+ this.prStats, getFullPath());
this.prStats.setConfiguredRedundantCopies(
regionAttributes.getPartitionAttributes().getRedundantCopies());
this.prStats.setLocalMaxMemory(
http://git-wip-us.apache.org/repos/asf/geode/blob/8683108d/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
new file mode 100644
index 0000000..71b9ceb
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.internal.cache;
+
+import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.logging.log4j.LocalizedMessage;
+import org.apache.logging.log4j.Logger;
+
+/**
+ * Keeps track redundancy statistics across the buckets of a given {@link PartitionedRegion}
+ */
+public class PartitionedRegionRedundancyTracker {
+ private static final Logger logger = LogService.getLogger();
+
+ private final PartitionedRegionStats stats;
+ private final String regionPath;
+ private final int totalBuckets;
+ private final int targetRedundancy;
+
+ private int lowRedundancyBuckets;
+ private int noCopiesBuckets;
+ private int lowestBucketCopies;
+
+ /**
+ * Creates a new PartitionedRegionRedundancyTracker
+ *
+ * @param totalBuckets number of buckets in the region to track
+ * @param redundantCopies number of redundant copies specified on the region to track
+ * @param stats the statistics container for the region to track
+ * @param regionPath the full path of the region to track
+ */
+ PartitionedRegionRedundancyTracker(int totalBuckets, int redundantCopies, PartitionedRegionStats stats,
+ String regionPath) {
+ this.stats = stats;
+ this.regionPath = regionPath;
+ this.totalBuckets = totalBuckets;
+ this.targetRedundancy = redundantCopies;
+ this.lowestBucketCopies = redundantCopies + 1;
+ }
+
+ /**
+ * Since consistency was last reached, provides the lowest number of copies of a bucket that
+ * have been remaining across all the buckets in the region
+ *
+ * @return the number of copies of the bucket with the least copies available
+ */
+ int getLowestBucketCopies() {
+ return lowestBucketCopies;
+ }
+
+ /**
+ * Increments the count of buckets that do not meet redundancy
+ */
+ synchronized void incrementLowRedundancyBucketCount() {
+ if (lowRedundancyBuckets == totalBuckets) {
+ return;
+ }
+ lowRedundancyBuckets++;
+ stats.incLowRedundancyBucketCount(1);
+ }
+
+ /**
+ * Updates the count of copies for the bucket with the least copies if a new low has been reached
+ * @param bucketCopies number of copies of a bucket remaining
+ */
+ synchronized void reportBucketCount(int bucketCopies) {
+ if (bucketCopies < lowestBucketCopies) {
+ lowestBucketCopies = bucketCopies;
+ logger.warn(LocalizedMessage.create(
+ LocalizedStrings.BucketAdvisor_REDUNDANCY_HAS_DROPPED_BELOW_0_CONFIGURED_COPIES_TO_1_ACTUAL_COPIES_FOR_2,
+ new Object[] {targetRedundancy, bucketCopies + 1, regionPath}));
+ }
+ }
+
+ /**
+ * Increments the count of buckets that no longer have any copies remaining
+ */
+ synchronized void incrementNoCopiesBucketCount() {
+ if (noCopiesBuckets == totalBuckets) {
+ return;
+ }
+ noCopiesBuckets++;
+ stats.incNoCopiesBucketCount(1);
+ if (noCopiesBuckets == 1) {
+ logger.warn("No copies remain for " + regionPath);
+ }
+ }
+
+ /**
+ * Decrements the count of buckets that do not meet redundancy
+ */
+ synchronized void decrementLowRedundancyBucketCount() {
+ if (lowRedundancyBuckets == 0) {
+ return;
+ }
+ lowRedundancyBuckets--;
+ stats.incLowRedundancyBucketCount(-1);
+ if (lowRedundancyBuckets == 0) {
+ lowestBucketCopies = targetRedundancy + 1;
+ }
+ }
+
+ /**
+ * Decrements the count of buckets that no longer have any copies remaining
+ */
+ synchronized void decrementNoCopiesBucketCount() {
+ if (noCopiesBuckets == 0) {
+ return;
+ }
+ noCopiesBuckets--;
+ stats.incNoCopiesBucketCount(-1);
+ // if the last bucket with no copies has gained a copy, the bucket with the lowest
+ // number of copies (that bucket) has one copy
+ if (noCopiesBuckets == 0) {
+ lowestBucketCopies = 1;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/8683108d/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionStats.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionStats.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionStats.java
index d1dc1be..535e877 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionStats.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionStats.java
@@ -138,6 +138,8 @@ public class PartitionedRegionStats {
private final static int volunteeringThreadsId; // number of threads actively volunteering
private final static int lowRedundancyBucketCountId; // number of buckets currently without full
// redundancy
+ private final static int noCopiesBucketCountId; // number of buckets currently without any
+ // redundancy
private final static int configuredRedundantCopiesId;
private final static int actualRedundantCopiesId;
@@ -308,6 +310,8 @@ public class PartitionedRegionStats {
"Current number of threads volunteering for primary.", "threads"),
f.createIntGauge("lowRedundancyBucketCount",
"Current number of buckets without full redundancy.", "buckets"),
+ f.createIntGauge("noCopiesBucketCount",
+ "Current number of buckets without any copies remaining.", "buckets"),
f.createIntGauge("configuredRedundantCopies",
"Configured number of redundant copies for this partitioned region.", "copies"),
f.createIntGauge("actualRedundantCopies",
@@ -477,6 +481,7 @@ public class PartitionedRegionStats {
primaryBucketCountId = type.nameToId("primaryBucketCount");
volunteeringThreadsId = type.nameToId("volunteeringThreads");
lowRedundancyBucketCountId = type.nameToId("lowRedundancyBucketCount");
+ noCopiesBucketCountId = type.nameToId("noCopiesBucketCount");
getEntriesCompletedId = type.nameToId("getEntryCompleted");
getEntryTimeId = type.nameToId("getEntryTime");
@@ -899,10 +904,18 @@ public class PartitionedRegionStats {
return this.stats.getInt(lowRedundancyBucketCountId);
}
+ public int getNoCopiesBucketCount() {
+ return this.stats.getInt(noCopiesBucketCountId);
+ }
+
public void incLowRedundancyBucketCount(int val) {
this.stats.incInt(lowRedundancyBucketCountId, val);
}
+ public void incNoCopiesBucketCount(int val) {
+ this.stats.incInt(noCopiesBucketCountId, val);
+ }
+
public int getConfiguredRedundantCopies() {
return this.stats.getInt(configuredRedundantCopiesId);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/8683108d/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RegionAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RegionAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RegionAdvisor.java
index c473d2d..63a694a 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RegionAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RegionAdvisor.java
@@ -80,26 +80,8 @@ public class RegionAdvisor extends CacheDistributionAdvisor {
private Queue preInitQueue;
private final Object preInitQueueMonitor = new Object();
- /**
- * Used by to generate redundancy loss alert only once even if more than one bucket or PR has lost
- * redundancy. lowRedundancyFlags[0] is true if any bucket in this partitioned region has lower
- * than configured redundancy. lowRedundancyFlags[1] is true if a warning has been generated for
- * the current actual redundancy of this partitioned region. The caller must synchronize on
- * lowRedundancyFlags in order to maintain atomicity of overall redundancy status and alert.
- */
- private final boolean[] lowRedundancyFlags = new boolean[2];
-
private ConcurrentHashMap<Integer, Set<ServerBucketProfile>> clientBucketProfilesMap;
- /**
- * Caller must synchronize on the return value.
- *
- * @return the low redundancy flags for this partitioned region
- */
- public boolean[] getLowRedundancyFlags() {
- return lowRedundancyFlags;
- }
-
private RegionAdvisor(PartitionedRegion region) {
super(region);
synchronized (this.preInitQueueMonitor) {
http://git-wip-us.apache.org/repos/asf/geode/blob/8683108d/geode-core/src/test/java/org/apache/geode/distributed/internal/GlobalCacheExpirationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/GlobalCacheExpirationTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/GlobalCacheExpirationTest.java
new file mode 100644
index 0000000..b35054c
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/GlobalCacheExpirationTest.java
@@ -0,0 +1,242 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.distributed.internal;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.ExpirationAction;
+import org.apache.geode.cache.ExpirationAttributes;
+import org.apache.geode.cache.PartitionAttributesFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionFactory;
+import org.apache.geode.cache.Scope;
+import org.apache.geode.distributed.internal.locks.DLockService;
+import org.apache.geode.internal.cache.ColocationLogger;
+import org.apache.geode.internal.cache.DistributedRegion;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.SerializableRunnable;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
+import org.apache.geode.test.dunit.rules.DistributedRestoreSystemProperties;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.categories.MembershipTest;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.Logger;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.ArgumentCaptor;
+
+import java.util.Random;
+
+import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.mock;
+
+@Category({DistributedTest.class, MembershipTest.class})
+public class GlobalCacheExpirationTest extends JUnit4CacheTestCase {
+ private static final Logger logger = (Logger) LogManager.getLogger();
+ private static ArgumentCaptor<LogEvent> loggingEventCaptor;
+ @Rule
+ public DistributedRestoreSystemProperties restoreSystemProperties =
+ new DistributedRestoreSystemProperties();
+
+ @Override
+ public void preSetUp() throws Exception {
+ disconnectAllFromDS();
+ }
+
+ static Region otherRegion;
+
+ @Test
+ public void TokensDereferencedOnExpirationFromGlobalCache() throws InterruptedException {
+ Cache myCache = getCache();
+ DistributedRegion region = (DistributedRegion) myCache.createRegionFactory()
+ .setScope(Scope.GLOBAL).setDataPolicy(DataPolicy.REPLICATE)
+ .setEntryTimeToLive(new ExpirationAttributes(1, ExpirationAction.DESTROY))
+ .create("testRegion");
+
+ region.becomeLockGrantor();
+
+ Host host = Host.getHost(0);
+ VM vm1 = host.getVM(1);
+
+ vm1.invoke(new SerializableRunnable("Connect to distributed system") {
+ public void run() {
+ Cache myCache = getCache();
+ otherRegion =
+ myCache.createRegionFactory().setScope(Scope.GLOBAL).setDataPolicy(DataPolicy.REPLICATE)
+ .setEntryTimeToLive(new ExpirationAttributes(1, ExpirationAction.DESTROY))
+ .create("testRegion");
+ }
+ });
+
+ Random rand = new Random();
+ for (int i = 0; i < 10000; i++) {
+ String key = Integer.toString(i);
+ region.put(key, Integer.toString(rand.nextInt()));
+ }
+
+ Assert.assertTrue(region.size() > 0);
+ vm1.invoke(new SerializableRunnable("disconnect from ds") {
+ public void run() {
+ Assert.assertTrue(otherRegion.size() > 0);
+ }
+ });
+ Thread.sleep(2000);
+ vm1.invoke(new SerializableRunnable("check size") {
+ public void run() {
+ Assert.assertEquals(0, otherRegion.size());
+ }
+ });
+ Assert.assertTrue(region.isLockGrantor());
+ Assert.assertEquals(0, region.size());
+
+
+ DLockService service = (DLockService) region.getLockService();
+ Assert.assertTrue(service.isLockGrantor());
+ Assert.assertEquals(0, service.getStats().getTokens());
+ }
+
+ public static Region region1;
+ public static Region region2;
+
+ @Test
+ public void DataConsistencyTest() throws InterruptedException {
+ DistributionManager dm = (DistributionManager) getSystem().getDistributionManager();
+ /*
+ * Cache myCache = getCache(); RegionFactory<String, String> factory =
+ * myCache.createRegionFactory(); Region<String, String> region = factory
+ * .setDataPolicy(DataPolicy.PARTITION) .setPartitionAttributes(new
+ * PartitionAttributesFactory<>().setRedundantCopies(1).create())
+ * .create("testPartitionRegion");
+ */
+
+ Host host = Host.getHost(0);
+ VM vm1 = host.getVM(1);
+ VM vm2 = host.getVM(2);
+
+ vm1.invoke(new SerializableRunnable("Connect to distributed system") {
+ public void run() {
+ Cache myCache = getCache();
+ RegionFactory<String, String> factory = myCache.createRegionFactory();
+ region1 = factory.setDataPolicy(DataPolicy.PARTITION)
+ .setPartitionAttributes(
+ new PartitionAttributesFactory<>().setRedundantCopies(1).create())
+ .create("testPartitionRegion");
+ }
+ });
+
+ vm2.invoke(new SerializableRunnable("Connect to distributed system") {
+ public void run() {
+ Cache myCache = getCache();
+ RegionFactory<String, String> factory = myCache.createRegionFactory();
+ region2 = factory.setDataPolicy(DataPolicy.PARTITION)
+ .setPartitionAttributes(
+ new PartitionAttributesFactory<>().setRedundantCopies(1).create())
+ .create("testPartitionRegion");
+ }
+ });
+
+ vm1.invoke(new SerializableRunnable("load data") {
+ public void run() {
+ Random rand = new Random();
+ for (int i = 0; i < 1000; i++) {
+ String key = Integer.toString(i);
+ region1.put(key, Integer.toString(rand.nextInt()));
+ }
+ }
+ });
+
+ /*
+ * for (int i = 0; i < 10; i++) { Assert.assertNotNull(regionAccessor.get(Integer.toString(i)));
+ * }
+ */
+
+ RegionFactory<String, String> factory = getCache().createRegionFactory();
+ Region regionAccessor = factory.setDataPolicy(DataPolicy.PARTITION)
+ .setPartitionAttributes(
+ new PartitionAttributesFactory<>().setRedundantCopies(1).setLocalMaxMemory(0).create())
+ .create("testPartitionRegion");
+
+ vm2.invoke(new SerializableRunnable("check size") {
+ public void run() {
+ Assert.assertEquals(1000, region2.size());
+ }
+ });
+
+ vm1.invoke(new SerializableRunnable("check size") {
+ public void run() {
+ Assert.assertEquals(1000, region1.size());
+ }
+ });
+
+ // regionAccessor.get("postDisconnect1Key");
+
+ vm1.invoke(new SerializableRunnable("disconnect") {
+ public void run() {
+ region1.close();
+ }
+ });
+
+ vm2.invoke(new SerializableRunnable("load data") {
+ public void run() {
+ region2.put("postDisconnect1Key", "pastDisconnect1Value");
+ }
+ });
+
+ // Object result = regionAccessor.get("postDisconnect1Key");
+ // Assert.assertNotNull(result);
+ Appender mockAppender = attatchMockAppenderToLogger();
+ vm2.invoke(new SerializableRunnable("disconnect") {
+ public void run() {
+ // getSystem().emergencyClose();
+ // getSystem().disconnect();
+ region2.close();
+ }
+ });
+ ArgumentCaptor<LogEvent> loggingEventCaptor = ArgumentCaptor.forClass(LogEvent.class);
+ detatchMockAppenderFromLogger(mockAppender);
+ // Thread.sleep(4000);
+ // Object resultPostBounce = regionAccessor.get("postDisconnect1Key");
+ // Assert.assertNotNull(resultPostBounce);
+
+
+ /*
+ * try { Object postDisconnectResult = regionAccessor.get("1"); } catch
+ * (PartitionedRegionStorageException e) { logger.log(Level.ERROR, e); }
+ * System.out.println("Done");
+ */
+ }
+
+ private Appender attatchMockAppenderToLogger() {
+ Appender mockAppender = mock(Appender.class);
+ when(mockAppender.getName()).thenReturn("MockAppender");
+ when(mockAppender.isStarted()).thenReturn(true);
+ when(mockAppender.isStopped()).thenReturn(false);
+ logger.addAppender(mockAppender);
+ logger.setLevel(Level.WARN);
+ loggingEventCaptor = ArgumentCaptor.forClass(LogEvent.class);
+ return mockAppender;
+ }
+
+ private void detatchMockAppenderFromLogger(Appender appender) {
+ logger.removeAppender(appender);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/8683108d/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java
new file mode 100644
index 0000000..67751fc
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.geode.cache.PartitionAttributes;
+import org.apache.geode.cache.PartitionAttributesFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class BucketRedundancyTrackerTest {
+ private static final int TARGET_COPIES = 2;
+
+ private PartitionedRegion region;
+ private PartitionedRegionStats stats;
+ private BucketRedundancyTracker redundancyTracker;
+
+ @Before
+ public void setup() {
+ PartitionAttributes<Object, Object> regionAttributes = new PartitionAttributesFactory<>()
+ .setTotalNumBuckets(10).setRedundantCopies(TARGET_COPIES - 1).create();
+ region = (PartitionedRegion) PartitionedRegionTestHelper.createPartionedRegion("testRegion",
+ regionAttributes);
+ stats = region.getPrStats();
+ redundancyTracker =
+ new BucketRedundancyTracker(region.getRedundantCopies(), region.getRedundancyTracker());
+ }
+
+ @After
+ public void teardown() {
+ region.destroyRegion();
+ }
+
+ @Test
+ public void whenRedundancyNeverMetDoesNotWarnOnLowRedundancy() {
+ redundancyTracker.updateStatistics(TARGET_COPIES - 1);
+ assertEquals(0, redundancyTracker.getCurrentRedundancy());
+ }
+
+ @Test
+ public void incrementsBucketCountOnLowRedundancyForBucket() {
+ redundancyTracker.updateStatistics(TARGET_COPIES);
+ redundancyTracker.updateStatistics(TARGET_COPIES - 1);
+ assertEquals(1, stats.getLowRedundancyBucketCount());
+ assertEquals(0, redundancyTracker.getCurrentRedundancy());
+ }
+
+ @Test
+ public void decrementsBucketCountOnRegainingRedundancyForBucket() {
+ redundancyTracker.updateStatistics(TARGET_COPIES);
+ redundancyTracker.updateStatistics(TARGET_COPIES - 1);
+ redundancyTracker.updateStatistics(TARGET_COPIES);
+ assertEquals(0, stats.getLowRedundancyBucketCount());
+ assertEquals(TARGET_COPIES - 1, redundancyTracker.getCurrentRedundancy());
+ }
+
+ @Test
+ public void decrementsBucketCountOnClosingBucketBelowRedundancy() {
+ redundancyTracker.updateStatistics(TARGET_COPIES);
+ redundancyTracker.updateStatistics(TARGET_COPIES - 1);
+ redundancyTracker.closeBucket();
+ assertEquals(0, redundancyTracker.getCurrentRedundancy());
+ }
+
+ @Test
+ public void decrementsBucketCountOnClosingABucketWithNoCopies() {
+ redundancyTracker.updateStatistics(TARGET_COPIES);
+ redundancyTracker.updateStatistics(TARGET_COPIES - 1);
+ redundancyTracker.updateStatistics(0);
+ redundancyTracker.closeBucket();
+ assertEquals(-1, redundancyTracker.getCurrentRedundancy());
+ }
+
+ @Test
+ public void doesNotWarnWhenNeverHadAnyCopies() {
+ redundancyTracker.updateStatistics(0);
+ assertEquals(-1, redundancyTracker.getCurrentRedundancy());
+ }
+
+ @Test
+ public void incrementsBucketCountOnHavingNoCopiesForBucket() {
+ redundancyTracker.updateStatistics(1);
+ redundancyTracker.updateStatistics(0);
+ assertEquals(-1, redundancyTracker.getCurrentRedundancy());
+ }
+
+ @Test
+ public void decrementsBucketCountOnHavingAtLeastOneCopyOfBucket() {
+ redundancyTracker.updateStatistics(1);
+ redundancyTracker.updateStatistics(0);
+ redundancyTracker.updateStatistics(1);
+ assertEquals(0, redundancyTracker.getCurrentRedundancy());
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/8683108d/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
new file mode 100644
index 0000000..59bca15
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.internal.cache;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.geode.cache.PartitionAttributes;
+import org.apache.geode.cache.PartitionAttributesFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PartitionedRegionRedundancyTrackerTest {
+ private static final int TARGET_COPIES = 2;
+ private static final int TOTAL_BUCKETS = 3;
+
+ private PartitionedRegion region;
+ private PartitionedRegionStats stats;
+ private PartitionedRegionRedundancyTracker redundancyTracker;
+
+ @Before
+ public void setup() {
+ PartitionAttributes<Object, Object> regionAttributes = new PartitionAttributesFactory<>()
+ .setTotalNumBuckets(TOTAL_BUCKETS).setRedundantCopies(TARGET_COPIES - 1).create();
+ region = (PartitionedRegion) PartitionedRegionTestHelper.createPartionedRegion("testRegion",
+ regionAttributes);
+ stats = region.getPrStats();
+ redundancyTracker = new PartitionedRegionRedundancyTracker(
+ region.getTotalNumberOfBuckets(),
+ region.getRedundantCopies(),
+ stats,
+ region.getFullPath());
+ }
+
+ @After
+ public void teardown() {
+ region.destroyRegion();
+ }
+
+ @Test
+ public void incrementsAndDecrementsLowRedundancyBucketCount() {
+ redundancyTracker.incrementLowRedundancyBucketCount();
+ assertEquals(1, stats.getLowRedundancyBucketCount());
+ redundancyTracker.decrementLowRedundancyBucketCount();
+ assertEquals(0, stats.getLowRedundancyBucketCount());
+ }
+
+ @Test
+ public void willNotIncrementLowRedundancyBucketCountBeyondTotalsBuckets() {
+
+ for (int i = 0; i < TOTAL_BUCKETS; i++) {
+ redundancyTracker.incrementLowRedundancyBucketCount();
+ }
+ assertEquals(TOTAL_BUCKETS, stats.getLowRedundancyBucketCount());
+ redundancyTracker.incrementLowRedundancyBucketCount();
+ assertEquals(TOTAL_BUCKETS, stats.getLowRedundancyBucketCount());
+ }
+
+ @Test
+ public void willNotDecrementLowRedundancyBucketCountBelowZero() {
+ redundancyTracker.decrementLowRedundancyBucketCount();
+ assertEquals(0, stats.getLowRedundancyBucketCount());
+ }
+
+ @Test
+ public void incrementsAndDecrementsNoCopiesBucketCount() {
+ redundancyTracker.incrementNoCopiesBucketCount();
+ assertEquals(1, stats.getNoCopiesBucketCount());
+ redundancyTracker.decrementNoCopiesBucketCount();
+ assertEquals(0, stats.getNoCopiesBucketCount());
+ }
+
+ @Test
+ public void willNotIncrementNoCopiesBucketCountBeyondTotalsBuckets() {
+
+ for (int i = 0; i < TOTAL_BUCKETS; i++) {
+ redundancyTracker.incrementNoCopiesBucketCount();
+ }
+ assertEquals(TOTAL_BUCKETS, stats.getNoCopiesBucketCount());
+ redundancyTracker.incrementNoCopiesBucketCount();
+ assertEquals(TOTAL_BUCKETS, stats.getNoCopiesBucketCount());
+ }
+
+ @Test
+ public void willNotDecrementNoCopiesBucketCountBelowZero() {
+ redundancyTracker.decrementNoCopiesBucketCount();
+ assertEquals(0, stats.getNoCopiesBucketCount());
+ }
+ @Test
+ public void reportsCorrectLowestBucketCopies() {
+ redundancyTracker.reportBucketCount(1);
+ assertEquals(1, redundancyTracker.getLowestBucketCopies());
+ redundancyTracker.reportBucketCount(0);
+ assertEquals(0, redundancyTracker.getLowestBucketCopies());
+ redundancyTracker.reportBucketCount(1);
+ assertEquals(0, redundancyTracker.getLowestBucketCopies());
+ }
+
+ @Test
+ public void lowestBucketCopiesResetsOnRedundancyRegained() {
+ redundancyTracker.incrementLowRedundancyBucketCount();
+ redundancyTracker.reportBucketCount(1);
+ redundancyTracker.decrementLowRedundancyBucketCount();
+ assertEquals(2, redundancyTracker.getLowestBucketCopies());
+ }
+
+ @Test
+ public void lowestBucketCopiesSetToOneOnHavingABucketAgain() {
+ redundancyTracker.incrementNoCopiesBucketCount();
+ redundancyTracker.reportBucketCount(0);
+ redundancyTracker.decrementNoCopiesBucketCount();
+ assertEquals(1, redundancyTracker.getLowestBucketCopies());
+ }
+}
[7/9] geode git commit: Merge remote-tracking branch
'upstream/develop' into feature/GEODE-3049
Posted by ds...@apache.org.
Merge remote-tracking branch 'upstream/develop' into feature/GEODE-3049
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/e896dd8c
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/e896dd8c
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/e896dd8c
Branch: refs/heads/feature/GEODE-3049
Commit: e896dd8cf61f705c3b44df729bb40f29e442eb6a
Parents: c786b4e e1c6c3a
Author: Nick Reich <nr...@pivotal.io>
Authored: Tue Jun 27 08:32:17 2017 -0700
Committer: Nick Reich <nr...@pivotal.io>
Committed: Tue Jun 27 08:32:17 2017 -0700
----------------------------------------------------------------------
build.gradle | 7 +
.../cli/commands/StatusLocatorRealGfshTest.java | 50 ++
...erConfigurationServiceEndToEndDUnitTest.java | 8 +-
.../geode/test/dunit/rules/gfsh/GfshRule.java | 116 +++++
.../geode/test/dunit/rules/gfsh/GfshScript.java | 124 +++++
geode-book/README.md | 16 +-
.../source/subnavs/geode-subnav.erb | 8 +-
geode-core/build.gradle | 4 -
.../internal/InternalDistributedSystem.java | 75 ++-
.../distributed/internal/InternalLocator.java | 40 +-
.../internal/membership/NetView.java | 4 +
.../internal/membership/gms/GMSUtil.java | 15 +-
.../membership/gms/interfaces/Locator.java | 5 +
.../gms/locator/FindCoordinatorResponse.java | 2 +-
.../membership/gms/locator/GMSLocator.java | 52 +-
.../membership/gms/membership/GMSJoinLeave.java | 92 ++--
.../membership/gms/messenger/GMSEncrypt.java | 14 +-
.../gms/messenger/JGroupsMessenger.java | 2 +-
.../org/apache/geode/internal/SystemAdmin.java | 167 ++++---
.../cache/ClusterConfigurationLoader.java | 7 +-
.../geode/internal/cache/DiskStoreImpl.java | 26 -
.../geode/internal/cache/DistributedRegion.java | 1 -
.../apache/geode/internal/cache/EventID.java | 2 +-
.../geode/internal/cache/GemFireCacheImpl.java | 77 +--
.../geode/internal/cache/LocalRegion.java | 15 -
.../geode/internal/cache/PartitionedRegion.java | 1 -
.../geode/internal/cache/tier/Acceptor.java | 4 +
.../cache/tier/sockets/AcceptorImpl.java | 316 ++++++------
.../cache/tier/sockets/ClientHealthMonitor.java | 7 +-
.../sockets/ClientProtocolMessageHandler.java | 35 ++
.../GenericProtocolServerConnection.java | 85 ++++
.../tier/sockets/LegacyServerConnection.java | 88 ++++
.../cache/tier/sockets/ServerConnection.java | 75 ++-
.../tier/sockets/ServerConnectionFactory.java | 84 ++++
.../sockets/ServiceLoadingFailureException.java | 35 ++
.../internal/cache/tx/ClientTXStateStub.java | 10 +-
.../geode/internal/i18n/LocalizedStrings.java | 3 -
.../geode/internal/jta/GlobalTransaction.java | 4 +
.../geode/internal/jta/TransactionImpl.java | 3 +
.../internal/jta/TransactionManagerImpl.java | 15 +
.../geode/internal/jta/UserTransactionImpl.java | 4 +
.../org/apache/geode/internal/jta/XidImpl.java | 4 +
.../internal/logging/LogWriterFactory.java | 32 +-
.../geode/internal/net/SocketCreator.java | 72 ++-
.../internal/security/CallbackInstantiator.java | 28 ++
.../security/CustomSecurityService.java | 346 --------------
.../security/DisabledSecurityService.java | 221 ---------
.../security/EnabledSecurityService.java | 393 ---------------
.../security/IntegratedSecurityService.java | 380 +++++++++++++++
.../security/LegacySecurityService.java | 183 +------
.../internal/security/SecurityService.java | 99 ++--
.../security/SecurityServiceFactory.java | 180 ++-----
.../internal/security/SecurityServiceType.java | 28 --
.../security/shiro/ConfigInitializer.java | 43 --
.../security/shiro/CustomAuthRealm.java | 19 +-
.../security/shiro/RealmInitializer.java | 54 ---
.../security/shiro/SecurityManagerProvider.java | 83 ++++
.../geode/internal/util/PasswordUtil.java | 76 +--
.../geode/management/CacheServerMXBean.java | 122 ++---
.../geode/management/DiskStoreMXBean.java | 68 +--
.../management/DistributedSystemMXBean.java | 174 +++----
.../geode/management/GatewayReceiverMXBean.java | 75 +--
.../geode/management/GatewaySenderMXBean.java | 88 ++--
.../geode/management/LockServiceMXBean.java | 20 +-
.../apache/geode/management/MemberMXBean.java | 263 +++++-----
.../internal/beans/DistributedSystemMBean.java | 21 +-
.../management/internal/beans/MemberMBean.java | 7 +-
.../internal/beans/MemberMBeanBridge.java | 4 +-
.../geode/management/internal/cli/Launcher.java | 19 +-
.../internal/cli/commands/ClientCommands.java | 90 ++--
.../internal/cli/commands/ConfigCommands.java | 17 +-
.../CreateAlterDestroyRegionCommands.java | 123 +++--
.../internal/cli/commands/DataCommands.java | 66 ++-
.../internal/cli/commands/DeployCommands.java | 85 ++--
.../cli/commands/DiskStoreCommands.java | 234 ++++-----
.../cli/commands/DurableClientCommands.java | 100 ++--
.../cli/commands/ExportLogsCommand.java | 4 +-
.../internal/cli/commands/FunctionCommands.java | 152 ++----
.../internal/cli/commands/GfshCommand.java | 20 +-
.../internal/cli/commands/IndexCommands.java | 140 +++---
.../cli/commands/LauncherLifecycleCommands.java | 4 +-
.../internal/cli/commands/MemberCommands.java | 4 +-
.../cli/commands/MiscellaneousCommands.java | 288 +++++------
.../internal/cli/commands/PDXCommands.java | 39 +-
.../internal/cli/commands/QueueCommands.java | 57 +--
.../internal/cli/commands/RegionCommands.java | 82 ++--
.../internal/cli/commands/ShellCommands.java | 67 ++-
.../internal/cli/commands/WanCommands.java | 327 +++++++------
.../commands/lifecycle/StartPulseCommand.java | 18 +-
.../cli/functions/ContinuousQueryFunction.java | 148 ++++++
.../cli/functions/ContunuousQueryFunction.java | 150 ------
.../internal/cli/functions/DeployFunction.java | 3 -
.../cli/functions/RegionFunctionArgs.java | 26 +-
.../cli/functions/UndeployFunction.java | 9 +-
.../cli/functions/UserFunctionExecution.java | 42 +-
.../internal/cli/i18n/CliStrings.java | 156 ++----
.../internal/cli/remote/CommandProcessor.java | 17 +-
.../internal/security/MBeanServerWrapper.java | 38 +-
.../controllers/ConfigCommandsController.java | 24 +-
.../web/controllers/DataCommandsController.java | 4 +-
.../controllers/DeployCommandsController.java | 26 +-
.../DiskStoreCommandsController.java | 33 +-
.../DurableClientCommandsController.java | 50 +-
.../web/controllers/ExportLogController.java | 10 +-
.../controllers/FunctionCommandsController.java | 32 +-
.../controllers/IndexCommandsController.java | 36 +-
.../controllers/MemberCommandsController.java | 6 +-
.../MiscellaneousCommandsController.java | 36 +-
.../controllers/QueueCommandsController.java | 6 +-
.../controllers/RegionCommandsController.java | 20 +-
.../web/controllers/WanCommandsController.java | 143 ++----
.../dunit/QueryIndexUsingXMLDUnitTest.java | 30 +-
.../internal/index/HashIndexSetJUnitTest.java | 2 +-
.../geode/cache/util/PasswordUtilJUnitTest.java | 42 --
.../geode/distributed/LocatorDUnitTest.java | 298 ++++++++----
.../LocatorUDPSecurityDUnitTest.java | 8 +
.../membership/MembershipJUnitTest.java | 3 -
.../gms/membership/GMSJoinLeaveTestHelper.java | 16 +-
.../gms/messenger/GMSEncryptJUnitTest.java | 1 -
.../messenger/JGroupsMessengerJUnitTest.java | 6 +-
.../gms/mgr/GMSMembershipManagerJUnitTest.java | 8 +-
.../DeposePrimaryBucketMessageTest.java | 1 -
.../partitioned/FetchEntryMessageTest.java | 1 -
.../FetchPartitionDetailsMessageTest.java | 1 -
.../partitioned/MoveBucketMessageTest.java | 1 -
.../partitioned/RemoveBucketMessageTest.java | 1 -
.../sockets/ClientServerMiscBCDUnitTest.java | 42 ++
.../tier/sockets/ClientServerMiscDUnitTest.java | 4 +-
.../sockets/ServerConnectionFactoryTest.java | 115 +++++
.../tier/sockets/ServerConnectionTest.java | 7 +-
.../tier/sockets/command/ContainsKey66Test.java | 2 +-
.../tier/sockets/command/CreateRegionTest.java | 2 +-
.../tier/sockets/command/Destroy65Test.java | 2 +-
.../tier/sockets/command/DestroyRegionTest.java | 2 +-
.../cache/tier/sockets/command/DestroyTest.java | 2 +-
.../sockets/command/ExecuteFunction65Test.java | 2 +-
.../sockets/command/ExecuteFunction66Test.java | 2 +-
.../sockets/command/ExecuteFunctionTest.java | 2 +-
.../cache/tier/sockets/command/Get70Test.java | 2 +-
.../tier/sockets/command/GetAll651Test.java | 2 +-
.../tier/sockets/command/GetAll70Test.java | 2 +-
.../cache/tier/sockets/command/GetAllTest.java | 2 +-
.../sockets/command/GetAllWithCallbackTest.java | 2 +-
.../tier/sockets/command/InvalidateTest.java | 2 +-
.../cache/tier/sockets/command/KeySetTest.java | 2 +-
.../cache/tier/sockets/command/Put61Test.java | 30 +-
.../cache/tier/sockets/command/Put65Test.java | 28 +-
.../cache/tier/sockets/command/PutTest.java | 34 +-
.../sockets/command/RegisterInterest61Test.java | 2 +-
.../command/RegisterInterestList61Test.java | 2 +-
.../command/RegisterInterestList66Test.java | 2 +-
.../command/RegisterInterestListTest.java | 2 +-
.../sockets/command/RegisterInterestTest.java | 2 +-
.../tier/sockets/command/RemoveAllTest.java | 2 +-
.../cache/tier/sockets/command/RequestTest.java | 2 +-
.../sockets/command/UnregisterInterestTest.java | 2 +-
.../cache/wan/serial/DestroyMessageTest.java | 1 -
.../xmlcache/DefaultEntityResolver2Test.java | 1 -
.../internal/jta/ClientServerJTADUnitTest.java | 143 ++++++
.../logging/log4j/FastLoggerJUnitTest.java | 3 +-
.../security/DisabledSecurityServiceTest.java | 164 -------
.../security/EnabledSecurityServiceTest.java | 184 -------
.../internal/security/FakePostProcessor.java | 103 ----
.../internal/security/FakeSecurityManager.java | 103 ----
...ntegratedSecurityServiceConstructorTest.java | 93 ++++
.../security/IntegratedSecurityServiceTest.java | 166 +++++++
.../security/LegacySecurityServiceTest.java | 58 +++
...urityServiceFactoryShiroIntegrationTest.java | 38 +-
.../security/SecurityServiceFactoryTest.java | 314 +++++-------
.../internal/security/SecurityServiceTest.java | 21 +-
.../shiro/ConfigInitializerIntegrationTest.java | 91 ----
.../internal/statistics/StatisticsImplTest.java | 61 ++-
.../geode/internal/tcp/ConnectionJUnitTest.java | 2 +-
.../internal/util/PasswordUtilJUnitTest.java | 41 ++
.../MemberMBeanAttributesDUnitTest.java | 35 +-
.../bean/stats/MemberLevelStatsJUnitTest.java | 8 +-
.../internal/CompositeBuilderViaFromTest.java | 1 -
.../internal/CompositeBuilderViaProxyTest.java | 1 -
.../beans/DistributedSystemBridgeJUnitTest.java | 2 +-
.../cli/GfshParserAutoCompletionTest.java | 6 +-
.../internal/cli/GfshParserParsingTest.java | 19 +-
.../cli/commands/ConfigCommandsDUnitTest.java | 4 +-
...eateAlterDestroyRegionCommandsDUnitTest.java | 26 +-
.../CreateAlterDestroyRegionCommandsTest.java | 50 ++
.../cli/commands/DeployCommandsDUnitTest.java | 36 +-
.../commands/DiskStoreCommandsDUnitTest.java | 16 +-
.../commands/GemfireDataCommandsDUnitTest.java | 60 ++-
.../cli/commands/IndexCommandsDUnitTest.java | 16 +-
.../ListAndDescribeRegionDUnitTest.java | 8 +-
.../cli/commands/MemberCommandsDUnitTest.java | 2 +-
.../MiscellaneousCommandsDUnitTest.java | 17 +-
.../cli/commands/QueueCommandsDUnitTest.java | 6 +-
.../cli/commands/ShowMetricsDUnitTest.java | 6 +-
.../cli/commands/ShowStackTraceDUnitTest.java | 8 +-
.../cli/shell/GfshMultilineCommandTest.java | 7 +-
.../ClusterConfigDeployJarDUnitTest.java | 11 +-
.../ClusterConfigDistributionDUnitTest.java | 7 +-
.../ClusterConfigImportDUnitTest.java | 9 +-
.../ClusterConfigStartMemberDUnitTest.java | 4 +-
.../ClusterConfigWithSecurityDUnitTest.java | 32 +-
...CacheServerMBeanAuthenticationJUnitTest.java | 20 +-
.../CacheServerMBeanAuthorizationJUnitTest.java | 42 +-
...eServerMBeanWithShiroIniIntegrationTest.java | 15 +-
.../security/CliCommandsSecurityTest.java | 34 +-
.../security/DataCommandsSecurityTest.java | 13 +-
.../security/DeployCommandsSecurityTest.java | 28 +-
.../DiskStoreMXBeanSecurityJUnitTest.java | 98 ++--
.../DistributedSystemMXBeanSecurityTest.java | 77 +++
.../GatewayReceiverMBeanSecurityTest.java | 42 +-
.../GatewaySenderMBeanSecurityTest.java | 68 +--
.../security/GfshCommandsPostProcessorTest.java | 28 +-
.../security/GfshCommandsSecurityTest.java | 76 +--
.../LockServiceMBeanAuthorizationJUnitTest.java | 73 ++-
.../security/MBeanSecurityJUnitTest.java | 30 +-
.../ManagerMBeanAuthorizationJUnitTest.java | 30 +-
.../security/MemberMBeanSecurityJUnitTest.java | 51 +-
.../internal/security/MultiUserDUnitTest.java | 102 ++--
.../security/ResourcePermissionTest.java | 13 +-
...tyServiceWithCustomRealmIntegrationTest.java | 2 +-
...urityServiceWithShiroIniIntegrationTest.java | 2 +-
.../internal/security/TestCommand.java | 175 ++++---
.../WanCommandsControllerJUnitTest.java | 14 +-
.../executor/AbstractScanExecutorTest.java | 1 -
.../CacheFactoryWithSecurityObjectTest.java | 68 ++-
...SecurityManagerLifecycleDistributedTest.java | 4 +-
.../dunit/rules/LocatorServerStartupRule.java | 19 +-
.../test/dunit/rules/MemberStarterRule.java | 18 +-
.../test/dunit/rules/ServerStarterRule.java | 31 +-
.../codeAnalysis/sanctionedSerializables.txt | 5 +-
.../cli/commands/ClientCommandsDUnitTest.java | 478 ++++++++++---------
.../transactions/JTA_transactions.html.md.erb | 22 +-
.../put_multiple_values_for_keys.html.md.erb | 1 +
geode-docs/rest_apps/setup_config.html.md.erb | 269 +++++++----
.../gfsh/command-pages/start.html.md.erb | 21 +-
.../tools_modules/gfsh/tour_of_gfsh.html.md.erb | 86 ++--
.../internal/cli/LuceneIndexCommands.java | 58 ++-
.../lucene/internal/cli/LuceneIndexInfo.java | 10 -
.../functions/LuceneCreateIndexFunction.java | 14 +-
.../lucene/LuceneClientSecurityDUnitTest.java | 28 +-
.../lucene/LuceneCommandsSecurityDUnitTest.java | 126 +++--
.../lucene/internal/LuceneIndexFactorySpy.java | 3 +-
.../PartitionedRepositoryManagerJUnitTest.java | 2 +-
.../LuceneClusterConfigurationDUnitTest.java | 4 +-
.../LuceneQueryFunctionJUnitTest.java | 12 +-
.../TopEntriesFunctionCollectorJUnitTest.java | 4 +-
.../cache/lucene/test/IndexRepositorySpy.java | 2 +-
geode-protobuf/build.gradle | 62 +++
.../InvalidProtocolMessageException.java | 28 ++
.../protocol/operations/OperationHandler.java | 45 ++
.../registry/OperationsHandlerRegistry.java | 60 +++
...rationHandlerAlreadyRegisteredException.java | 25 +
.../OperationHandlerNotRegisteredException.java | 24 +
.../protobuf/EncodingTypeTranslator.java | 91 ++++
.../protocol/protobuf/ProtobufOpsProcessor.java | 66 +++
.../protobuf/ProtobufSerializationService.java | 51 ++
.../protobuf/ProtobufStreamProcessor.java | 76 +++
.../protocol/protobuf/ProtobufUtilities.java | 34 ++
.../operations/GetRequestOperationHandler.java | 63 +++
.../serializer/ProtobufProtocolSerializer.java | 41 ++
.../protocol/serializer/ProtocolSerializer.java | 32 ++
.../serialization/SerializationService.java | 32 ++
.../geode/serialization/SerializationType.java | 39 ++
.../apache/geode/serialization/TypeCodec.java | 33 ++
.../geode/serialization/codec/BinaryCodec.java | 35 ++
.../geode/serialization/codec/BooleanCodec.java | 37 ++
.../geode/serialization/codec/ByteCodec.java | 37 ++
.../geode/serialization/codec/DoubleCodec.java | 37 ++
.../geode/serialization/codec/FloatCodec.java | 37 ++
.../geode/serialization/codec/IntCodec.java | 38 ++
.../geode/serialization/codec/JSONCodec.java | 37 ++
.../geode/serialization/codec/LongCodec.java | 37 ++
.../geode/serialization/codec/ShortCodec.java | 37 ++
.../geode/serialization/codec/StringCodec.java | 39 ++
.../exception/TypeEncodingException.java | 21 +
.../UnsupportedEncodingTypeException.java | 24 +
.../registry/SerializationCodecRegistry.java | 61 +++
.../CodecAlreadyRegisteredForTypeException.java | 25 +
.../CodecNotRegisteredForTypeException.java | 26 +
geode-protobuf/src/main/proto/basicTypes.proto | 60 +++
.../src/main/proto/clientProtocol.proto | 87 ++++
geode-protobuf/src/main/proto/region_API.proto | 106 ++++
geode-protobuf/src/main/proto/server_API.proto | 37 ++
...he.tier.sockets.ClientProtocolMessageHandler | 1 +
...e.geode.protocol.operations.OperationHandler | 1 +
...geode.protocol.serializer.ProtocolSerializer | 1 +
.../org.apache.geode.serialization.TypeCodec | 10 +
.../geode/protocol/IntegrationJUnitTest.java | 124 +++++
.../org/apache/geode/protocol/MessageUtil.java | 41 ++
.../org/apache/geode/protocol/OpsHandler.java | 21 +
.../RoundTripCacheConnectionJUnitTest.java | 123 +++++
.../OperationsHandlerRegistryJUnitTest.java | 94 ++++
...eToSerializationTypeTranslatorJUnitTest.java | 73 +++
.../protobuf/ProtobufOpsProcessorJUnitTest.java | 62 +++
.../GetRequestOperationHandlerJUnitTest.java | 96 ++++
.../ProtobufProtocolSerializerJUnitTest.java | 81 ++++
.../ProtobufSerializationServiceJUnitTest.java | 111 +++++
.../codec/BinaryFormatJUnitTest.java | 64 +++
.../registry/CodecRegistryJUnitTest.java | 107 +++++
geode-pulse/build.gradle | 3 -
.../apache/geode/tools/pulse/tests/Server.java | 19 +-
.../tools/pulse/tests/rules/ServerRule.java | 6 +-
...mandCreateDestroyGatewaySenderDUnitTest.java | 56 +--
...anCommandCreateGatewayReceiverDUnitTest.java | 57 ++-
...WanCommandGatewayReceiverStartDUnitTest.java | 39 +-
.../WanCommandGatewayReceiverStopDUnitTest.java | 39 +-
.../WanCommandGatewaySenderStartDUnitTest.java | 40 +-
.../WanCommandGatewaySenderStopDUnitTest.java | 34 +-
.../wan/wancommand/WanCommandListDUnitTest.java | 32 +-
.../WanCommandPauseResumeDUnitTest.java | 68 +--
.../wancommand/WanCommandStatusDUnitTest.java | 56 ++-
.../ClusterConfigurationDUnitTest.java | 10 +-
...nfigurationIndexWithFromClauseDUnitTest.java | 4 +-
.../GfshCommandsOverHttpSecurityTest.java | 4 +-
gradle.properties | 7 +
gradle/dependency-versions.properties | 7 +-
gradle/docker.gradle | 100 ++++
gradle/rat.gradle | 6 +-
gradle/test.gradle | 7 +-
settings.gradle | 4 +-
319 files changed, 9372 insertions(+), 6616 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/e896dd8c/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
[2/9] geode git commit: GEODE-3049: fix formatting
Posted by ds...@apache.org.
GEODE-3049: fix formatting
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/f116c545
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/f116c545
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/f116c545
Branch: refs/heads/feature/GEODE-3049
Commit: f116c545b78e0b92601988af93f1ed900c4ea844
Parents: 8683108
Author: Nick Reich <nr...@pivotal.io>
Authored: Mon Jun 12 17:48:06 2017 -0700
Committer: Nick Reich <nr...@pivotal.io>
Committed: Mon Jun 12 17:48:06 2017 -0700
----------------------------------------------------------------------
.../geode/internal/cache/BucketRedundancyTracker.java | 1 +
.../org/apache/geode/internal/cache/PartitionedRegion.java | 5 ++---
.../internal/cache/PartitionedRegionRedundancyTracker.java | 9 +++++----
.../cache/PartitionedRegionRedundancyTrackerTest.java | 8 +++-----
4 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/f116c545/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
index da36f9a..4088b5a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
@@ -68,6 +68,7 @@ class BucketRedundancyTracker {
/**
* Provides the current redundancy of the bucket for this tracker
+ *
* @return number of redundant copies of the bucket for this tracker
*/
int getCurrentRedundancy() {
http://git-wip-us.apache.org/repos/asf/geode/blob/f116c545/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
index f1746ee..e55893f 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
@@ -760,9 +760,8 @@ public class PartitionedRegion extends LocalRegion
// getScope is overridden to return the correct scope.
// this.scope = Scope.LOCAL;
this.redundantCopies = regionAttributes.getPartitionAttributes().getRedundantCopies();
- this.redundancyTracker =
- new PartitionedRegionRedundancyTracker(this.totalNumberOfBuckets, this.redundantCopies,
- this.prStats, getFullPath());
+ this.redundancyTracker = new PartitionedRegionRedundancyTracker(this.totalNumberOfBuckets,
+ this.redundantCopies, this.prStats, getFullPath());
this.prStats.setConfiguredRedundantCopies(
regionAttributes.getPartitionAttributes().getRedundantCopies());
this.prStats.setLocalMaxMemory(
http://git-wip-us.apache.org/repos/asf/geode/blob/f116c545/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
index 71b9ceb..1f65ea9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
@@ -43,8 +43,8 @@ public class PartitionedRegionRedundancyTracker {
* @param stats the statistics container for the region to track
* @param regionPath the full path of the region to track
*/
- PartitionedRegionRedundancyTracker(int totalBuckets, int redundantCopies, PartitionedRegionStats stats,
- String regionPath) {
+ PartitionedRegionRedundancyTracker(int totalBuckets, int redundantCopies,
+ PartitionedRegionStats stats, String regionPath) {
this.stats = stats;
this.regionPath = regionPath;
this.totalBuckets = totalBuckets;
@@ -53,8 +53,8 @@ public class PartitionedRegionRedundancyTracker {
}
/**
- * Since consistency was last reached, provides the lowest number of copies of a bucket that
- * have been remaining across all the buckets in the region
+ * Since consistency was last reached, provides the lowest number of copies of a bucket that have
+ * been remaining across all the buckets in the region
*
* @return the number of copies of the bucket with the least copies available
*/
@@ -75,6 +75,7 @@ public class PartitionedRegionRedundancyTracker {
/**
* Updates the count of copies for the bucket with the least copies if a new low has been reached
+ *
* @param bucketCopies number of copies of a bucket remaining
*/
synchronized void reportBucketCount(int bucketCopies) {
http://git-wip-us.apache.org/repos/asf/geode/blob/f116c545/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
index 59bca15..8f44bbe 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
@@ -38,11 +38,8 @@ public class PartitionedRegionRedundancyTrackerTest {
region = (PartitionedRegion) PartitionedRegionTestHelper.createPartionedRegion("testRegion",
regionAttributes);
stats = region.getPrStats();
- redundancyTracker = new PartitionedRegionRedundancyTracker(
- region.getTotalNumberOfBuckets(),
- region.getRedundantCopies(),
- stats,
- region.getFullPath());
+ redundancyTracker = new PartitionedRegionRedundancyTracker(region.getTotalNumberOfBuckets(),
+ region.getRedundantCopies(), stats, region.getFullPath());
}
@After
@@ -99,6 +96,7 @@ public class PartitionedRegionRedundancyTrackerTest {
redundancyTracker.decrementNoCopiesBucketCount();
assertEquals(0, stats.getNoCopiesBucketCount());
}
+
@Test
public void reportsCorrectLowestBucketCopies() {
redundancyTracker.reportBucketCount(1);
[8/9] geode git commit: GEODE-3049: add tests for closing bucket
Posted by ds...@apache.org.
GEODE-3049: add tests for closing bucket
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/38f2096a
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/38f2096a
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/38f2096a
Branch: refs/heads/feature/GEODE-3049
Commit: 38f2096a76a13b1adc9d882ac751fe4324b7f94a
Parents: e896dd8
Author: Nick Reich <nr...@pivotal.io>
Authored: Tue Jun 27 08:41:58 2017 -0700
Committer: Nick Reich <nr...@pivotal.io>
Committed: Tue Jun 27 08:41:58 2017 -0700
----------------------------------------------------------------------
.../internal/cache/BucketRedundancyTrackerTest.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/38f2096a/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java
index 54230b2..18d22b0 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java
@@ -16,6 +16,7 @@ package org.apache.geode.internal.cache;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
@@ -72,6 +73,14 @@ public class BucketRedundancyTrackerTest {
}
@Test
+ public void bucketCountNotDecrementedOnClosingBucketThatNeverHadRedundancy() {
+ bucketRedundancyTracker.updateStatistics(TARGET_COPIES - 1);
+ bucketRedundancyTracker.closeBucket();
+ verify(regionRedundancyTracker, never()).decrementLowRedundancyBucketCount();
+ assertEquals(0, bucketRedundancyTracker.getCurrentRedundancy());
+ }
+
+ @Test
public void decrementsBucketCountOnClosingABucketWithNoCopies() {
bucketRedundancyTracker.updateStatistics(TARGET_COPIES);
bucketRedundancyTracker.updateStatistics(TARGET_COPIES - 1);
@@ -82,6 +91,12 @@ public class BucketRedundancyTrackerTest {
}
@Test
+ public void bucketCountNotDecrementedOnClosingBucketThatNeverHadCopies() {
+ verify(regionRedundancyTracker, never()).decrementLowRedundancyBucketCount();
+ assertEquals(-1, bucketRedundancyTracker.getCurrentRedundancy());
+ }
+
+ @Test
public void doesNotWarnWhenNeverHadAnyCopies() {
bucketRedundancyTracker.updateStatistics(0);
verifyZeroInteractions(regionRedundancyTracker);
[3/9] geode git commit: GEODE-3049: use mocks in tests and improve
log messages
Posted by ds...@apache.org.
GEODE-3049: use mocks in tests and improve log messages
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/ba47bb28
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/ba47bb28
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/ba47bb28
Branch: refs/heads/feature/GEODE-3049
Commit: ba47bb28e921191bfccca135ccd2bc5d342dd832
Parents: f116c54
Author: Nick Reich <nr...@pivotal.io>
Authored: Tue Jun 13 17:02:22 2017 -0700
Committer: Nick Reich <nr...@pivotal.io>
Committed: Tue Jun 13 17:02:22 2017 -0700
----------------------------------------------------------------------
.../internal/cache/BucketRedundancyTracker.java | 4 +-
.../PartitionedRegionRedundancyTracker.java | 4 +-
.../internal/GlobalCacheExpirationTest.java | 242 -------------------
.../cache/BucketRedundancyTrackerTest.java | 93 ++++---
.../PartitionedRegionRedundancyTrackerTest.java | 47 ++--
5 files changed, 73 insertions(+), 317 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/ba47bb28/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
index 4088b5a..ff53e25 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
@@ -96,7 +96,9 @@ class BucketRedundancyTracker {
regionRedundancyTracker.incrementLowRedundancyBucketCount();
redundancySatisfied = false;
}
- regionRedundancyTracker.reportBucketCount(currentBucketHosts);
+ if (redundancyEverSatisfied) {
+ regionRedundancyTracker.reportBucketCount(currentBucketHosts);
+ }
} else if (!redundancySatisfied && actualRedundancy >= targetRedundancy) {
if (redundancyEverSatisfied) {
regionRedundancyTracker.decrementLowRedundancyBucketCount();
http://git-wip-us.apache.org/repos/asf/geode/blob/ba47bb28/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
index 1f65ea9..e8e7a83 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
@@ -97,7 +97,7 @@ public class PartitionedRegionRedundancyTracker {
noCopiesBuckets++;
stats.incNoCopiesBucketCount(1);
if (noCopiesBuckets == 1) {
- logger.warn("No copies remain for " + regionPath);
+ logger.warn("All in memory copies of some data have been lost for " + regionPath);
}
}
@@ -112,6 +112,8 @@ public class PartitionedRegionRedundancyTracker {
stats.incLowRedundancyBucketCount(-1);
if (lowRedundancyBuckets == 0) {
lowestBucketCopies = targetRedundancy + 1;
+ logger.info("Configured redundancy of " + targetRedundancy + " copies has been restored to "
+ + regionPath);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/ba47bb28/geode-core/src/test/java/org/apache/geode/distributed/internal/GlobalCacheExpirationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/GlobalCacheExpirationTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/GlobalCacheExpirationTest.java
deleted file mode 100644
index b35054c..0000000
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/GlobalCacheExpirationTest.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.distributed.internal;
-
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.DataPolicy;
-import org.apache.geode.cache.ExpirationAction;
-import org.apache.geode.cache.ExpirationAttributes;
-import org.apache.geode.cache.PartitionAttributesFactory;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.RegionFactory;
-import org.apache.geode.cache.Scope;
-import org.apache.geode.distributed.internal.locks.DLockService;
-import org.apache.geode.internal.cache.ColocationLogger;
-import org.apache.geode.internal.cache.DistributedRegion;
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.SerializableRunnable;
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.dunit.rules.DistributedRestoreSystemProperties;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.MembershipTest;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.core.Appender;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.Logger;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.mockito.ArgumentCaptor;
-
-import java.util.Random;
-
-import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.mock;
-
-@Category({DistributedTest.class, MembershipTest.class})
-public class GlobalCacheExpirationTest extends JUnit4CacheTestCase {
- private static final Logger logger = (Logger) LogManager.getLogger();
- private static ArgumentCaptor<LogEvent> loggingEventCaptor;
- @Rule
- public DistributedRestoreSystemProperties restoreSystemProperties =
- new DistributedRestoreSystemProperties();
-
- @Override
- public void preSetUp() throws Exception {
- disconnectAllFromDS();
- }
-
- static Region otherRegion;
-
- @Test
- public void TokensDereferencedOnExpirationFromGlobalCache() throws InterruptedException {
- Cache myCache = getCache();
- DistributedRegion region = (DistributedRegion) myCache.createRegionFactory()
- .setScope(Scope.GLOBAL).setDataPolicy(DataPolicy.REPLICATE)
- .setEntryTimeToLive(new ExpirationAttributes(1, ExpirationAction.DESTROY))
- .create("testRegion");
-
- region.becomeLockGrantor();
-
- Host host = Host.getHost(0);
- VM vm1 = host.getVM(1);
-
- vm1.invoke(new SerializableRunnable("Connect to distributed system") {
- public void run() {
- Cache myCache = getCache();
- otherRegion =
- myCache.createRegionFactory().setScope(Scope.GLOBAL).setDataPolicy(DataPolicy.REPLICATE)
- .setEntryTimeToLive(new ExpirationAttributes(1, ExpirationAction.DESTROY))
- .create("testRegion");
- }
- });
-
- Random rand = new Random();
- for (int i = 0; i < 10000; i++) {
- String key = Integer.toString(i);
- region.put(key, Integer.toString(rand.nextInt()));
- }
-
- Assert.assertTrue(region.size() > 0);
- vm1.invoke(new SerializableRunnable("disconnect from ds") {
- public void run() {
- Assert.assertTrue(otherRegion.size() > 0);
- }
- });
- Thread.sleep(2000);
- vm1.invoke(new SerializableRunnable("check size") {
- public void run() {
- Assert.assertEquals(0, otherRegion.size());
- }
- });
- Assert.assertTrue(region.isLockGrantor());
- Assert.assertEquals(0, region.size());
-
-
- DLockService service = (DLockService) region.getLockService();
- Assert.assertTrue(service.isLockGrantor());
- Assert.assertEquals(0, service.getStats().getTokens());
- }
-
- public static Region region1;
- public static Region region2;
-
- @Test
- public void DataConsistencyTest() throws InterruptedException {
- DistributionManager dm = (DistributionManager) getSystem().getDistributionManager();
- /*
- * Cache myCache = getCache(); RegionFactory<String, String> factory =
- * myCache.createRegionFactory(); Region<String, String> region = factory
- * .setDataPolicy(DataPolicy.PARTITION) .setPartitionAttributes(new
- * PartitionAttributesFactory<>().setRedundantCopies(1).create())
- * .create("testPartitionRegion");
- */
-
- Host host = Host.getHost(0);
- VM vm1 = host.getVM(1);
- VM vm2 = host.getVM(2);
-
- vm1.invoke(new SerializableRunnable("Connect to distributed system") {
- public void run() {
- Cache myCache = getCache();
- RegionFactory<String, String> factory = myCache.createRegionFactory();
- region1 = factory.setDataPolicy(DataPolicy.PARTITION)
- .setPartitionAttributes(
- new PartitionAttributesFactory<>().setRedundantCopies(1).create())
- .create("testPartitionRegion");
- }
- });
-
- vm2.invoke(new SerializableRunnable("Connect to distributed system") {
- public void run() {
- Cache myCache = getCache();
- RegionFactory<String, String> factory = myCache.createRegionFactory();
- region2 = factory.setDataPolicy(DataPolicy.PARTITION)
- .setPartitionAttributes(
- new PartitionAttributesFactory<>().setRedundantCopies(1).create())
- .create("testPartitionRegion");
- }
- });
-
- vm1.invoke(new SerializableRunnable("load data") {
- public void run() {
- Random rand = new Random();
- for (int i = 0; i < 1000; i++) {
- String key = Integer.toString(i);
- region1.put(key, Integer.toString(rand.nextInt()));
- }
- }
- });
-
- /*
- * for (int i = 0; i < 10; i++) { Assert.assertNotNull(regionAccessor.get(Integer.toString(i)));
- * }
- */
-
- RegionFactory<String, String> factory = getCache().createRegionFactory();
- Region regionAccessor = factory.setDataPolicy(DataPolicy.PARTITION)
- .setPartitionAttributes(
- new PartitionAttributesFactory<>().setRedundantCopies(1).setLocalMaxMemory(0).create())
- .create("testPartitionRegion");
-
- vm2.invoke(new SerializableRunnable("check size") {
- public void run() {
- Assert.assertEquals(1000, region2.size());
- }
- });
-
- vm1.invoke(new SerializableRunnable("check size") {
- public void run() {
- Assert.assertEquals(1000, region1.size());
- }
- });
-
- // regionAccessor.get("postDisconnect1Key");
-
- vm1.invoke(new SerializableRunnable("disconnect") {
- public void run() {
- region1.close();
- }
- });
-
- vm2.invoke(new SerializableRunnable("load data") {
- public void run() {
- region2.put("postDisconnect1Key", "pastDisconnect1Value");
- }
- });
-
- // Object result = regionAccessor.get("postDisconnect1Key");
- // Assert.assertNotNull(result);
- Appender mockAppender = attatchMockAppenderToLogger();
- vm2.invoke(new SerializableRunnable("disconnect") {
- public void run() {
- // getSystem().emergencyClose();
- // getSystem().disconnect();
- region2.close();
- }
- });
- ArgumentCaptor<LogEvent> loggingEventCaptor = ArgumentCaptor.forClass(LogEvent.class);
- detatchMockAppenderFromLogger(mockAppender);
- // Thread.sleep(4000);
- // Object resultPostBounce = regionAccessor.get("postDisconnect1Key");
- // Assert.assertNotNull(resultPostBounce);
-
-
- /*
- * try { Object postDisconnectResult = regionAccessor.get("1"); } catch
- * (PartitionedRegionStorageException e) { logger.log(Level.ERROR, e); }
- * System.out.println("Done");
- */
- }
-
- private Appender attatchMockAppenderToLogger() {
- Appender mockAppender = mock(Appender.class);
- when(mockAppender.getName()).thenReturn("MockAppender");
- when(mockAppender.isStarted()).thenReturn(true);
- when(mockAppender.isStopped()).thenReturn(false);
- logger.addAppender(mockAppender);
- logger.setLevel(Level.WARN);
- loggingEventCaptor = ArgumentCaptor.forClass(LogEvent.class);
- return mockAppender;
- }
-
- private void detatchMockAppenderFromLogger(Appender appender) {
- logger.removeAppender(appender);
- }
-}
http://git-wip-us.apache.org/repos/asf/geode/blob/ba47bb28/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java
index 67751fc..54230b2 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/BucketRedundancyTrackerTest.java
@@ -15,94 +15,93 @@
package org.apache.geode.internal.cache;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyZeroInteractions;
-import org.apache.geode.cache.PartitionAttributes;
-import org.apache.geode.cache.PartitionAttributesFactory;
-import org.junit.After;
+import org.apache.geode.test.junit.categories.UnitTest;
import org.junit.Before;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
+@Category(UnitTest.class)
public class BucketRedundancyTrackerTest {
private static final int TARGET_COPIES = 2;
- private PartitionedRegion region;
- private PartitionedRegionStats stats;
- private BucketRedundancyTracker redundancyTracker;
+ private PartitionedRegionRedundancyTracker regionRedundancyTracker;
+ private BucketRedundancyTracker bucketRedundancyTracker;
@Before
public void setup() {
- PartitionAttributes<Object, Object> regionAttributes = new PartitionAttributesFactory<>()
- .setTotalNumBuckets(10).setRedundantCopies(TARGET_COPIES - 1).create();
- region = (PartitionedRegion) PartitionedRegionTestHelper.createPartionedRegion("testRegion",
- regionAttributes);
- stats = region.getPrStats();
- redundancyTracker =
- new BucketRedundancyTracker(region.getRedundantCopies(), region.getRedundancyTracker());
- }
-
- @After
- public void teardown() {
- region.destroyRegion();
+ regionRedundancyTracker = mock(PartitionedRegionRedundancyTracker.class);
+ bucketRedundancyTracker =
+ new BucketRedundancyTracker(TARGET_COPIES - 1, regionRedundancyTracker);
}
@Test
public void whenRedundancyNeverMetDoesNotWarnOnLowRedundancy() {
- redundancyTracker.updateStatistics(TARGET_COPIES - 1);
- assertEquals(0, redundancyTracker.getCurrentRedundancy());
+ bucketRedundancyTracker.updateStatistics(TARGET_COPIES - 1);
+ verifyZeroInteractions(regionRedundancyTracker);
}
@Test
public void incrementsBucketCountOnLowRedundancyForBucket() {
- redundancyTracker.updateStatistics(TARGET_COPIES);
- redundancyTracker.updateStatistics(TARGET_COPIES - 1);
- assertEquals(1, stats.getLowRedundancyBucketCount());
- assertEquals(0, redundancyTracker.getCurrentRedundancy());
+ bucketRedundancyTracker.updateStatistics(TARGET_COPIES);
+ bucketRedundancyTracker.updateStatistics(TARGET_COPIES - 1);
+ verify(regionRedundancyTracker, times(1)).incrementLowRedundancyBucketCount();
+ assertEquals(0, bucketRedundancyTracker.getCurrentRedundancy());
}
@Test
public void decrementsBucketCountOnRegainingRedundancyForBucket() {
- redundancyTracker.updateStatistics(TARGET_COPIES);
- redundancyTracker.updateStatistics(TARGET_COPIES - 1);
- redundancyTracker.updateStatistics(TARGET_COPIES);
- assertEquals(0, stats.getLowRedundancyBucketCount());
- assertEquals(TARGET_COPIES - 1, redundancyTracker.getCurrentRedundancy());
+ bucketRedundancyTracker.updateStatistics(TARGET_COPIES);
+ bucketRedundancyTracker.updateStatistics(TARGET_COPIES - 1);
+ bucketRedundancyTracker.updateStatistics(TARGET_COPIES);
+ verify(regionRedundancyTracker, times(1)).decrementLowRedundancyBucketCount();
+ assertEquals(TARGET_COPIES - 1, bucketRedundancyTracker.getCurrentRedundancy());
}
@Test
public void decrementsBucketCountOnClosingBucketBelowRedundancy() {
- redundancyTracker.updateStatistics(TARGET_COPIES);
- redundancyTracker.updateStatistics(TARGET_COPIES - 1);
- redundancyTracker.closeBucket();
- assertEquals(0, redundancyTracker.getCurrentRedundancy());
+ bucketRedundancyTracker.updateStatistics(TARGET_COPIES);
+ bucketRedundancyTracker.updateStatistics(TARGET_COPIES - 1);
+ bucketRedundancyTracker.closeBucket();
+ verify(regionRedundancyTracker, times(1)).decrementLowRedundancyBucketCount();
+ assertEquals(0, bucketRedundancyTracker.getCurrentRedundancy());
}
@Test
public void decrementsBucketCountOnClosingABucketWithNoCopies() {
- redundancyTracker.updateStatistics(TARGET_COPIES);
- redundancyTracker.updateStatistics(TARGET_COPIES - 1);
- redundancyTracker.updateStatistics(0);
- redundancyTracker.closeBucket();
- assertEquals(-1, redundancyTracker.getCurrentRedundancy());
+ bucketRedundancyTracker.updateStatistics(TARGET_COPIES);
+ bucketRedundancyTracker.updateStatistics(TARGET_COPIES - 1);
+ bucketRedundancyTracker.updateStatistics(0);
+ bucketRedundancyTracker.closeBucket();
+ verify(regionRedundancyTracker, times(1)).decrementLowRedundancyBucketCount();
+ assertEquals(-1, bucketRedundancyTracker.getCurrentRedundancy());
}
@Test
public void doesNotWarnWhenNeverHadAnyCopies() {
- redundancyTracker.updateStatistics(0);
- assertEquals(-1, redundancyTracker.getCurrentRedundancy());
+ bucketRedundancyTracker.updateStatistics(0);
+ verifyZeroInteractions(regionRedundancyTracker);
+ assertEquals(-1, bucketRedundancyTracker.getCurrentRedundancy());
}
@Test
public void incrementsBucketCountOnHavingNoCopiesForBucket() {
- redundancyTracker.updateStatistics(1);
- redundancyTracker.updateStatistics(0);
- assertEquals(-1, redundancyTracker.getCurrentRedundancy());
+ bucketRedundancyTracker.updateStatistics(1);
+ bucketRedundancyTracker.updateStatistics(0);
+ verify(regionRedundancyTracker, times(1)).incrementNoCopiesBucketCount();
+ assertEquals(-1, bucketRedundancyTracker.getCurrentRedundancy());
}
@Test
public void decrementsBucketCountOnHavingAtLeastOneCopyOfBucket() {
- redundancyTracker.updateStatistics(1);
- redundancyTracker.updateStatistics(0);
- redundancyTracker.updateStatistics(1);
- assertEquals(0, redundancyTracker.getCurrentRedundancy());
+ bucketRedundancyTracker.updateStatistics(1);
+ bucketRedundancyTracker.updateStatistics(0);
+ bucketRedundancyTracker.updateStatistics(1);
+ verify(regionRedundancyTracker, times(1)).decrementNoCopiesBucketCount();
+ assertEquals(0, bucketRedundancyTracker.getCurrentRedundancy());
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/ba47bb28/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
index 8f44bbe..0917835 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
@@ -16,43 +16,38 @@
package org.apache.geode.internal.cache;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.verifyZeroInteractions;
-import org.apache.geode.cache.PartitionAttributes;
-import org.apache.geode.cache.PartitionAttributesFactory;
-import org.junit.After;
+import org.apache.geode.test.junit.categories.UnitTest;
import org.junit.Before;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
+@Category(UnitTest.class)
public class PartitionedRegionRedundancyTrackerTest {
private static final int TARGET_COPIES = 2;
private static final int TOTAL_BUCKETS = 3;
- private PartitionedRegion region;
private PartitionedRegionStats stats;
private PartitionedRegionRedundancyTracker redundancyTracker;
@Before
public void setup() {
- PartitionAttributes<Object, Object> regionAttributes = new PartitionAttributesFactory<>()
- .setTotalNumBuckets(TOTAL_BUCKETS).setRedundantCopies(TARGET_COPIES - 1).create();
- region = (PartitionedRegion) PartitionedRegionTestHelper.createPartionedRegion("testRegion",
- regionAttributes);
- stats = region.getPrStats();
- redundancyTracker = new PartitionedRegionRedundancyTracker(region.getTotalNumberOfBuckets(),
- region.getRedundantCopies(), stats, region.getFullPath());
- }
-
- @After
- public void teardown() {
- region.destroyRegion();
+ stats = mock(PartitionedRegionStats.class);
+ redundancyTracker = new PartitionedRegionRedundancyTracker(TOTAL_BUCKETS, TARGET_COPIES - 1,
+ stats, "testRegion");
}
@Test
public void incrementsAndDecrementsLowRedundancyBucketCount() {
redundancyTracker.incrementLowRedundancyBucketCount();
- assertEquals(1, stats.getLowRedundancyBucketCount());
+ verify(stats, times(1)).incLowRedundancyBucketCount(1);
redundancyTracker.decrementLowRedundancyBucketCount();
- assertEquals(0, stats.getLowRedundancyBucketCount());
+ verify(stats, times(1)).incLowRedundancyBucketCount(-1);
}
@Test
@@ -61,23 +56,23 @@ public class PartitionedRegionRedundancyTrackerTest {
for (int i = 0; i < TOTAL_BUCKETS; i++) {
redundancyTracker.incrementLowRedundancyBucketCount();
}
- assertEquals(TOTAL_BUCKETS, stats.getLowRedundancyBucketCount());
+ verify(stats, times(TOTAL_BUCKETS)).incLowRedundancyBucketCount(1);
redundancyTracker.incrementLowRedundancyBucketCount();
- assertEquals(TOTAL_BUCKETS, stats.getLowRedundancyBucketCount());
+ verifyNoMoreInteractions(stats);
}
@Test
public void willNotDecrementLowRedundancyBucketCountBelowZero() {
redundancyTracker.decrementLowRedundancyBucketCount();
- assertEquals(0, stats.getLowRedundancyBucketCount());
+ verifyZeroInteractions(stats);
}
@Test
public void incrementsAndDecrementsNoCopiesBucketCount() {
redundancyTracker.incrementNoCopiesBucketCount();
- assertEquals(1, stats.getNoCopiesBucketCount());
+ verify(stats, times(1)).incNoCopiesBucketCount(1);
redundancyTracker.decrementNoCopiesBucketCount();
- assertEquals(0, stats.getNoCopiesBucketCount());
+ verify(stats, times(1)).incNoCopiesBucketCount(-1);
}
@Test
@@ -86,15 +81,15 @@ public class PartitionedRegionRedundancyTrackerTest {
for (int i = 0; i < TOTAL_BUCKETS; i++) {
redundancyTracker.incrementNoCopiesBucketCount();
}
- assertEquals(TOTAL_BUCKETS, stats.getNoCopiesBucketCount());
+ verify(stats, times(TOTAL_BUCKETS)).incNoCopiesBucketCount(1);
redundancyTracker.incrementNoCopiesBucketCount();
- assertEquals(TOTAL_BUCKETS, stats.getNoCopiesBucketCount());
+ verifyNoMoreInteractions(stats);
}
@Test
public void willNotDecrementNoCopiesBucketCountBelowZero() {
redundancyTracker.decrementNoCopiesBucketCount();
- assertEquals(0, stats.getNoCopiesBucketCount());
+ verify(stats, times(0)).incNoCopiesBucketCount(-1);
}
@Test
[9/9] geode git commit: Merge branch 'develop' into feature/GEODE-3049
Posted by ds...@apache.org.
Merge branch 'develop' into feature/GEODE-3049
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/b788c0a2
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/b788c0a2
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/b788c0a2
Branch: refs/heads/feature/GEODE-3049
Commit: b788c0a29fda47bd4ce330c28a6e9f20b37bdff9
Parents: 38f2096 78900eb
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Tue Jul 18 11:18:34 2017 -0700
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Tue Jul 18 11:18:34 2017 -0700
----------------------------------------------------------------------
.gitignore | 2 +-
docker/Dockerfile | 4 +-
docker/README.md | 2 +-
extensions/geode-modules-assembly/build.gradle | 31 +-
.../release/session/bin/modify_war | 5 +-
.../geode-modules-session-internal/build.gradle | 4 +-
.../session/internal/common/CacheProperty.java | 3 +-
.../internal/filter/GemfireHttpSession.java | 4 +
.../internal/filter/GemfireSessionManager.java | 8 +-
.../DeltaQueuedSessionAttributes.java | 4 +
.../attributes/DeltaSessionAttributes.java | 4 +
.../attributes/ImmediateSessionAttributes.java | 64 --
.../attributes/QueuedSessionAttributes.java | 61 --
extensions/geode-modules-session/build.gradle | 2 +
.../session/filter/SessionCachingFilter.java | 42 +-
extensions/geode-modules-tomcat7/build.gradle | 2 +
extensions/geode-modules-tomcat8/build.gradle | 2 +
.../catalina/Tomcat8DeltaSessionManager.java | 4 +-
extensions/geode-modules/build.gradle | 2 +
.../gatewaydelta/GatewayDeltaCreateEvent.java | 8 -
.../gatewaydelta/GatewayDeltaDestroyEvent.java | 8 -
.../DeltaSessionDestroyAttributeEvent.java | 8 -
.../geode/modules/session/CommandServlet.java | 1 +
extensions/session-testing-war/build.gradle | 27 +
.../geode/modules/session/CommandServlet.java | 94 +++
.../geode/modules/session/QueryCommand.java | 34 +
.../src/main/webapp/WEB-INF/web.xml | 43 +
geode-assembly/build.gradle | 26 +-
.../cli/commands/GfshStartLocatorLogTest.java | 61 ++
.../cli/commands/StatusLocatorRealGfshTest.java | 22 +-
.../geode/session/tests/CargoTestBase.java | 319 ++++++++
.../org/apache/geode/session/tests/Client.java | 286 +++++++
.../geode/session/tests/ContainerInstall.java | 539 +++++++++++++
.../geode/session/tests/ContainerManager.java | 232 ++++++
.../tests/GenericAppServerClientServerTest.java | 44 ++
.../tests/GenericAppServerContainer.java | 150 ++++
.../session/tests/GenericAppServerInstall.java | 141 ++++
.../session/tests/Jetty9ClientServerTest.java | 42 +
.../apache/geode/session/tests/Jetty9Test.java | 42 +
.../geode/session/tests/ServerContainer.java | 380 +++++++++
.../session/tests/Tomcat6ClientServerTest.java | 42 +
.../apache/geode/session/tests/Tomcat6Test.java | 41 +
.../session/tests/Tomcat7ClientServerTest.java | 44 ++
.../apache/geode/session/tests/Tomcat7Test.java | 41 +
.../session/tests/Tomcat8ClientServerTest.java | 42 +
.../apache/geode/session/tests/Tomcat8Test.java | 41 +
.../session/tests/TomcatClientServerTest.java | 84 ++
.../geode/session/tests/TomcatContainer.java | 154 ++++
.../geode/session/tests/TomcatInstall.java | 311 ++++++++
.../test/dunit/rules/gfsh/GfshExecution.java | 50 ++
.../geode/test/dunit/rules/gfsh/GfshRule.java | 75 +-
.../geode/test/dunit/rules/gfsh/GfshScript.java | 48 +-
.../test/dunit/rules/gfsh/ProcessLogger.java | 90 +++
.../test/dunit/rules/gfsh/StreamGobbler.java | 38 +
.../src/test/resources/expected_jars.txt | 4 +-
geode-book/config.yml | 5 -
.../source/subnavs/geode-subnav.erb | 3 +
geode-book/redirects.rb | 2 -
geode-core/build.gradle | 3 +
.../admin/internal/DistributionLocatorImpl.java | 6 +-
.../internal/AutoConnectionSourceImpl.java | 171 ++--
.../client/internal/ConnectionFactoryImpl.java | 2 +-
.../geode/cache/client/internal/PoolImpl.java | 15 +-
.../geode/cache/execute/FunctionContext.java | 4 +
.../internal/AbstractDistributionConfig.java | 8 +-
.../internal/InternalDistributedSystem.java | 6 +-
.../distributed/internal/InternalLocator.java | 6 -
.../membership/InternalDistributedMember.java | 160 ++--
.../internal/membership/gms/GMSUtil.java | 11 +-
.../membership/gms/locator/GMSLocator.java | 14 +-
.../membership/gms/membership/GMSJoinLeave.java | 25 +-
.../membership/gms/membership/HostAddress.java | 118 +++
.../internal/tcpserver/TcpClient.java | 26 +-
.../apache/geode/internal/AbstractConfig.java | 18 +-
.../java/org/apache/geode/internal/Banner.java | 8 +-
.../java/org/apache/geode/internal/Version.java | 2 +-
.../admin/remote/DistributionLocatorId.java | 45 +-
.../admin/remote/RemoteTransportConfig.java | 5 +-
.../cache/AbstractOplogDiskRegionEntry.java | 8 +-
.../internal/cache/AbstractRegionEntry.java | 9 +-
.../geode/internal/cache/AbstractRegionMap.java | 30 +-
.../geode/internal/cache/BucketRegion.java | 36 +-
.../cache/ClusterConfigurationLoader.java | 2 +-
.../internal/cache/CreateRegionProcessor.java | 22 +-
.../apache/geode/internal/cache/DiskEntry.java | 8 +-
.../internal/cache/DiskStoreFactoryImpl.java | 18 +-
.../geode/internal/cache/DistributedRegion.java | 52 +-
.../apache/geode/internal/cache/EventID.java | 91 ++-
.../geode/internal/cache/EventStateHelper.java | 10 +-
.../geode/internal/cache/EventTracker.java | 790 -------------------
.../internal/cache/FindVersionTagOperation.java | 2 +-
.../geode/internal/cache/GemFireCacheImpl.java | 24 +-
.../apache/geode/internal/cache/HARegion.java | 5 +-
.../internal/cache/InitialImageOperation.java | 6 +-
.../geode/internal/cache/InternalCache.java | 3 +-
.../geode/internal/cache/LocalRegion.java | 169 +---
.../cache/MemberFunctionStreamingMessage.java | 7 +-
.../internal/cache/NonLocalRegionEntry.java | 6 +-
.../org/apache/geode/internal/cache/Oplog.java | 5 +-
.../geode/internal/cache/PartitionedRegion.java | 26 +-
.../cache/PartitionedRegionDataStore.java | 4 +-
.../geode/internal/cache/PoolFactoryImpl.java | 28 +-
.../geode/internal/cache/ProxyRegionMap.java | 6 +-
.../geode/internal/cache/RegionEntry.java | 6 +-
.../cache/TXSynchronizationRunnable.java | 15 +-
.../internal/cache/ValidatingDiskRegion.java | 4 +-
.../cache/event/BulkOperationHolder.java | 79 ++
.../cache/event/DistributedEventTracker.java | 523 ++++++++++++
.../cache/event/EventSequenceNumberHolder.java | 124 +++
.../internal/cache/event/EventTracker.java | 136 ++++
.../cache/event/EventTrackerExpiryTask.java | 97 +++
.../cache/event/NonDistributedEventTracker.java | 135 ++++
.../cache/execute/FunctionContextImpl.java | 20 +-
.../cache/execute/MemberFunctionExecutor.java | 7 +-
.../execute/MultiRegionFunctionContextImpl.java | 8 +-
.../execute/MultiRegionFunctionExecutor.java | 5 +-
.../execute/RegionFunctionContextImpl.java | 10 +-
.../internal/cache/ha/ThreadIdentifier.java | 18 +-
.../partitioned/EndBucketCreationMessage.java | 5 +
.../cache/tier/sockets/AcceptorImpl.java | 99 ++-
.../cache/tier/sockets/BaseCommand.java | 4 +-
.../tier/sockets/ClientProxyMembershipID.java | 17 +-
.../cache/tier/sockets/CommBufferPool.java | 36 +
.../GenericProtocolServerConnection.java | 18 +-
.../internal/cache/tier/sockets/HandShake.java | 8 +-
.../cache/tier/sockets/ServerConnection.java | 6 +-
.../tier/sockets/command/ExecuteFunction.java | 12 +-
.../tier/sockets/command/ExecuteFunction65.java | 12 +-
.../tier/sockets/command/ExecuteFunction66.java | 12 +-
.../command/TXSynchronizationCommand.java | 3 +-
.../wan/serial/SerialGatewaySenderQueue.java | 6 +-
.../internal/cache/xmlcache/CacheCreation.java | 4 +-
.../geode/internal/i18n/LocalizedStrings.java | 2 +-
.../internal/logging/LogWriterFactory.java | 2 +-
.../logging/log4j/LogWriterAppenders.java | 8 +-
.../geode/internal/net/SocketCreator.java | 2 +-
.../geode/internal/util/PasswordUtil.java | 49 +-
.../internal/JmxManagerLocatorRequest.java | 5 +-
.../cli/commands/LauncherLifecycleCommands.java | 1 +
.../cli/functions/ExportLogsFunction.java | 2 +-
.../ShowMissingDiskStoresFunction.java | 6 +-
.../cli/functions/SizeExportLogsFunction.java | 2 +-
.../internal/cli/util/CommandStringBuilder.java | 31 +-
.../apache/geode/security/AuthInitialize.java | 14 +-
.../internal/AutoConnectionSourceDUnitTest.java | 12 +-
.../AutoConnectionSourceImplJUnitTest.java | 126 ++-
.../internal/DistributionConfigJUnitTest.java | 4 +-
.../internal/StartupMessageDataJUnitTest.java | 4 +-
.../gms/membership/GMSJoinLeaveJUnitTest.java | 70 +-
.../geode/internal/DeployedJarJUnitTest.java | 10 +-
.../internal/cache/AbstractRegionMapTest.java | 48 ++
.../internal/cache/BucketRegionJUnitTest.java | 4 +
.../cache/ClientServerTransactionDUnitTest.java | 13 +-
.../cache/DiskStoreFactoryJUnitTest.java | 20 +
.../cache/DistributedRegionJUnitTest.java | 11 +-
.../internal/cache/EventTrackerDUnitTest.java | 486 ------------
.../geode/internal/cache/EventTrackerTest.java | 94 ---
.../geode/internal/cache/IteratorDUnitTest.java | 2 +-
.../cache/PartitionedRegionDUnitTestCase.java | 4 +-
.../PartitionedRegionDataStoreJUnitTest.java | 26 +
...artitionedRegionLocalMaxMemoryDUnitTest.java | 229 ++----
...onedRegionSingleNodeOperationsJUnitTest.java | 11 +-
.../event/DistributedEventTrackerTest.java | 328 ++++++++
.../cache/event/EventTrackerDUnitTest.java | 489 ++++++++++++
.../cache/event/EventTrackerExpiryTaskTest.java | 94 +++
.../event/NonDistributedEventTrackerTest.java | 89 +++
.../cache/execute/FunctionServiceBase.java | 14 +
...unctionServiceMultipleOnMemberDUnitTest.java | 4 +-
.../FunctionServiceSingleOnMemberDUnitTest.java | 12 +-
.../cache/ha/EventIdOptimizationJUnitTest.java | 36 +-
.../cache/ha/HARQueueNewImplDUnitTest.java | 20 +-
.../cache/ha/ThreadIdentifierJUnitTest.java | 28 +
.../PersistentPartitionedRegionDUnitTest.java | 5 +-
.../PersistentPartitionedRegionTestBase.java | 10 +-
.../RollingUpgrade2DUnitTest.java | 94 ++-
.../rollingupgrade/RollingUpgradeDUnitTest.java | 6 +-
.../tier/sockets/AcceptorImplJUnitTest.java | 16 +-
.../sockets/ClientServerMiscBCDUnitTest.java | 135 ----
.../tier/sockets/ClientServerMiscDUnitTest.java | 112 ++-
.../GenericProtocolServerConnectionTest.java | 62 ++
.../sockets/ServerConnectionFactoryTest.java | 1 +
.../internal/jta/ClientServerJTADUnitTest.java | 68 +-
.../internal/logging/TestLogWriterFactory.java | 4 +-
.../OffHeapLRURecoveryRegressionTest.java | 10 +-
.../ExportLogsFunctionIntegrationTest.java | 9 +-
.../ShowMissingDiskStoresFunctionJUnitTest.java | 49 +-
.../functions/SizeExportLogsFunctionTest.java | 12 +-
.../cli/util/LogExporterIntegrationTest.java | 6 +-
.../security/GfshCommandsSecurityTest.java | 93 ++-
.../geode/test/dunit/SerializableCallable.java | 2 +-
.../cache/internal/JUnit3CacheTestCase.java | 2 +-
.../cache/internal/JUnit4CacheTestCase.java | 4 +-
.../geode/test/dunit/standalone/ChildVM.java | 4 +-
.../test/dunit/standalone/ProcessManager.java | 38 +-
.../test/dunit/standalone/VersionManager.java | 2 +
.../geode/codeAnalysis/excludedClasses.txt | 3 +-
.../sanctionedDataSerializables.txt | 42 +-
geode-cq/build.gradle | 1 +
.../sockets/ClientServerMiscBCDUnitTest.java | 350 ++++++++
.../running/running_the_cacheserver.html.md.erb | 2 +-
.../running/running_the_locator.html.md.erb | 4 +-
.../set_join_redundancy_recovery.html.md.erb | 35 +-
.../jmx_manager_operations.html.md.erb | 4 +-
geode-docs/rest_apps/setup_config.html.md.erb | 9 +-
geode-docs/rest_apps/using_swagger.html.md.erb | 7 +-
.../gfsh/command-pages/destroy.html.md.erb | 48 ++
.../gfsh/command-pages/import.html.md.erb | 13 +-
.../gfsh/command-pages/start.html.md.erb | 40 -
.../gfsh/command-pages/status.html.md.erb | 44 +-
.../gfsh/command-pages/stop.html.md.erb | 39 +-
.../gfsh/configuring_gfsh.html.md.erb | 3 -
.../gfsh/quick_ref_commands_by_area.html.md.erb | 1 +
.../gfsh/starting_gfsh.html.md.erb | 2 -
.../lucene_integration.html.md.erb | 17 +-
.../geode/test/junit/rules/DiskDirRule.java | 60 --
.../geode/test/junit/rules/DiskDirRuleTest.java | 47 --
.../cache/lucene/internal/LuceneIndexImpl.java | 1 +
.../lucene/internal/filesystem/FileSystem.java | 1 +
.../lucene/LuceneCommandsSecurityDUnitTest.java | 2 +
...IndexCreationPersistenceIntegrationTest.java | 41 +-
.../lucene/LuceneQueriesIntegrationTest.java | 17 +-
...LuceneQueriesPersistenceIntegrationTest.java | 29 +-
.../cache/lucene/MixedObjectIndexDUnitTest.java | 20 +-
.../RawLuceneRepositoryManagerJUnitTest.java | 28 +-
.../DumpDirectoryFilesIntegrationTest.java | 27 +-
.../filesystem/FileSystemJUnitTest.java | 23 +-
.../IndexRepositoryImplPerformanceTest.java | 58 +-
.../LuceneIndexMemoryOverheadTest.java | 129 +++
geode-old-versions/build.gradle | 1 +
geode-protobuf/build.gradle | 2 +-
.../InvalidProtocolMessageException.java | 2 +-
.../protocol/operations/OperationHandler.java | 15 +-
.../registry/OperationsHandlerRegistry.java | 8 -
.../protobuf/EncodingTypeTranslator.java | 1 -
.../protocol/protobuf/ProtobufOpsProcessor.java | 30 +-
.../protobuf/ProtobufSerializationService.java | 3 +
.../protobuf/ProtobufStreamProcessor.java | 63 +-
.../protocol/protobuf/ProtobufUtilities.java | 34 -
.../GetAllRequestOperationHandler.java | 75 ++
.../GetRegionNamesRequestOperationHandler.java | 34 +
.../GetRegionRequestOperationHandler.java | 47 ++
.../operations/GetRequestOperationHandler.java | 65 +-
.../PutAllRequestOperationHandler.java | 109 +++
.../operations/PutRequestOperationHandler.java | 71 ++
.../RemoveRequestOperationHandler.java | 64 ++
.../serializer/ProtobufProtocolSerializer.java | 2 +-
.../utilities/ProtobufRequestUtilities.java | 110 +++
.../utilities/ProtobufResponseUtilities.java | 154 ++++
.../protobuf/utilities/ProtobufUtilities.java | 184 +++++
.../geode/serialization/codec/IntCodec.java | 1 -
.../exception/TypeEncodingException.java | 21 -
.../UnsupportedEncodingTypeException.java | 2 +-
.../CodecNotRegisteredForTypeException.java | 4 +-
geode-protobuf/src/main/proto/basicTypes.proto | 7 +-
.../src/main/proto/clientProtocol.proto | 18 +-
geode-protobuf/src/main/proto/region_API.proto | 21 +-
.../geode/protocol/IntegrationJUnitTest.java | 16 +-
.../org/apache/geode/protocol/MessageUtil.java | 44 +-
.../RoundTripCacheConnectionJUnitTest.java | 385 ++++++++-
.../OperationsHandlerRegistryJUnitTest.java | 8 +-
...eToSerializationTypeTranslatorJUnitTest.java | 6 +-
.../protobuf/ProtobufOpsProcessorJUnitTest.java | 23 +-
.../protobuf/ProtobufStreamProcessorTest.java | 41 +
.../GetAllRequestOperationHandlerJUnitTest.java | 155 ++++
...onNamesRequestOperationHandlerJUnitTest.java | 108 +++
...tRegionRequestOperationHandlerJUnitTest.java | 108 +++
.../GetRequestOperationHandlerJUnitTest.java | 140 +++-
.../operations/OperationHandlerJUnitTest.java | 37 +
.../PutAllRequestOperationHandlerJUnitTest.java | 170 ++++
.../PutRequestOperationHandlerJUnitTest.java | 143 ++++
.../RemoveRequestOperationHandlerJUnitTest.java | 138 ++++
.../ProtobufProtocolSerializerJUnitTest.java | 2 +-
.../codec/BinaryFormatJUnitTest.java | 6 +-
.../org/apache/geode/protocol/default.keystore | Bin 0 -> 1115 bytes
.../internal/locator/wan/LocatorDiscovery.java | 10 +-
.../wan/LocatorMembershipListenerImpl.java | 8 +-
.../cache/wan/AbstractRemoteGatewaySender.java | 4 +-
.../cache/wan/WANRollingUpgradeDUnitTest.java | 596 +++++++++++++-
.../geode/internal/cache/wan/WANTestBase.java | 2 +-
...oncurrentParallelGatewaySenderDUnitTest.java | 28 +-
...tewayLegacyAuthenticationRegressionTest.java | 423 ++++++++++
.../wan/misc/WanAutoDiscoveryDUnitTest.java | 7 +-
.../wan/parallel/BatchRemovalThreadHelper.java | 22 +
gradle/dependency-versions.properties | 1 +
gradle/rat.gradle | 4 +
gradle/test.gradle | 10 +
settings.gradle | 1 +
287 files changed, 11945 insertions(+), 3473 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/b788c0a2/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
[5/9] geode git commit: GEODE-3049: add synchronization
Posted by ds...@apache.org.
GEODE-3049: add synchronization
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/d53bf02f
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/d53bf02f
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/d53bf02f
Branch: refs/heads/feature/GEODE-3049
Commit: d53bf02f74f0a2292fcb4e8cc13f4929bd7efeef
Parents: f5382e6
Author: Nick Reich <nr...@pivotal.io>
Authored: Tue Jun 13 17:23:41 2017 -0700
Committer: Nick Reich <nr...@pivotal.io>
Committed: Tue Jun 13 17:23:41 2017 -0700
----------------------------------------------------------------------
.../geode/internal/cache/BucketRedundancyTracker.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/d53bf02f/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
index ff53e25..09c132e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
@@ -15,15 +15,15 @@
package org.apache.geode.internal.cache;
/**
- * Keeps track of redundancy status for a PartitionedRegion and (if enabled) updates the statistics
- * for the region.
+ * Keeps track of redundancy status for a bucket in a PartitionedRegion and update the region's
+ * {@link PartitionedRegionRedundancyTracker} of the bucket's status for the region.
*/
class BucketRedundancyTracker {
private boolean redundancySatisfied = false;
private boolean hasAnyCopies = false;
private boolean redundancyEverSatisfied = false;
private boolean hasEverHadCopies = false;
- private volatile int currentRedundancy = -1;
+ private int currentRedundancy = -1;
private final int targetRedundancy;
private final PartitionedRegionRedundancyTracker regionRedundancyTracker;
@@ -44,7 +44,7 @@ class BucketRedundancyTracker {
/**
* Adjust statistics based on closing a bucket
*/
- void closeBucket() {
+ synchronized void closeBucket() {
if (!redundancySatisfied) {
regionRedundancyTracker.decrementLowRedundancyBucketCount();
redundancySatisfied = true;
@@ -61,7 +61,7 @@ class BucketRedundancyTracker {
*
* @param currentBucketHosts number of current hosts for the bucket
*/
- void updateStatistics(int currentBucketHosts) {
+ synchronized void updateStatistics(int currentBucketHosts) {
updateNoCopiesStatistics(currentBucketHosts);
updateRedundancyStatistics(currentBucketHosts);
}
[4/9] geode git commit: Merge branch 'develop' into feature/GEODE-3049
Posted by ds...@apache.org.
Merge branch 'develop' into feature/GEODE-3049
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/f5382e6c
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/f5382e6c
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/f5382e6c
Branch: refs/heads/feature/GEODE-3049
Commit: f5382e6c3e2f0d4fcea8de12a7cd6c0205366ea9
Parents: ba47bb2 a561bd1
Author: Nick Reich <nr...@pivotal.io>
Authored: Tue Jun 13 17:11:11 2017 -0700
Committer: Nick Reich <nr...@pivotal.io>
Committed: Tue Jun 13 17:11:11 2017 -0700
----------------------------------------------------------------------
etc/intellij-java-google-style.xml | 365 -------------------
etc/intellij-java-modified-google-style.xml | 255 +++++++++++++
.../web/controllers/AbstractBaseController.java | 62 ++--
.../AbstractBaseControllerJUnitTest.java | 24 +-
gradle/rat.gradle | 2 +-
5 files changed, 301 insertions(+), 407 deletions(-)
----------------------------------------------------------------------
[6/9] geode git commit: GEODE-3049: Fix closeBucket() logic
Posted by ds...@apache.org.
GEODE-3049: Fix closeBucket() logic
* need to check if redundancy ever satisfied and/or if any copies
* ever present before decrementing statistics counts
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/c786b4ef
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/c786b4ef
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/c786b4ef
Branch: refs/heads/feature/GEODE-3049
Commit: c786b4ef81dde10e567538cc6ee53e6544d9b271
Parents: d53bf02
Author: Nick Reich <nr...@pivotal.io>
Authored: Mon Jun 26 16:20:08 2017 -0700
Committer: Nick Reich <nr...@pivotal.io>
Committed: Mon Jun 26 16:20:08 2017 -0700
----------------------------------------------------------------------
.../org/apache/geode/internal/cache/BucketRedundancyTracker.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/c786b4ef/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
index 09c132e..8525f13 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRedundancyTracker.java
@@ -45,11 +45,11 @@ class BucketRedundancyTracker {
* Adjust statistics based on closing a bucket
*/
synchronized void closeBucket() {
- if (!redundancySatisfied) {
+ if (redundancyEverSatisfied && !redundancySatisfied) {
regionRedundancyTracker.decrementLowRedundancyBucketCount();
redundancySatisfied = true;
}
- if (!hasAnyCopies) {
+ if (hasEverHadCopies && !hasAnyCopies) {
regionRedundancyTracker.decrementNoCopiesBucketCount();
hasAnyCopies = true;
}