gjacoby126 commented on a change in pull request #662: PHOENIX-5645 - 
GlobalIndexChecker should prevent compaction from purg…
URL: https://github.com/apache/phoenix/pull/662#discussion_r364497080
 
 

 ##########
 File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SCNIT.java
 ##########
 @@ -82,28 +85,58 @@ public void testReadBeforeDelete() throws Exception {
 
        @Test
        public void testSCNWithTTL() throws Exception {
+               int ttl = 2;
+               String fullTableName = createTableWithTTL(ttl);
+               //sleep for one second longer than ttl
+               Thread.sleep(ttl * 1000 + 1000);
+               Properties props = new Properties();
+               props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
+                               
Long.toString(EnvironmentEdgeManager.currentTime() - 1000));
+               try (Connection connscn = DriverManager.getConnection(getUrl(), 
props)) {
+                       ResultSet rs = 
connscn.createStatement().executeQuery("select * from " + fullTableName);
+                       assertFalse(rs.next());
+                       rs.close();
+               }
+       }
+
+       @Test
+       public void testTooLowSCNWithTTL() throws Exception {
+               //if scn is for an older time than a table's ttl, it should 
throw a SQLException
+               int ttl = 2;
+               String fullTableName = createTableWithTTL(ttl);
+               //need to sleep long enough for the SCN to still find the 
syscat row for the table
+               Thread.sleep(ttl * 1000 + 1000);
+               Properties props = new Properties();
+               props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
+                       Long.toString(EnvironmentEdgeManager.currentTime() - 
(ttl + 1)* 1000));
 
 Review comment:
   Good catch, done. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to