gjacoby126 commented on a change in pull request #773:
URL: https://github.com/apache/phoenix/pull/773#discussion_r418313625



##########
File path: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexVerificationResultRepositoryIT.java
##########
@@ -50,24 +67,62 @@ public void testReadResultRow() throws Exception {
         byte[] indexNameBytes = Bytes.toBytes(indexName);
         try (Connection conn = DriverManager.getConnection(getUrl())) {
             createTableAndIndex(conn, tableName, indexName);
-            IndexVerificationResultRepository resultRepository =
-                new IndexVerificationResultRepository(conn, indexNameBytes);
-            resultRepository.createResultTable(conn);
-            byte[] regionOne = Bytes.toBytes("a.1.00000000000000000000");
-            byte[] regionTwo = Bytes.toBytes("a.2.00000000000000000000");
             long scanMaxTs = EnvironmentEdgeManager.currentTimeMillis();
             IndexToolVerificationResult expectedResult = 
getExpectedResult(scanMaxTs);
-            resultRepository.logToIndexToolResultTable(expectedResult, 
IndexTool.IndexVerifyType.BOTH,
-                regionOne);
-            resultRepository.logToIndexToolResultTable(expectedResult, 
IndexTool.IndexVerifyType.BOTH,
-                regionTwo);
+            IndexVerificationResultRepository resultRepository = 
setupResultRepository(conn, indexNameBytes, expectedResult);
             IndexToolVerificationResult actualResult =
                 resultRepository.getVerificationResult(conn, scanMaxTs);
             assertVerificationResult(expectedResult, actualResult);
+        }
+    }
 
+    @Test
+    public void testTTLOnResultTable() throws SQLException, IOException {
+        String mockString = "mock_value";
+        byte[] mockStringBytes = Strings.toByteArray(mockString);
+        ManualEnvironmentEdge customClock = new ManualEnvironmentEdge();
+        customClock.setValue(1);
+        EnvironmentEdgeManager.injectEdge(customClock);
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            long scanMaxTs = EnvironmentEdgeManager.currentTimeMillis();
+            IndexToolVerificationResult expectedResult = 
getExpectedResult(scanMaxTs);
+            setupResultRepository(conn, mockStringBytes,expectedResult);
+            customClock.incrementValue(1000*(DEFAULT_LOG_TTL+5));
+            EnvironmentEdgeManager.injectEdge(customClock);
+            HTable hTable = new HTable(config, RESULT_TABLE_NAME_BYTES);
+            int count = countRows(hTable);
+
+            Assert.assertEquals(0, count);
         }
     }
 
+    public static int countRows(HTable hTable) throws IOException {

Review comment:
       Can be replaced with TestUtil.getRowCount

##########
File path: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexVerificationOutputRepositoryIT.java
##########
@@ -39,6 +48,9 @@
 import java.util.List;
 import java.util.Map;
 
+import static org.apache.phoenix.coprocessor.MetaDataProtocol.DEFAULT_LOG_TTL;
+import static 
org.apache.phoenix.end2end.index.IndexVerificationResultRepositoryIT.countRows;

Review comment:
       Can use TestUtil.getRowCount




----------------------------------------------------------------
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]


Reply via email to