priyankporwal commented on a change in pull request #517: PHOENIX-5211
Consistent Immutable Global Indexes for Non-Transactiona…
URL: https://github.com/apache/phoenix/pull/517#discussion_r298398646
##########
File path:
phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolForPartialBuildIT.java
##########
@@ -121,25 +115,37 @@ public void testSecondaryIndex() throws Exception {
fullTableName, tableDDLOptions));
String upsertQuery = String.format("UPSERT INTO %s VALUES(?, ?,
?)", fullTableName);
PreparedStatement stmt1 = conn.prepareStatement(upsertQuery);
- FailingRegionObserver.FAIL_WRITE = false;
// insert two rows
upsertRow(stmt1, 1000);
upsertRow(stmt1, 2000);
conn.commit();
stmt.execute(String.format("CREATE INDEX %s ON %s
(LPAD(UPPER(NAME),11,'x')||'_xyz') ", indxTable, fullTableName));
- FailingRegionObserver.FAIL_WRITE = true;
upsertRow(stmt1, 3000);
upsertRow(stmt1, 4000);
upsertRow(stmt1, 5000);
- try {
- conn.commit();
- fail();
- } catch (SQLException e) {} catch (Exception e) {}
+ conn.commit();
+
+ // delete these indexes
+ PTable pindexTable = PhoenixRuntime.getTable(conn,
SchemaUtil.getTableName(schemaName, indxTable));
+ Table hTable = admin.getConnection().
+
getTable(TableName.valueOf(pindexTable.getPhysicalName().toString()));
+
+ Scan scan = new Scan();
+ ResultScanner scanner = hTable.getScanner(scan);
+ int cnt=0;
+ for (Result res = scanner.next(); res != null; res =
scanner.next()) {
+ cnt++;
+ if (cnt > 2) {
+ hTable.delete(new Delete(res.getRow()));
+ }
+ }
+ hTable.close();
Review comment:
Please create hTable with try (i.e. try with resources)
----------------------------------------------------------------
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