HBASE-2497 ProcessServerShutdown throws NullPointerException for offline regions

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@939123 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-04-28 22:45:47 +00:00
parent 369056d691
commit 9272667079
4 changed files with 9 additions and 10 deletions

View File

@ -20,6 +20,8 @@ Release 0.21.0 - Unreleased
HBASE-2392 Upgrade to ZooKeeper 3.3.0
HBASE-2294 Enumerate ACID properties of HBase in a well defined spec
(Todd Lipcon via Stack)
HBASE-2497 ProcessServerShutdown throws NullPointerException for offline
regions
BUG FIXES
HBASE-1791 Timeout in IndexRecordWriter (Bradford Stephens via Andrew

View File

@ -249,7 +249,7 @@ abstract class BaseScanner extends Chore implements HConstants {
* @param r
* @return Empty String or server address found in <code>r</code>
*/
private String getServerAddress(final Result r) {
static String getServerAddress(final Result r) {
byte [] val = r.getValue(CATALOG_FAMILY, SERVER_QUALIFIER);
return val == null || val.length <= 0? "": Bytes.toString(val);
}
@ -258,7 +258,7 @@ abstract class BaseScanner extends Chore implements HConstants {
* @param r
* @return Return 0L or server startcode found in <code>r</code>
*/
private long getStartCode(final Result r) {
static long getStartCode(final Result r) {
byte [] val = r.getValue(CATALOG_FAMILY, STARTCODE_QUALIFIER);
return val == null || val.length <= 0? 0L: Bytes.toLong(val);
}

View File

@ -140,10 +140,9 @@ class ProcessServerShutdown extends RegionServerOperation {
// shutdown server but that would mean that we'd reassign regions that
// were already out being assigned, ones that were product of a split
// that happened while the shutdown was being processed.
String serverAddress =
Bytes.toString(values.getValue(CATALOG_FAMILY, SERVER_QUALIFIER));
long startCode =
Bytes.toLong(values.getValue(CATALOG_FAMILY, STARTCODE_QUALIFIER));
String serverAddress = BaseScanner.getServerAddress(values);
long startCode = BaseScanner.getStartCode(values);
String serverName = null;
if (serverAddress != null && serverAddress.length() > 0) {
serverName = HServerInfo.getServerName(serverAddress, startCode);

View File

@ -101,12 +101,10 @@ abstract class TableOperation implements HConstants {
Bytes.toStringBinary(values.getRow()));
continue;
}
final String serverAddress =
Bytes.toString(values.getValue(CATALOG_FAMILY, SERVER_QUALIFIER));
final String serverAddress = BaseScanner.getServerAddress(values);
String serverName = null;
if (serverAddress != null && serverAddress.length() > 0) {
long startCode =
Bytes.toLong(values.getValue(CATALOG_FAMILY, STARTCODE_QUALIFIER));
long startCode = BaseScanner.getStartCode(values);
serverName = HServerInfo.getServerName(serverAddress, startCode);
}
if (Bytes.compareTo(info.getTableDesc().getName(), tableName) > 0) {