/** * Check whether region cache prefetch is enabled or not for the table. * @param conf The Configuration object to use. * @param tableName name of table to check * @return true if table's region cache prefecth is enabled. Otherwise * it is disabled. * @throws IOException */ public static boolean getRegionCachePrefetch(final Configuration conf, final byte[] tableName) throws IOException { return HConnectionManager.execute(new HConnectable<Boolean>(conf) { @Override public Boolean connect(HConnection connection) throws IOException { return connection.getRegionCachePrefetch(tableName); } }); }
/** * It's provided for unit test cases which verify the behavior of region * location cache prefetch. * @return true if the region where the table and row reside is cached. * @throws ZooKeeperConnectionException */ static boolean isRegionCached(Configuration conf, final byte[] tableName, final byte[] row) throws IOException { return execute(new HConnectable<Boolean>(conf) { @Override public Boolean connect(HConnection connection) { return ((HConnectionImplementation) connection).isRegionCached(tableName, row); } }); }
/** * Tells whether or not a table is enabled or not. * @param conf The Configuration object to use. * @param tableName Name of table to check. * @return {@code true} if table is online. * @throws IOException if a remote or network exception occurs */ public static boolean isTableEnabled(Configuration conf, final byte[] tableName) throws IOException { return HConnectionManager.execute(new HConnectable<Boolean>(conf) { @Override public Boolean connect(HConnection connection) throws IOException { return connection.isTableEnabled(tableName); } }); }
/** * It is provided for unit test cases which verify the behavior of region * location cache prefetch. * @return Number of cached regions for the table. * @throws ZooKeeperConnectionException */ static int getCachedRegionCount(Configuration conf, final byte[] tableName) throws IOException { return execute(new HConnectable<Integer>(conf) { @Override public Integer connect(HConnection connection) { return ((HConnectionImplementation) connection) .getNumberOfCachedRegionLocations(tableName); } }); }
/** * Enable or disable region cache prefetch for the table. It will be * applied for the given table's all HTable instances who share the same * connection. By default, the cache prefetch is enabled. * @param conf The Configuration object to use. * @param tableName name of table to configure. * @param enable Set to true to enable region cache prefetch. Or set to * false to disable it. * @throws IOException */ public static void setRegionCachePrefetch(final Configuration conf, final byte[] tableName, final boolean enable) throws IOException { HConnectionManager.execute(new HConnectable<Void>(conf) { @Override public Void connect(HConnection connection) throws IOException { connection.setRegionCachePrefetch(tableName, enable); return null; } }); }
/** * Check whether region cache prefetch is enabled or not for the table. * @param tableName name of table to check * @return true if table's region cache prefecth is enabled. Otherwise * it is disabled. * @throws IOException */ public static boolean getRegionCachePrefetch(final byte[] tableName) throws IOException { return HConnectionManager.execute(new HConnectable<Boolean>( HBaseConfiguration.create()) { @Override public Boolean connect(HConnection connection) throws IOException { return connection.getRegionCachePrefetch(tableName); } }); }
/** * Enable or disable region cache prefetch for the table. It will be * applied for the given table's all HTable instances who share the same * connection. By default, the cache prefetch is enabled. * @param tableName name of table to configure. * @param enable Set to true to enable region cache prefetch. Or set to * false to disable it. * @throws IOException */ public static void setRegionCachePrefetch(final byte[] tableName, final boolean enable) throws IOException { HConnectionManager.execute(new HConnectable<Void>(HBaseConfiguration .create()) { @Override public Void connect(HConnection connection) throws IOException { connection.setRegionCachePrefetch(tableName, enable); return null; } }); }
/** * Tells whether or not a table is enabled or not. * @param conf The Configuration object to use. * @param tableName Name of table to check. * @return {@code true} if table is online. * @throws IOException if a remote or network exception occurs * @deprecated use {@link HBaseAdmin#isTableEnabled(org.apache.hadoop.hbase.TableName tableName)} */ @Deprecated public static boolean isTableEnabled(Configuration conf, final TableName tableName) throws IOException { return HConnectionManager.execute(new HConnectable<Boolean>(conf) { @Override public Boolean connect(HConnection connection) throws IOException { return connection.isTableEnabled(tableName); } }); }
/** * Load the list of disabled tables in ZK into local set. * @throws ZooKeeperConnectionException * @throws IOException */ private void loadDisabledTables() throws ZooKeeperConnectionException, IOException { HConnectionManager.execute(new HConnectable<Void>(getConf()) { @Override public Void connect(HConnection connection) throws IOException { ZooKeeperWatcher zkw = connection.getZooKeeperWatcher(); try { for (String tableName : ZKTableReadOnly.getDisabledOrDisablingTables(zkw)) { disabledTables.add(Bytes.toBytes(tableName)); } } catch (KeeperException ke) { throw new IOException(ke); } return null; } }); }
/** * Load the list of disabled tables in ZK into local set. * @throws ZooKeeperConnectionException * @throws IOException */ private void loadDisabledTables() throws ZooKeeperConnectionException, IOException { HConnectionManager.execute(new HConnectable<Void>(getConf()) { @Override public Void connect(HConnection connection) throws IOException { ZooKeeperWatcher zkw = createZooKeeperWatcher(); try { for (TableName tableName : ZKTableStateClientSideReader.getDisabledOrDisablingTables(zkw)) { disabledTables.add(tableName); } } catch (KeeperException ke) { throw new IOException(ke); } catch (InterruptedException e) { throw new InterruptedIOException(); } finally { zkw.close(); } return null; } }); }
throws IOException { try { HConnectionManager.execute(new HConnectable<Void>(configuration) { @Override public Void connect(HConnection connection) throws IOException {
throw new IOException("Replication needs to be enabled to verify it."); HConnectionManager.execute(new HConnectable<Void>(conf) { @Override public Void connect(HConnection conn) throws IOException {
endTime == 0 ? HConstants.LATEST_TIMESTAMP : endTime); HConnectionManager.execute(new HConnectable<Void>(conf) { @Override public Void connect(HConnection conn) throws IOException {
if (testMasterRunning) { masterIsRunning = HConnectionManager .execute(new HConnectable<Boolean>(conf) { @Override public Boolean connect(HConnection connection) throws IOException {
HConnectionManager.execute(new HConnectable<Void>(conf) { @Override public Void connect(HConnection conn) throws IOException {
if (testMasterRunning) { masterIsRunning = HConnectionManager .execute(new HConnectable<Boolean>(conf) { @Override public Boolean connect(HConnection connection) throws IOException {