/** * Sets the number of reduce tasks for the given job configuration to the * number of regions the given table has. * * @param table The table to get the region count for. * @param job The current job to adjust. * @throws IOException When retrieving the table details fails. */ public static void setNumReduceTasks(String table, Job job) throws IOException { job.setNumReduceTasks(MetaTableAccessor.getRegionCount(job.getConfiguration(), TableName.valueOf(table))); }
/** * Count regions in <code>hbase:meta</code> for passed table. * @param c Configuration object * @param tableName table name to count regions for * @return Count or regions in table <code>tableName</code> */ public static int getRegionCount(final Configuration c, final TableName tableName) throws IOException { try (Connection connection = ConnectionFactory.createConnection(c)) { return getRegionCount(connection, tableName); } }
/** * Sets the number of reduce tasks for the given job configuration to the * number of regions the given table has. * * @param table The table to get the region count for. * @param job The current job configuration to adjust. * @throws IOException When retrieving the table details fails. */ public static void setNumReduceTasks(String table, JobConf job) throws IOException { job.setNumReduceTasks(MetaTableAccessor.getRegionCount(HBaseConfiguration.create(job), TableName.valueOf(table))); }
/** * Sets the number of map tasks for the given job configuration to the * number of regions the given table has. * * @param table The table to get the region count for. * @param job The current job configuration to adjust. * @throws IOException When retrieving the table details fails. */ public static void setNumMapTasks(String table, JobConf job) throws IOException { job.setNumMapTasks(MetaTableAccessor.getRegionCount(HBaseConfiguration.create(job), TableName.valueOf(table))); }
/** * Ensures that the given number of reduce tasks for the given job * configuration does not exceed the number of regions for the given table. * * @param table The table to get the region count for. * @param job The current job to adjust. * @throws IOException When retrieving the table details fails. */ public static void limitNumReduceTasks(String table, Job job) throws IOException { int regions = MetaTableAccessor.getRegionCount(job.getConfiguration(), TableName.valueOf(table)); if (job.getNumReduceTasks() > regions) job.setNumReduceTasks(regions); }
/** * Ensures that the given number of reduce tasks for the given job * configuration does not exceed the number of regions for the given table. * * @param table The table to get the region count for. * @param job The current job configuration to adjust. * @throws IOException When retrieving the table details fails. */ // Used by tests. public static void limitNumReduceTasks(String table, JobConf job) throws IOException { int regions = MetaTableAccessor.getRegionCount(HBaseConfiguration.create(job), TableName.valueOf(table)); if (job.getNumReduceTasks() > regions) job.setNumReduceTasks(regions); }
/** * Ensures that the given number of map tasks for the given job * configuration does not exceed the number of regions for the given table. * * @param table The table to get the region count for. * @param job The current job configuration to adjust. * @throws IOException When retrieving the table details fails. */ // Used by tests. public static void limitNumMapTasks(String table, JobConf job) throws IOException { int regions = MetaTableAccessor.getRegionCount(HBaseConfiguration.create(job), TableName.valueOf(table)); if (job.getNumMapTasks() > regions) job.setNumMapTasks(regions); }
if (partitioner == HRegionPartitioner.class) { job.setPartitionerClass(HRegionPartitioner.class); int regions = MetaTableAccessor.getRegionCount(conf, TableName.valueOf(table)); if (job.getNumReduceTasks() > regions) { job.setNumReduceTasks(regions);
job.setPartitionerClass(HRegionPartitioner.class); int regions = MetaTableAccessor.getRegionCount(HBaseConfiguration.create(job), TableName.valueOf(table)); if (job.getNumReduceTasks() > regions) { job.setNumReduceTasks(regions);
onlineRegions = MetaTableAccessor.getRegionCount(connection, tableName); LOG.debug(onlineRegions + " of " + splitCount + " regions online..."); if (onlineRegions < splitCount) {
assertEquals(5, MetaTableAccessor.getRegionCount(TEST_UTIL.getConnection(), tableName)); m.normalizeRegions(); while (MetaTableAccessor.getRegionCount(TEST_UTIL.getConnection(), tableName) > 4) { LOG.info("Waiting for normalization merge to complete"); Thread.sleep(100); assertEquals(4, MetaTableAccessor.getRegionCount(TEST_UTIL.getConnection(), tableName));
/** * Count regions in <code>hbase:meta</code> for passed table. * @param c Configuration object * @param tableName table name to count regions for * @return Count or regions in table <code>tableName</code> */ public static int getRegionCount(final Configuration c, final TableName tableName) throws IOException { try (Connection connection = ConnectionFactory.createConnection(c)) { return getRegionCount(connection, tableName); } }
assertEquals(5, MetaTableAccessor.getRegionCount(TEST_UTIL.getConnection(), TABLENAME));
LOG.info("regionB: " + regionA.getEncodedName() + " with FN: " + fnm.getFavoredNodes(regionB)); int countOfRegions = MetaTableAccessor.getRegionCount(TEST_UTIL.getConfiguration(), tableName); admin.mergeRegionsAsync(regionA.getEncodedNameAsBytes(), regionB.getEncodedNameAsBytes(), false).get(60, TimeUnit.SECONDS);
/** * Count regions in <code>hbase:meta</code> for passed table. * @param c Configuration object * @param tableName table name to count regions for * @return Count or regions in table <code>tableName</code> * @throws IOException */ @Deprecated public static int getRegionCount(final Configuration c, final String tableName) throws IOException { return getRegionCount(c, TableName.valueOf(tableName)); }
/** * Sets the number of reduce tasks for the given job configuration to the * number of regions the given table has. * * @param table The table to get the region count for. * @param job The current job to adjust. * @throws IOException When retrieving the table details fails. */ public static void setNumReduceTasks(String table, Job job) throws IOException { job.setNumReduceTasks(MetaTableAccessor.getRegionCount(job.getConfiguration(), TableName.valueOf(table))); }
/** * Sets the number of map tasks for the given job configuration to the * number of regions the given table has. * * @param table The table to get the region count for. * @param job The current job configuration to adjust. * @throws IOException When retrieving the table details fails. */ public static void setNumMapTasks(String table, JobConf job) throws IOException { job.setNumMapTasks(MetaTableAccessor.getRegionCount(HBaseConfiguration.create(job), TableName.valueOf(table))); }
/** * Count regions in <code>hbase:meta</code> for passed table. * @param c Configuration object * @param tableName table name to count regions for * @return Count or regions in table <code>tableName</code> */ public static int getRegionCount(final Configuration c, final TableName tableName) throws IOException { try (Connection connection = ConnectionFactory.createConnection(c)) { return getRegionCount(connection, tableName); } }
/** * Sets the number of reduce tasks for the given job configuration to the * number of regions the given table has. * * @param table The table to get the region count for. * @param job The current job configuration to adjust. * @throws IOException When retrieving the table details fails. */ public static void setNumReduceTasks(String table, JobConf job) throws IOException { job.setNumReduceTasks(MetaTableAccessor.getRegionCount(HBaseConfiguration.create(job), TableName.valueOf(table))); }
/** * Sets the number of reduce tasks for the given job configuration to the * number of regions the given table has. * * @param table The table to get the region count for. * @param job The current job configuration to adjust. * @throws IOException When retrieving the table details fails. */ public static void setNumReduceTasks(String table, JobConf job) throws IOException { job.setNumReduceTasks(MetaTableAccessor.getRegionCount(HBaseConfiguration.create(job), TableName.valueOf(table))); }