mirror of https://github.com/apache/cassandra
Improve FD logging when the arrival time is ignored.
Patch by Brandon Williams for CASSANDRA-8245
This commit is contained in:
parent
a22308294d
commit
eb9c5bbcfd
|
|
@ -211,12 +211,12 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean
|
|||
{
|
||||
// avoid adding an empty ArrivalWindow to the Map
|
||||
heartbeatWindow = new ArrivalWindow(SAMPLE_SIZE);
|
||||
heartbeatWindow.add(now);
|
||||
heartbeatWindow.add(now, ep);
|
||||
arrivalSamples.put(ep, heartbeatWindow);
|
||||
}
|
||||
else
|
||||
{
|
||||
heartbeatWindow.add(now);
|
||||
heartbeatWindow.add(now, ep);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ class ArrivalWindow
|
|||
}
|
||||
}
|
||||
|
||||
synchronized void add(long value)
|
||||
synchronized void add(long value, InetAddress ep)
|
||||
{
|
||||
assert tLast >= 0;
|
||||
if (tLast > 0L)
|
||||
|
|
@ -335,7 +335,7 @@ class ArrivalWindow
|
|||
if (interArrivalTime <= MAX_INTERVAL_IN_NANO)
|
||||
arrivalIntervals.add(interArrivalTime);
|
||||
else
|
||||
logger.debug("Ignoring interval time of {}", interArrivalTime);
|
||||
logger.debug("Ignoring interval time of {} for {}", interArrivalTime, ep);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ import static org.junit.Assert.*;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.lang.RuntimeException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
public class ArrivalWindowTest
|
||||
{
|
||||
@Test
|
||||
|
|
@ -32,12 +36,20 @@ public class ArrivalWindowTest
|
|||
{
|
||||
final ArrivalWindow windowWithNano = new ArrivalWindow(4);
|
||||
final long toNano = 1000000L;
|
||||
|
||||
windowWithNano.add(111 * toNano);
|
||||
windowWithNano.add(222 * toNano);
|
||||
windowWithNano.add(333 * toNano);
|
||||
windowWithNano.add(444 * toNano);
|
||||
windowWithNano.add(555 * toNano);
|
||||
InetAddress ep;
|
||||
try
|
||||
{
|
||||
ep = InetAddress.getLocalHost();
|
||||
}
|
||||
catch (UnknownHostException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
windowWithNano.add(111 * toNano, ep);
|
||||
windowWithNano.add(222 * toNano, ep);
|
||||
windowWithNano.add(333 * toNano, ep);
|
||||
windowWithNano.add(444 * toNano, ep);
|
||||
windowWithNano.add(555 * toNano, ep);
|
||||
|
||||
//all good
|
||||
assertEquals(1.0, windowWithNano.phi(666 * toNano), 0.01);
|
||||
|
|
|
|||
Loading…
Reference in New Issue