public Transaction(HConnection connection) throws IOException { this(connection.getConfiguration(), connection); }
public RegionCoprocessorRpcChannel(HConnection conn, TableName table, byte[] row) { this.connection = conn; this.table = table; this.row = row; this.rpcFactory = RpcRetryingCallerFactory.instantiate(conn.getConfiguration(), null); this.operationTimeout = conn.getConfiguration().getInt( HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, HConstants.DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT); }
/** * Contacts a region server and waits up to hbase.hbck.close.timeout ms * (default 120s) to close the region. This bypasses the active hmaster. */ @SuppressWarnings("deprecation") public static void closeRegionSilentlyAndWait(HConnection connection, ServerName server, HRegionInfo region) throws IOException, InterruptedException { long timeout = connection.getConfiguration() .getLong("hbase.hbck.close.timeout", 120000); ServerManager.closeRegionSilentlyAndWait((ClusterConnection)connection, server, region, timeout); }
/** * @param connection which connection * @param tableName table callable is on * @param scan the scan to execute * @param scanMetrics the ScanMetrics to used, if it is null, ScannerCallable * won't collect metrics */ public ScannerCallable (HConnection connection, byte [] tableName, Scan scan, ScanMetrics scanMetrics) { super(connection, tableName, scan.getStartRow()); this.scan = scan; this.scanMetrics = scanMetrics; Configuration conf = connection.getConfiguration(); logScannerActivity = conf.getBoolean(LOG_SCANNER_ACTIVITY, false); logCutOffLatency = conf.getInt(LOG_SCANNER_LATENCY_CUTOFF, 1000); }
/** * Constructor for externally managed HConnections. * This constructor fails fast if the HMaster is not running. * The HConnection can be re-used again in another attempt. * This constructor fails fast. * * @param connection The HConnection instance to use * @throws MasterNotRunningException if the master is not running * @throws ZooKeeperConnectionException if unable to connect to zookeeper */ public HBaseAdmin(HConnection connection) throws MasterNotRunningException, ZooKeeperConnectionException { this.conf = connection.getConfiguration(); this.connection = connection; this.pause = this.conf.getLong("hbase.client.pause", 1000); this.numRetries = this.conf.getInt("hbase.client.retries.number", 10); this.retryLongerMultiplier = this.conf.getInt( "hbase.client.retries.longer.multiplier", 10); this.connection.getMaster(); }
private static long countNumberOfRows(HConnection connection, byte[] tableName, byte[] columnFamily) throws Throwable { AggregationClient aggregationClient = new AggregationClient(connection.getConfiguration()); Scan scan = new Scan(); scan.addFamily(columnFamily); return aggregationClient.rowCount(tableName, null, scan); }
/** * Creates an object to access a HBase table. * Shares zookeeper connection and other resources with other HTable instances * created with the same <code>connection</code> instance. * Use this constructor when the ExecutorService and HConnection instance are * externally managed. * @param tableName Name of the table. * @param connection HConnection to be used. * @param pool ExecutorService to be used. * @throws IOException if a remote or network exception occurs */ public HTable(final byte[] tableName, final HConnection connection, final ExecutorService pool) throws IOException { if (pool == null || pool.isShutdown()) { throw new IllegalArgumentException("Pool is null or shut down."); } if (connection == null || connection.isClosed()) { throw new IllegalArgumentException("Connection is null or closed."); } this.tableName = tableName; this.cleanupPoolOnClose = this.cleanupConnectionOnClose = false; this.connection = connection; this.configuration = connection.getConfiguration(); this.pool = pool; this.finishSetup(); }
private static long countNumberOfRows(HConnection connection, byte[] tableName, byte[] columnFamily) throws Throwable { AggregationClient aggregationClient = new AggregationClient(connection.getConfiguration()); Scan scan = new Scan(); scan.addFamily(columnFamily); return aggregationClient.rowCount(tableName, null, scan); }
/** * Callers should call close on the returned {@link HTable} instance. * @param catalogTracker We'll use this catalogtracker's connection * @param tableName Table to get an {@link HTable} against. * @return An {@link HTable} for <code>tableName</code> * @throws IOException */ private static HTable getHTable(final CatalogTracker catalogTracker, final byte [] tableName) throws IOException { // Passing the CatalogTracker's connection configuration ensures this // HTable instance uses the CatalogTracker's connection. org.apache.hadoop.hbase.client.HConnection c = catalogTracker.getConnection(); if (c == null) throw new NullPointerException("No connection"); return new HTable(catalogTracker.getConnection().getConfiguration(), tableName); }
success = server.bulkLoadHFiles(famPaths, regionName); } else { HTable table = new HTable(conn.getConfiguration(), tableName); secureClient = new SecureBulkLoadClient(table, location.getRegionInfo().getStartKey()); success = secureClient.bulkLoadHFiles(famPaths, userToken, bulkToken);
Configuration c = getConnection().getConfiguration(); final long pause = c.getLong(HConstants.HBASE_CLIENT_PAUSE, HConstants.DEFAULT_HBASE_CLIENT_PAUSE);
public static void strictAssertEquals(HConnection connection, InputStream dataset) throws Throwable { DataSetParser dataSetParser = new JsonDataSetParser(); ParsedDataModel parsedDataset = dataSetParser.parse(dataset); Configuration configuration = connection.getConfiguration(); HBaseAdmin hBaseAdmin = new HBaseAdmin(configuration); byte[] expectedTableName = checkTableName(parsedDataset, hBaseAdmin); HTableDescriptor tableDescriptor = hBaseAdmin.getTableDescriptor(expectedTableName); List<ParsedColumnFamilyModel> expectedColumnFamilies = parsedDataset.getColumnFamilies(); checkNumberOfColumnFamilies(tableDescriptor, expectedColumnFamilies); checkColumnFamilies(connection, configuration, expectedTableName, tableDescriptor, expectedColumnFamilies); }
public static void strictAssertEquals(HConnection connection, InputStream dataset) throws Throwable { DataSetParser dataSetParser = new JsonDataSetParser(); ParsedDataModel parsedDataset = dataSetParser.parse(dataset); Configuration configuration = connection.getConfiguration(); HBaseAdmin hBaseAdmin = new HBaseAdmin(configuration); byte[] expectedTableName = checkTableName(parsedDataset, hBaseAdmin); HTableDescriptor tableDescriptor = hBaseAdmin.getTableDescriptor(expectedTableName); List<ParsedColumnFamilyModel> expectedColumnFamilies = parsedDataset.getColumnFamilies(); checkNumberOfColumnFamilies(tableDescriptor, expectedColumnFamilies); checkColumnFamilies(connection, configuration, expectedTableName, tableDescriptor, expectedColumnFamilies); }
if (startrow != null) scan.setStartRow(startrow); if (startrow == null && !scanRoot) { int caching = catalogTracker.getConnection().getConfiguration() .getInt(HConstants.HBASE_META_SCANNER_CACHING, 100); scan.setCaching(caching);
int cleanedLockCount = 0; try { hTable = new HTable(connection.getConfiguration(), tableName); Scan scan = new Scan(); scan.addFamily(ColumnUtil.LOCK_FAMILY_NAME);
writeLockAndData(COLUMN); Mockito.when(mockRegister.isWorkerAlive(lc.getClientAddress())).thenReturn(false); HBaseAdmin admin = new HBaseAdmin(connection.getConfiguration()); admin.disableTable(TABLENAME); try {
HBaseAdmin admin = new HBaseAdmin(connection.getConfiguration()); admin.disableTable(ANOTHER_TABLENAME); transaction.commitSecondaries();
HBaseAdmin admin = new HBaseAdmin(connection.getConfiguration()); admin.disableTable(ANOTHER_TABLENAME); transaction.commitSecondaries();
HBaseAdmin admin = new HBaseAdmin(connection.getConfiguration()); admin.disableTable(TABLENAME); try {