kadirozde commented on a change in pull request #592: PHOENIX-5505 Index read
repair does not repair unverified rows with h…
URL: https://github.com/apache/phoenix/pull/592#discussion_r331272712
##########
File path:
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexCheckerIT.java
##########
@@ -223,21 +226,52 @@ public void
testSkipDataTableAndPostIndexPartialRowUpdate() throws Exception {
IndexToolIT.runIndexTool(true, false, null, dataTableName,
indexName + "2");
}
// Configure Indexer to skip the last two write phase (i.e., the data
table update and post index update phase)
- // and check that this does not impact the correctness
+ // and check that this does not impact the correctness (one overwrite)
IndexRegionObserver.setSkipDataTableUpdatesForTesting(true);
IndexRegionObserver.setSkipPostIndexUpdatesForTesting(true);
conn.createStatement().execute("upsert into " + dataTableName + " (id,
val2) values ('a', 'abcc')");
conn.commit();
IndexRegionObserver.setSkipDataTableUpdatesForTesting(false);
IndexRegionObserver.setSkipPostIndexUpdatesForTesting(false);
- conn.createStatement().execute("upsert into " + dataTableName + " (id,
val3) values ('a', 'abcdd')");
- conn.commit();
String selectSql = "SELECT val2, val3 from " + dataTableName + "
WHERE val1 = 'ab'";
// Verify that we will read from the first index table
assertExplainPlan(conn, selectSql, dataTableName, indexName + "1");
ResultSet rs = conn.createStatement().executeQuery(selectSql);
assertTrue(rs.next());
assertEquals("abc", rs.getString(1));
+ assertEquals("abcd", rs.getString(2));
+ assertFalse(rs.next());
+ // Configure Indexer to skip the last two write phase (i.e., the data
table update and post index update phase)
+ // and check that this does not impact the correctness (two overwrites)
+ IndexRegionObserver.setSkipDataTableUpdatesForTesting(true);
+ IndexRegionObserver.setSkipPostIndexUpdatesForTesting(true);
+ conn.createStatement().execute("upsert into " + dataTableName + " (id,
val2) values ('a', 'abccc')");
+ conn.commit();
+ conn.createStatement().execute("upsert into " + dataTableName + " (id,
val2) values ('a', 'abcccc')");
+ conn.commit();
+ IndexRegionObserver.setSkipDataTableUpdatesForTesting(false);
+ IndexRegionObserver.setSkipPostIndexUpdatesForTesting(false);
+ // Verify that we will read from the first index table
+ assertExplainPlan(conn, selectSql, dataTableName, indexName + "1");
+ rs = conn.createStatement().executeQuery(selectSql);
+ assertTrue(rs.next());
+ assertEquals("abc", rs.getString(1));
+ assertEquals("abcd", rs.getString(2));
+ assertFalse(rs.next());
+ selectSql = "SELECT val2, val3 from " + dataTableName + " WHERE val2
= 'abcc'";
+ // Verify that we will read from the second index table
+ assertExplainPlan(conn, selectSql, dataTableName, indexName + "2");
+ rs = conn.createStatement().executeQuery(selectSql);
Review comment:
We start with two rows ('a', 'ab', 'abc', 'abcd') and ('b', 'bc', 'bcd',
'bcde').
The we do three unsuccessful attempts to update the first row with different
values (,, 'abcc',), (,,'abccc', ), and (,,'abcccc',). These attempts generate
index rows with unverified status but do not update the data table. Therefore,
the following select statement should return nothing
selectSql = "SELECT val2, val3 from " + dataTableName + " WHERE val2 =
'abcc'";
----------------------------------------------------------------
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