Source:
public void testCompactDisabledIndex() throws Exception { if (localIndex || tableDDLOptions.contains("TRANSACTIONAL=true")) return; try (Connection conn = getConnection()) { String schemaName = generateUniqueName(); String dataTableName = generateUniqueName() + "_DATA"; String dataTableFullName = SchemaUtil.getTableName(schemaName, dataTableName); String indexTableName = generateUniqueName() + "_IDX"; String indexTableFullName = SchemaUtil.getTableName(schemaName, indexTableName); conn.createStatement().execute( String.format(PartialScannerResultsDisabledIT.TEST_TABLE_DDL, dataTableFullName)); conn.createStatement().execute( String.format(PartialScannerResultsDisabledIT.INDEX_1_DDL, indexTableName, dataTableFullName)); PartialScannerResultsDisabledIT.writeSingleBatch(conn, 1, 1, dataTableFullName); List<HRegion> regions = getUtility().getHBaseCluster().getRegions(TableName.valueOf(dataTableFullName)); HRegion hRegion = regions.get(0); hRegion.flush( true); conn.createStatement().execute("DELETE FROM " + dataTableFullName); conn.commit(); PhoenixConnection pConn = conn.unwrap(PhoenixConnection.class); IndexUtil.updateIndexState(pConn, indexTableFullName, PIndexState.DISABLE, EnvironmentEdgeManager.currentTimeMillis()); hRegion.flush(true); hRegion.compact(true); Table dataTable = conn.unwrap(PhoenixConnection.class).getQueryServices() .getTable(Bytes.toBytes(dataTableFullName)); assertEquals(1, TestUtil.getRawRowCount(dataTable)); IndexUtil.updateIndexState(pConn, indexTableFullName, PIndexState.INACTIVE, EnvironmentEdgeManager.currentTimeMillis()); IndexUtil.updateIndexState(pConn, indexTableFullName, PIndexState.ACTIVE, 0L); hRegion.compact(true); dataTable = conn.unwrap(PhoenixConnection.class).getQueryServices() .getTable(Bytes.toBytes(dataTableFullName)); assertEquals(0, TestUtil.getRawRowCount(dataTable)); } }

Target:
public void testCompactDisabledIndex() throws Exception { if (localIndex || tableDDLOptions.contains("TRANSACTIONAL=true")) { return; } try (Connection conn = getConnection()) { String schemaName = generateUniqueName(); String dataTableName = generateUniqueName() + "_DATA"; String dataTableFullName = SchemaUtil.getTableName(schemaName, dataTableName); String indexTableName = generateUniqueName() + "_IDX"; String indexTableFullName = SchemaUtil.getTableName(schemaName, indexTableName); conn.createStatement().execute( String.format(PartialScannerResultsDisabledIT.TEST_TABLE_DDL, dataTableFullName)); conn.createStatement().execute( String.format(PartialScannerResultsDisabledIT.INDEX_1_DDL, indexTableName, dataTableFullName)); PartialScannerResultsDisabledIT.writeSingleBatch(conn, 1, 1, dataTableFullName); List<HRegion> regions = getUtility().getHBaseCluster().getRegions(TableName.valueOf(dataTableFullName)); HRegion hRegion = regions.get(0); hRegion.flush( true); conn.createStatement().execute("DELETE FROM " + dataTableFullName); conn.commit(); PhoenixConnection pConn = conn.unwrap(PhoenixConnection.class); IndexUtil.updateIndexState(pConn, indexTableFullName, PIndexState.DISABLE, EnvironmentEdgeManager.currentTimeMillis()); hRegion.flush(true); hRegion.compact(true); Table dataTable = conn.unwrap(PhoenixConnection.class).getQueryServices() .getTable(Bytes.toBytes(dataTableFullName)); assertEquals(1, TestUtil.getRawRowCount(dataTable)); IndexUtil.updateIndexState(pConn, indexTableFullName, PIndexState.INACTIVE, EnvironmentEdgeManager.currentTimeMillis()); IndexUtil.updateIndexState(pConn, indexTableFullName, PIndexState.ACTIVE, 0L); hRegion.compact(true); dataTable = conn.unwrap(PhoenixConnection.class).getQueryServices() .getTable(Bytes.toBytes(dataTableFullName)); assertEquals(0, TestUtil.getRawRowCount(dataTable)); } }