diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SCNIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SCNIT.java index 767a1658bcb..566aed916a9 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SCNIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SCNIT.java @@ -87,8 +87,9 @@ public void testReadBeforeDelete() throws Exception { public void testSCNWithTTL() throws Exception { int ttl = 2; String fullTableName = createTableWithTTL(ttl); - // sleep for one second longer than ttl - Thread.sleep(ttl * 1000 + 1000); + // The SCN is one second before the current time. Sleep two seconds longer than the TTL so + // that the rows expire at the SCN with one second of margin. + Thread.sleep(ttl * 1000 + 2000); Properties props = new Properties(); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(EnvironmentEdgeManager.currentTime() - 1000));