HADOOP-2631 2443 breaks HTable.getStartKeys when there is more than one table

or table you are enumerating isn't the first table


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk/src/contrib/hbase@616505 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-01-29 20:06:19 +00:00
parent f0da1b58aa
commit de2e8d5028
3 changed files with 12 additions and 8 deletions

View File

@ -155,6 +155,8 @@ Trunk (unreleased changes)
HADOOP-2718 Copy Constructor HBaseConfiguration(Configuration) will override HADOOP-2718 Copy Constructor HBaseConfiguration(Configuration) will override
hbase configurations if argumant is not an instance of hbase configurations if argumant is not an instance of
HBaseConfiguration. HBaseConfiguration.
HADOOP-2631 2443 breaks HTable.getStartKeys when there is more than one
table or table you are enumerating isn't the first table
IMPROVEMENTS IMPROVEMENTS
HADOOP-2401 Add convenience put method that takes writable HADOOP-2401 Add convenience put method that takes writable

View File

@ -197,7 +197,8 @@ public class HTable implements HConstants {
Text startRow = new Text(tableName.toString() + ",,999999999999999"); Text startRow = new Text(tableName.toString() + ",,999999999999999");
HRegionLocation metaLocation = null; HRegionLocation metaLocation = null;
HRegionInterface server;
// scan over the each meta region // scan over the each meta region
do { do {
try{ try{
@ -206,13 +207,13 @@ public class HTable implements HConstants {
connection.locateRegion(META_TABLE_NAME, startRow); connection.locateRegion(META_TABLE_NAME, startRow);
// connect to the server hosting the .META. region // connect to the server hosting the .META. region
HRegionInterface server = server =
connection.getHRegionConnection(metaLocation.getServerAddress()); connection.getHRegionConnection(metaLocation.getServerAddress());
// open a scanner over the meta region // open a scanner over the meta region
scannerId = server.openScanner( scannerId = server.openScanner(
metaLocation.getRegionInfo().getRegionName(), metaLocation.getRegionInfo().getRegionName(),
COLUMN_FAMILY_ARRAY, EMPTY_START_ROW, LATEST_TIMESTAMP, COLUMN_FAMILY_ARRAY, tableName, LATEST_TIMESTAMP,
null); null);
// iterate through the scanner, accumulating unique table names // iterate through the scanner, accumulating unique table names
@ -233,19 +234,20 @@ public class HTable implements HConstants {
} }
if (info.isOffline()) { if (info.isOffline()) {
LOG.debug("Region " + info + " was offline!"); continue SCANNER_LOOP;
break;
} }
if (info.isSplit()) { if (info.isSplit()) {
LOG.debug("Region " + info + " was split!"); continue SCANNER_LOOP;
break;
} }
keyList.add(info.getStartKey()); keyList.add(info.getStartKey());
} }
} }
} }
// close that remote scanner
server.close(scannerId);
// advance the startRow to the end key of the current region // advance the startRow to the end key of the current region
startRow = metaLocation.getRegionInfo().getEndKey(); startRow = metaLocation.getRegionInfo().getEndKey();

View File

@ -311,7 +311,7 @@ public class MultiRegionTable extends HBaseTestCase {
* @param r * @param r
* @throws IOException * @throws IOException
*/ */
private static void compact(final MiniHBaseCluster cluster, protected static void compact(final MiniHBaseCluster cluster,
final HRegionInfo r) final HRegionInfo r)
throws IOException { throws IOException {
if (r == null) { if (r == null) {