public class TestClockSkewDetection extends TestCase2
ClocksNotSynchronizedException
. The basic pattern of
events is as follows:
leader : t1 : timestamp before gather() messages are sent to followers. follower : t2 : timestamp taken when servicing gather() message and sent to leader with response. leader : t3 : timestamp taken on leader when barrier breaks.Of necessity, these events have a temporal order (t1 BEFORE t2; t2 BEFORE t3). However, there can be skew in the clocks such that the clock on the leader and the clock on the follower(s) are not synchronized. Some clock skew is allowed, but significant clock skew can cause a problem on failover.
The problem arises because the clocks are used to assign timestamps for commit points, and we index into the journal using those timestamps for historical reads (reading on the database as of some wall clock time).
AbstractJournal.commitNow(long)
does ensure that time moves forward
relative to the timestamp associated with the last commit point on the
journal. However, if the skew is large, then this could require waiting for
minutes, hours, or days before a new commit time could be assigned.
In order to avoid such long latency during failover, an error is reported proactively if a large clock skew is detected during the release time consensus protocol.
This test suite verifies the logic for detecting clock skew.
TestCase2.MyProperties, TestCase2.RandomType
_randomType, log
Constructor and Description |
---|
TestClockSkewDetection() |
TestClockSkewDetection(String name) |
Modifier and Type | Method and Description |
---|---|
protected void |
setUp() |
protected void |
tearDown() |
void |
test01()
Tests where the delta is LT and
t1 LT t2 |
void |
test02()
Tests where the delta is EQ and
t1 LT t2 |
void |
test03()
Tests where the delta is GT and
t1 LT t2 |
void |
test11()
Tests where the delta is LT and
t1 GTE t2 . |
void |
test12()
Tests where the delta is EQ and
t1 GTE t2 |
void |
test13()
Tests where the delta is GT and
t1 GTE t2 |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualsWithinUlps, assertSameArray, assertSameArray, assertSameBigDecimal, assertSameBigDecimal, assertSameBigInteger, assertSameBigInteger, assertSameIterator, assertSameIterator, assertSameIteratorAnyOrder, assertSameIteratorAnyOrder, assertSameValue, assertSameValue, assertZeroUlps, assertZeroUlps, fail, getInnerCause, getNormalInt, getProjectBuildPath, getProperties, getRandomObject, getRandomObject, getRandomOrder, getRandomString, getTestInputStream, getTestResource, getTestResource, getUlps, getUlps, isDEBUG, isDEBUG, isINFO, isINFO, isInnerCause, logProperties
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
public TestClockSkewDetection()
public TestClockSkewDetection(String name)
protected void setUp() throws Exception
setUp
in class junit.framework.TestCase
Exception
protected void tearDown() throws Exception
tearDown
in class junit.framework.TestCase
Exception
public void test01()
t1 LT t2
public void test02()
t1 LT t2
public void test03()
t1 LT t2
public void test11()
t1 GTE t2
.
Note: This is a test for a "fuzzy" sense of "before". We explicitly allow for some clock skew since it will not cause a significantly latency on failover and minor clock skew (on the order of the latency of an RMI) is common, even with synchronized clocks.
public void test12()
t1 GTE t2
public void test13()
t1 GTE t2
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.