HBASE-4927 Addendum fixes case where start key is empty and end key is empty

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1211632 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2011-12-07 21:05:59 +00:00
parent 888fad5f0d
commit bb7f82ac71
2 changed files with 16 additions and 4 deletions

View File

@ -777,8 +777,14 @@ implements WritableComparable<HRegionInfo> {
result = Bytes.compareTo(this.endKey, o.endKey);
if (result != 0) {
if (this.getEndKey().length == 0) return 1; // this is last region
if (o.getEndKey().length == 0) return -1; // o is the last region
if (this.getStartKey().length != 0
&& this.getEndKey().length == 0) {
return 1; // this is last region
}
if (o.getStartKey().length != 0
&& o.getEndKey().length == 0) {
return -1; // o is the last region
}
return result;
}
if (this.offLine == o.offLine)

View File

@ -158,8 +158,14 @@ class CatalogJanitor extends Chore {
// Compare end keys.
result = Bytes.compareTo(left.getEndKey(), right.getEndKey());
if (result != 0) {
if (left.getEndKey().length == 0) return -1; // left is last region
if (right.getEndKey().length == 0) return 1; // right is the last region
if (left.getStartKey().length != 0
&& left.getEndKey().length == 0) {
return -1; // left is last region
}
if (right.getStartKey().length != 0
&& right.getEndKey().length == 0) {
return 1; // right is the last region
}
return -result; // Flip the result so parent comes first.
}
return result;