[GitHub] [phoenix] gokceni commented on a change in pull request #679: PHOENIX-5645 - GlobalIndexChecker should prevent compaction from purg…

2020-01-14 Thread GitBox
gokceni commented on a change in pull request #679: PHOENIX-5645 - 
GlobalIndexChecker should prevent compaction from purg…
URL: https://github.com/apache/phoenix/pull/679#discussion_r366593957
 
 

 ##
 File path: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/MaxLookbackIT.java
 ##
 @@ -168,36 +184,48 @@ public void testTTLAndMaxLookbackAge() throws Exception {
 conf.setLong(HRegion.MEMSTORE_PERIODIC_FLUSH_INTERVAL, 0L);
 try (Connection conn = DriverManager.getConnection(getUrl())) {
 String dataTableName = generateUniqueName();
-String indexStem = generateUniqueName();
-createTableAndIndexes(conn, dataTableName, indexStem);
-long afterFirstInsertSCN = 
org.apache.phoenix.util.EnvironmentEdgeManager.currentTimeMillis();
+createTable(dataTableName);
+//increment by 10 min to make sure we don't "look back" past table 
creation
+injectEdge.incValue(WAIT_AFTER_TABLE_CREATION);
+populateTable(dataTableName);
+injectEdge.incValue(1);
+long afterFirstInsertSCN = 
EnvironmentEdgeManager.currentTimeMillis();
 TableName dataTable = TableName.valueOf(dataTableName);
 assertTableHasTtl(conn, dataTable, ttl);
-String fullIndexName = indexStem + "1";
-TableName indexTable = TableName.valueOf(fullIndexName);
-assertTableHasTtl(conn, indexTable, ttl);
-
 //first make sure we inserted correctly
-String sql = String.format("SELECT val2 FROM %s WHERE val1 = 
'ab'", dataTableName);
-assertExplainPlan(conn, sql, dataTableName, fullIndexName);
+String sql = String.format("SELECT val2 FROM %s WHERE id = 'a'", 
dataTableName);
+  //  assertExplainPlan(conn, sql, dataTableName, fullIndexName);
 assertRowExistsAtSCN(getUrl(),sql, afterFirstInsertSCN, true);
 int originalRowCount = 2;
-assertRawRowCount(conn, indexTable, originalRowCount);
+assertRawRowCount(conn, dataTable, originalRowCount);
 //force a flush
-flush(indexTable);
+flush(dataTable);
 //flush shouldn't have changed it
-assertRawRowCount(conn, indexTable, originalRowCount);
+assertRawRowCount(conn, dataTable, originalRowCount);
+  // assertExplainPlan(conn, sql, dataTableName, 
fullIndexName);
 
 Review comment:
   nit: remove commented code


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [phoenix] gokceni commented on a change in pull request #679: PHOENIX-5645 - GlobalIndexChecker should prevent compaction from purg…

2020-01-14 Thread GitBox
gokceni commented on a change in pull request #679: PHOENIX-5645 - 
GlobalIndexChecker should prevent compaction from purg…
URL: https://github.com/apache/phoenix/pull/679#discussion_r366594061
 
 

 ##
 File path: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/MaxLookbackIT.java
 ##
 @@ -168,36 +184,48 @@ public void testTTLAndMaxLookbackAge() throws Exception {
 conf.setLong(HRegion.MEMSTORE_PERIODIC_FLUSH_INTERVAL, 0L);
 try (Connection conn = DriverManager.getConnection(getUrl())) {
 String dataTableName = generateUniqueName();
-String indexStem = generateUniqueName();
-createTableAndIndexes(conn, dataTableName, indexStem);
-long afterFirstInsertSCN = 
org.apache.phoenix.util.EnvironmentEdgeManager.currentTimeMillis();
+createTable(dataTableName);
+//increment by 10 min to make sure we don't "look back" past table 
creation
+injectEdge.incValue(WAIT_AFTER_TABLE_CREATION);
+populateTable(dataTableName);
+injectEdge.incValue(1);
+long afterFirstInsertSCN = 
EnvironmentEdgeManager.currentTimeMillis();
 TableName dataTable = TableName.valueOf(dataTableName);
 assertTableHasTtl(conn, dataTable, ttl);
-String fullIndexName = indexStem + "1";
-TableName indexTable = TableName.valueOf(fullIndexName);
-assertTableHasTtl(conn, indexTable, ttl);
-
 //first make sure we inserted correctly
-String sql = String.format("SELECT val2 FROM %s WHERE val1 = 
'ab'", dataTableName);
-assertExplainPlan(conn, sql, dataTableName, fullIndexName);
+String sql = String.format("SELECT val2 FROM %s WHERE id = 'a'", 
dataTableName);
+  //  assertExplainPlan(conn, sql, dataTableName, fullIndexName);
 assertRowExistsAtSCN(getUrl(),sql, afterFirstInsertSCN, true);
 int originalRowCount = 2;
-assertRawRowCount(conn, indexTable, originalRowCount);
+assertRawRowCount(conn, dataTable, originalRowCount);
 //force a flush
-flush(indexTable);
+flush(dataTable);
 //flush shouldn't have changed it
-assertRawRowCount(conn, indexTable, originalRowCount);
+assertRawRowCount(conn, dataTable, originalRowCount);
+  // assertExplainPlan(conn, sql, dataTableName, 
fullIndexName);
+long timeToSleep = (MAX_LOOKBACK_AGE * 1000) -
+(EnvironmentEdgeManager.currentTimeMillis() - 
afterFirstInsertSCN);
+if (timeToSleep > 0) {
+injectEdge.incValue(timeToSleep);
+//Thread.sleep(timeToSleep);
 
 Review comment:
   nit: remove commented code


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [phoenix] gokceni commented on a change in pull request #679: PHOENIX-5645 - GlobalIndexChecker should prevent compaction from purg…

2020-01-14 Thread GitBox
gokceni commented on a change in pull request #679: PHOENIX-5645 - 
GlobalIndexChecker should prevent compaction from purg…
URL: https://github.com/apache/phoenix/pull/679#discussion_r366589942
 
 

 ##
 File path: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/MaxLookbackIT.java
 ##
 @@ -168,36 +184,48 @@ public void testTTLAndMaxLookbackAge() throws Exception {
 conf.setLong(HRegion.MEMSTORE_PERIODIC_FLUSH_INTERVAL, 0L);
 try (Connection conn = DriverManager.getConnection(getUrl())) {
 String dataTableName = generateUniqueName();
-String indexStem = generateUniqueName();
-createTableAndIndexes(conn, dataTableName, indexStem);
-long afterFirstInsertSCN = 
org.apache.phoenix.util.EnvironmentEdgeManager.currentTimeMillis();
+createTable(dataTableName);
+//increment by 10 min to make sure we don't "look back" past table 
creation
+injectEdge.incValue(WAIT_AFTER_TABLE_CREATION);
+populateTable(dataTableName);
+injectEdge.incValue(1);
+long afterFirstInsertSCN = 
EnvironmentEdgeManager.currentTimeMillis();
 TableName dataTable = TableName.valueOf(dataTableName);
 assertTableHasTtl(conn, dataTable, ttl);
-String fullIndexName = indexStem + "1";
-TableName indexTable = TableName.valueOf(fullIndexName);
-assertTableHasTtl(conn, indexTable, ttl);
-
 //first make sure we inserted correctly
-String sql = String.format("SELECT val2 FROM %s WHERE val1 = 
'ab'", dataTableName);
-assertExplainPlan(conn, sql, dataTableName, fullIndexName);
+String sql = String.format("SELECT val2 FROM %s WHERE id = 'a'", 
dataTableName);
+  //  assertExplainPlan(conn, sql, dataTableName, fullIndexName);
 
 Review comment:
   nit: remove commented code


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [phoenix] gokceni commented on a change in pull request #679: PHOENIX-5645 - GlobalIndexChecker should prevent compaction from purg…

2020-01-14 Thread GitBox
gokceni commented on a change in pull request #679: PHOENIX-5645 - 
GlobalIndexChecker should prevent compaction from purg…
URL: https://github.com/apache/phoenix/pull/679#discussion_r366589265
 
 

 ##
 File path: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/MaxLookbackIT.java
 ##
 @@ -59,10 +57,31 @@
 @NeedsOwnMiniClusterTest
 public class MaxLookbackIT extends BaseUniqueNamesOwnClusterIT {
 private static final Log LOG = LogFactory.getLog(MaxLookbackIT.class);
-private static final int MAX_LOOKBACK_AGE = 10;
+private static final int MAX_LOOKBACK_AGE = 15;
 private static final int ROWS_POPULATED = 2;
+public static final int WAIT_AFTER_TABLE_CREATION = 60;
 
 Review comment:
   Can we write the unit as part of const name?


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:
us...@infra.apache.org


With regards,
Apache Git Services