Skip to content

Commit

Permalink
HBASE-28157. hbck should report previously reported regions with null…
Browse files Browse the repository at this point in the history
… region location (apache#5463)

Ensure that hbck will report as inconsistent regions where previously a
location was reported but now the region location is null, if it is not
expected to be offline.

Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
Reviewed-by: Shanmukha Haripriya Kota <skota@cloudera.com>
(cherry picked from commit 7c2ad32)
Change-Id: I94b2c0b31a34a6d660b45bf0568dd18d45911ef9
  • Loading branch information
apurtell committed Oct 31, 2023
1 parent 2a0517d commit 9e0eaaf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,7 @@ private void loadRegionsFromRSReport(final HbckReport report) {

for (Map.Entry<String, HbckRegionInfo> entry : report.getRegionInfoMap().entrySet()) {
HbckRegionInfo hri = entry.getValue();
ServerName locationInMeta = hri.getMetaEntry().getRegionServer();
if (locationInMeta == null) {
continue;
}
ServerName locationInMeta = hri.getMetaEntry().getRegionServer(); // can be null
if (hri.getDeployedOn().size() == 0) {
// skip the offline region which belong to disabled table.
if (report.getDisabledTableRegions().contains(hri.getRegionNameAsString())) {
Expand Down
4 changes: 4 additions & 0 deletions hbase-server/src/main/resources/hbase-webapps/master/hbck.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,13 @@
* If a live server reference, make it a link.
* If dead, make it italic.
* If unknown, make it plain.
* If null, make it "null".
*/
private static String formatServerName(HMaster master,
ServerManager serverManager, ServerName serverName) {
if (serverName == null) {
return "null";
}
String sn = serverName.toString();
if (serverManager.isServerOnline(serverName)) {
int infoPort = master.getRegionServerInfoPort(serverName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ public void testForUserTable() throws Exception {
hbckChore.choreForTesting();
inconsistentRegions = hbckChore.getLastReport().getInconsistentRegions();
assertFalse(inconsistentRegions.containsKey(regionName));

// Test for case4: No region location for a previously reported region. Probably due to
// TRSP bug or bypass.
am.offlineRegion(hri);
hbckChore.choreForTesting();
inconsistentRegions = hbckChore.getLastReport().getInconsistentRegions();
assertTrue(inconsistentRegions.containsKey(regionName));
}

@Test
Expand Down

0 comments on commit 9e0eaaf

Please sign in to comment.