/** * Explicitly clears the region cache to fetch the latest value from META. * This is a power user function: avoid unless you know the ramifications. */ public void clearRegionCache() { this.connection.clearRegionCache(); }
@Override protected Void postOperationResult(final Void result, final long deadlineTs) throws IOException, TimeoutException { // Delete cached information to prevent clients from using old locations ((ClusterConnection) getAdmin().getConnection()).clearRegionCache(getTableName()); return super.postOperationResult(result, deadlineTs); } }
/** * delete table in preparation for next test * * @param tablename * @throws IOException */ void cleanupTable(TableName tablename) throws Exception { if (tbl != null) { tbl.close(); tbl = null; } ((ClusterConnection) connection).clearRegionCache(); deleteTable(TEST_UTIL, tablename); }
FileSystem fs = tableDir.getFileSystem(connection.getConfiguration()); ((ClusterConnection)connection).clearRegionCache(); TableDescriptor htd = null; try (Table table = connection.getTable(tableName)) { LOG.debug("No Server Exception thrown for: " + splitAlgo.rowToStr(start)); physicalSplitting.add(region); ((ClusterConnection)connection).clearRegionCache();
/** * Explicitly clears the region cache to fetch the latest value from META. * This is a power user function: avoid unless you know the ramifications. */ public void clearRegionCache() { this.connection.clearRegionCache(); }
@Before public void before() throws IOException { ((ClusterConnection) HTU.getAdmin().getConnection()).clearRegionCache(); try { openRegion(hriPrimary); } catch (Exception ignored) { } try { openRegion(hriSecondary); } catch (Exception ignored) { } }
@After public void after() throws IOException, KeeperException { try { closeRegion(hriSecondary); } catch (Exception ignored) { } try { closeRegion(hriPrimary); } catch (Exception ignored) { } ((ClusterConnection) HTU.getAdmin().getConnection()).clearRegionCache(); }
@Override public void clearTableRegionCache(TableName tableName) throws SQLException { ((ClusterConnection)connection).clearRegionCache(tableName); }
/** * Do a split, and verify that this only affects one table */ private void runTestRegionOperationsIndependent() throws Exception { // Verify that region information is the same pre-split ((ClusterConnection) UTIL.getConnection()).clearRegionCache(); List<HRegionInfo> originalTableHRegions = admin.getTableRegions(originalTableName); final int originalRegionCount = originalTableHRegions.size(); final int cloneTableRegionCount = admin.getTableRegions(cloneTableName).size(); Assert.assertEquals( "The number of regions in the cloned table is different than in the original table.", originalRegionCount, cloneTableRegionCount); // Split a region on the parent table admin.splitRegion(originalTableHRegions.get(0).getRegionName()); waitOnSplit(UTIL.getConnection(), originalTable, originalRegionCount); // Verify that the cloned table region is not split final int cloneTableRegionCount2 = admin.getTableRegions(cloneTableName).size(); Assert.assertEquals( "The number of regions in the cloned table changed though none of its regions were split.", cloneTableRegionCount, cloneTableRegionCount2); }
table.put(put); conn.clearRegionCache();
util.getHBaseClusterInterface().waitForRegionServerToStop(primary, 60000); ((ClusterConnection)c).clearRegionCache(); util.getHBaseClusterInterface().waitForActiveAndReadyMaster(); LOG.info("Master active!"); ((ClusterConnection)c).clearRegionCache();
@Test public void testLocations() throws Exception { byte[] b1 = "testLocations".getBytes(); openRegion(hriSecondary); ClusterConnection hc = (ClusterConnection) HTU.getAdmin().getConnection(); try { hc.clearRegionCache(); RegionLocations rl = hc.locateRegion(table.getName(), b1, false, false); Assert.assertEquals(2, rl.size()); rl = hc.locateRegion(table.getName(), b1, true, false); Assert.assertEquals(2, rl.size()); hc.clearRegionCache(); rl = hc.locateRegion(table.getName(), b1, true, false); Assert.assertEquals(2, rl.size()); rl = hc.locateRegion(table.getName(), b1, false, false); Assert.assertEquals(2, rl.size()); } finally { closeRegion(hriSecondary); } }
@Override protected Void postOperationResult(final Void result, final long deadlineTs) throws IOException, TimeoutException { // Delete cached information to prevent clients from using old locations ((ClusterConnection) getAdmin().getConnection()).clearRegionCache(getTableName()); return super.postOperationResult(result, deadlineTs); } }
@Override public void clearRegionCache(byte[] tableName) { wrappedConnection.clearRegionCache(tableName); }
/** * Explicitly clears the region cache to fetch the latest value from META. * This is a power user function: avoid unless you know the ramifications. */ public void clearRegionCache() { this.connection.clearRegionCache(); }
Configuration configuration = conn.unwrap(PhoenixConnection.class).getQueryServices().getConfiguration(); org.apache.hadoop.hbase.client.Connection hbaseConn = ConnectionFactory.createConnection(configuration); ((ClusterConnection)hbaseConn).clearRegionCache(TableName.valueOf(tableName)); RegionLocator regionLocator = hbaseConn.getRegionLocator(TableName.valueOf(tableName)); int nRegions = regionLocator.getAllRegionLocations().size();
primaryTable.close(); primaryTable = hbaseConn.getTable(TableName.valueOf(DATA_TABLE_NAME)); ((ClusterConnection)hbaseConn).clearRegionCache(); resultScanner = primaryTable.getScanner(scan); count = 0;
@Override protected Void postOperationResult(final Void result, final long deadlineTs) throws IOException, TimeoutException { // Delete cached information to prevent clients from using old locations ((ClusterConnection) getAdmin().getConnection()).clearRegionCache(getTableName()); return super.postOperationResult(result, deadlineTs); } }
@Before public void before() throws IOException { ((ClusterConnection) HTU.getAdmin().getConnection()).clearRegionCache(); try { openRegion(hriPrimary); } catch (Exception ignored) { } try { openRegion(hriSecondary); } catch (Exception ignored) { } }
@After public void after() throws IOException, KeeperException { try { closeRegion(hriSecondary); } catch (Exception ignored) { } try { closeRegion(hriPrimary); } catch (Exception ignored) { } ((ClusterConnection) HTU.getAdmin().getConnection()).clearRegionCache(); }