You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2019/04/02 17:57:42 UTC
[geode] branch feature/GEODE-6583 updated: spotless
This is an automated email from the ASF dual-hosted git repository.
bschuchardt pushed a commit to branch feature/GEODE-6583
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/feature/GEODE-6583 by this push:
new 6d4cea0 spotless
6d4cea0 is described below
commit 6d4cea055f898a8bd8d5cf22b97fa860f3e3aa4b
Author: Bruce Schuchardt <bs...@pivotal.io>
AuthorDate: Tue Apr 2 10:56:54 2019 -0700
spotless
---
.../geode/cache30/TXDistributedDUnitTest.java | 2 +
.../gms/fd/PhiAccrualFailureDetectorTest.java | 37 ++++++--------
.../membership/gms/fd/GMSHealthMonitor.java | 56 +++++++++++++++-------
.../gms/fd/PhiAccrualFailureDetector.java | 14 ++++--
4 files changed, 64 insertions(+), 45 deletions(-)
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache30/TXDistributedDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
index 459fc79..d3bd121 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
@@ -24,6 +24,7 @@
*/
package org.apache.geode.cache30;
+import static org.apache.geode.distributed.ConfigurationProperties.DISABLE_AUTO_RECONNECT;
import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_NETWORK_PARTITION_DETECTION;
import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
import static org.junit.Assert.assertEquals;
@@ -563,6 +564,7 @@ public class TXDistributedDUnitTest extends JUnit4CacheTestCase {
Properties p = super.getDistributedSystemProperties();
p.put(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
p.put(ENABLE_NETWORK_PARTITION_DETECTION, "false");
+ p.put(DISABLE_AUTO_RECONNECT, "true");
return p;
}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/PhiAccrualFailureDetectorTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/PhiAccrualFailureDetectorTest.java
index d3e6a64..a0c5061 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/PhiAccrualFailureDetectorTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/PhiAccrualFailureDetectorTest.java
@@ -5,7 +5,7 @@
* 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
+ * 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,
@@ -16,19 +16,18 @@
package org.apache.geode.distributed.internal.membership.gms.fd;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import static org.junit.Assert.*;
-
import org.apache.geode.test.junit.categories.MembershipTest;
@Category({MembershipTest.class})
-public class PhiAccrualFailureDetectorTest
-{
+public class PhiAccrualFailureDetectorTest {
@Test
- public void test()
- {
+ public void test() {
PhiAccrualFailureDetector failureDetector = new PhiAccrualFailureDetector.Builder().build();
long now = 1420070400000L;
for (int i = 0; i < 300; i++) {
@@ -39,38 +38,30 @@ public class PhiAccrualFailureDetectorTest
if (i == 291) {
assertTrue(1 < phi && phi < 3);
assertTrue(failureDetector.isAvailable(timestampMillis));
- }
- else if (i == 292) {
+ } else if (i == 292) {
assertTrue(3 < phi && phi < 8);
assertTrue(failureDetector.isAvailable(timestampMillis));
- }
- else if (i == 293) {
+ } else if (i == 293) {
assertTrue(8 < phi && phi < 16);
assertTrue(failureDetector.isAvailable(timestampMillis));
- }
- else if (i == 294) {
+ } else if (i == 294) {
assertTrue(16 < phi && phi < 30);
assertFalse(failureDetector.isAvailable(timestampMillis));
- }
- else if (i == 295) {
+ } else if (i == 295) {
assertTrue(30 < phi && phi < 50);
assertFalse(failureDetector.isAvailable(timestampMillis));
- }
- else if (i == 296) {
+ } else if (i == 296) {
assertTrue(50 < phi && phi < 70);
assertFalse(failureDetector.isAvailable(timestampMillis));
- }
- else if (i == 297) {
+ } else if (i == 297) {
assertTrue(70 < phi && phi < 100);
assertFalse(failureDetector.isAvailable(timestampMillis));
- }
- else {
+ } else {
assertTrue(100 < phi);
assertFalse(failureDetector.isAvailable(timestampMillis));
}
continue;
- }
- else if (i > 200) {
+ } else if (i > 200) {
if (i % 5 == 0) {
double phi = failureDetector.phi(timestampMillis);
assertTrue(0.1 < phi && phi < 0.5);
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
index ac8c35f..aadae82 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
@@ -240,21 +240,37 @@ public class GMSHealthMonitor implements HealthMonitor, MessageHandler {
return;
}
- InternalDistributedMember neighbour = nextNeighbor;
-
- long currentTime = System.currentTimeMillis();
- // this is the start of interval to record member activity
- GMSHealthMonitor.this.currentTimeStamp = currentTime;
-
- if (neighbour != null) {
- PhiAccrualFailureDetector nextNeighborDetector =
- getOrCreatePhiAccrualFailureDetector(neighbour, currentTime);
- if (!nextNeighborDetector.isAvailable()) {
- logger.debug("Checking member {} ", neighbour);
- // now do check request for this member;
- checkMember(neighbour);
+ NetView myView = GMSHealthMonitor.this.currentView;
+ if (myView == null) {
+ return;
+ }
+ // if (myView.getCoordinator().equals(localAddress)) {
+ // for phi accrual we need to periodically check all members
+ for (InternalDistributedMember member : myView.getMembers()) {
+ PhiAccrualFailureDetector detector =
+ getOrCreatePhiAccrualFailureDetector(member, currentTimeStamp);
+ if (!detector.isAvailable()) {
+ checkMember(member);
}
}
+ return;
+ // }
+
+ // InternalDistributedMember neighbour = nextNeighbor;
+ //
+ // long currentTime = System.currentTimeMillis();
+ // // this is the start of interval to record member activity
+ // GMSHealthMonitor.this.currentTimeStamp = currentTime;
+ //
+ // if (neighbour != null) {
+ // PhiAccrualFailureDetector nextNeighborDetector =
+ // getOrCreatePhiAccrualFailureDetector(neighbour, currentTime);
+ // if (!nextNeighborDetector.isAvailable()) {
+ // logger.debug("Checking member {} ", neighbour);
+ // // now do check request for this member;
+ // checkMember(neighbour);
+ // }
+ // }
}
}
@@ -865,7 +881,7 @@ public class GMSHealthMonitor implements HealthMonitor, MessageHandler {
}
InternalDistributedMember oldNeighbor = nextNeighbor;
if (oldNeighbor != newNeighbor) {
- logger.info("Failure detection is now watching " + newNeighbor);
+ logger.debug("Failure detection is now watching " + newNeighbor);
nextNeighbor = newNeighbor;
}
}
@@ -1349,9 +1365,15 @@ public class GMSHealthMonitor implements HealthMonitor, MessageHandler {
}
failed = true;
} else {
- logger.info(
- "Availability check failed but detected recent message traffic for suspect member "
- + mbr);
+ if (detector != null) {
+ logger.info(
+ "Availability check failed but detected recent message traffic for suspect member {} its phi rating is at {}",
+ mbr, detector.phi());
+ } else {
+ logger.info(
+ "Availability check failed and there is no phi detector for this member yet the check passed: {}",
+ mbr);
+ }
}
}
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/PhiAccrualFailureDetector.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/PhiAccrualFailureDetector.java
index 2748e5d..bf3a08f 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/PhiAccrualFailureDetector.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/PhiAccrualFailureDetector.java
@@ -21,8 +21,10 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
/**
- * <p>Ported to Geode from https://github.com/komamitsu/phi-accural-failure-detector. Javadoc
- * from that repo follows...</p>
+ * <p>
+ * Ported to Geode from https://github.com/komamitsu/phi-accural-failure-detector. Javadoc
+ * from that repo follows...
+ * </p>
* <p>
* This is a port of
* https://github.com/akka/akka/blob/master/akka-remote/src/main/scala/akka/remote/PhiAccrualFailureDetector.scala
@@ -30,16 +32,18 @@ import java.util.concurrent.atomic.AtomicReference;
* Implementation of 'The Phi Accrual Failure Detector' by Hayashibara et al. as defined in their
* paper:
* [http://ddg.jaist.ac.jp/pub/HDY+04.pdf]
- *<p>
+ * <p>
* The suspicion level of failure is given by a value called φ (phi).
* The basic idea of the φ failure detector is to express the value of φ on a scale that
* is dynamically adjusted to reflect current network conditions. A configurable
* threshold is used to decide if φ is considered to be a failure.
- *<p>
+ * <p>
* The value of φ is calculated as:
- *<pre>
+ *
+ * <pre>
* φ = -log10(1 - F(timeSinceLastHeartbeat)
* </pre>
+ *
* where F is the cumulative distribution function of a normal distribution with mean
* and standard deviation estimated from historical heartbeat inter-arrival times.
*