swaroopak commented on a change in pull request #685: PHOENIX-5676
Inline-verification from IndexTool does not handle TTL/r…
URL: https://github.com/apache/phoenix/pull/685#discussion_r367056891
##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
##########
@@ -510,6 +508,72 @@ public void testIndexToolOnlyVerifyOption() throws
Exception {
}
}
+ @Test
+ public void testIndexToolVerifyWithExpiredIndexRows() throws Exception {
+ if (localIndex || transactional || !directApi || useSnapshot) {
+ return;
+ }
+ String schemaName = generateUniqueName();
+ String dataTableName = generateUniqueName();
+ String dataTableFullName = SchemaUtil.getTableName(schemaName,
dataTableName);
+ String indexTableName = generateUniqueName();
+ String indexTableFullName = SchemaUtil.getTableName(schemaName,
indexTableName);
+ Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+ try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
+ conn.createStatement().execute("CREATE TABLE " + dataTableFullName
+ + " (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR, CODE
VARCHAR) COLUMN_ENCODED_BYTES=0");
+ // Insert a row
+ conn.createStatement()
+ .execute("upsert into " + dataTableFullName + " values (1,
'Phoenix', 'A')");
+ conn.commit();
+ conn.createStatement()
+ .execute(String.format("CREATE INDEX %s ON %s (NAME)
INCLUDE (CODE) ASYNC",
+ indexTableName, dataTableFullName));
+ runIndexTool(directApi, useSnapshot, schemaName, dataTableName,
indexTableName, null, 0,
+ IndexTool.IndexVerifyType.ONLY);
+ Cell cell =
+ getErrorMessageFromIndexToolOutputTable(conn,
dataTableFullName,
+ indexTableFullName);
+ byte[] expectedValueBytes = Bytes.toBytes("Missing index rows -
Expected: 1 Actual: 0");
+ assertTrue(Bytes.compareTo(cell.getValueArray(),
cell.getValueOffset(),
+ cell.getValueLength(), expectedValueBytes, 0,
expectedValueBytes.length) == 0);
+
+ // Run the index tool to populate the index while verifying rows
+ runIndexTool(directApi, useSnapshot, schemaName, dataTableName,
indexTableName, null, 0,
+ IndexTool.IndexVerifyType.AFTER);
+
+ // Set ttl of index table ridiculously low so that all data is
expired
+ Admin admin =
conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin();
+ TableName indexTable = TableName.valueOf(indexTableFullName);
+ HColumnDescriptor desc =
admin.getTableDescriptor(indexTable).getColumnFamilies()[0];
+ desc.setTimeToLive(1);
+ admin.modifyColumn(indexTable, desc);
+ Thread.sleep(1000);
Review comment:
is it not sleeping because the test would want to expire the row?
----------------------------------------------------------------
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