Skip to content

Commit adb4425

Browse files
saintstackclarax
authored andcommitted
HBASE-24425 Run hbck_chore_run and catalogjanitor_run on draw of 'HBCK Report' page (apache#1771)
Signed-off-by: clarax Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: Jan Hentschel <jan.hentschel@ultratendency.com> Signed-off-by: Huaxiang Sun <huaxiangsun@apache.com>
1 parent 7f6051f commit adb4425

File tree

1 file changed

+28
-5
lines changed
  • hbase-server/src/main/resources/hbase-webapps/master

1 file changed

+28
-5
lines changed

hbase-server/src/main/resources/hbase-webapps/master/hbck.jsp

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,22 @@
3838
<%@ page import="org.apache.hadoop.hbase.master.CatalogJanitor" %>
3939
<%@ page import="org.apache.hadoop.hbase.master.CatalogJanitor.Report" %>
4040
<%
41+
final String cacheParameterValue = request.getParameter("cache");
4142
final HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER);
4243
pageContext.setAttribute("pageTitle", "HBase Master HBCK Report: " + master.getServerName());
44+
if (!Boolean.parseBoolean(cacheParameterValue)) {
45+
// Run the two reporters inline w/ drawing of the page. If exception, will show in page draw.
46+
try {
47+
master.getMasterRpcServices().runHbckChore(null, null);
48+
} catch (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException se) {
49+
out.write("Failed generating a new hbck_chore report; using cache; try again or run hbck_chore_run in the shell: " + se.getMessage() + "\n");
50+
}
51+
try {
52+
master.getMasterRpcServices().runCatalogScan(null, null);
53+
} catch (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException se) {
54+
out.write("Failed generating a new catalogjanitor report; using cache; try again or run catalogjanitor_run in the shell: " + se.getMessage() + "\n");
55+
}
56+
}
4357
HbckChore hbckChore = master.getHbckChore();
4458
Map<String, Pair<ServerName, List<ServerName>>> inconsistentRegions = null;
4559
Map<String, ServerName> orphanRegionsOnRS = null;
@@ -79,7 +93,16 @@
7993

8094
<div class="row">
8195
<div class="page-header">
82-
<p><span>This page displays two reports: the <em>HBCK Chore Report</em> and the <em>CatalogJanitor Consistency Issues</em> report. Only report titles show if there are no problems to list. Note some conditions are <strong>transitory</strong> as regions migrate. See below for how to run reports. ServerNames will be links if server is live, italic if dead, and plain if unknown.</span></p>
96+
<p><span>This page displays two reports: the <em>HBCK Chore Report</em> and
97+
the <em>CatalogJanitor Consistency Issues</em> report. Only report titles
98+
show if there are no problems to list. Note some conditions are
99+
<strong>transitory</strong> as regions migrate. Reports are generated
100+
when you invoke this page unless you add <em>?cache=true</em> to the URL. Then
101+
we display the reports cached from the last time the reports were run.
102+
Reports are run by Chores that are hosted by the Master on a cadence.
103+
You can also run them on demand from the hbase shell: invoke <em>catalogjanitor_run</em>
104+
and/or <em>hbck_chore_run</em>.
105+
ServerNames will be links if server is live, italic if dead, and plain if unknown.</span></p>
83106
</div>
84107
</div>
85108
<div class="row">
@@ -89,11 +112,11 @@
89112
<% if (hbckChore.isDisabled()) { %>
90113
<span>HBCK chore is currently disabled. Set hbase.master.hbck.chore.interval > 0 in the config & do a rolling-restart to enable it.</span>
91114
<% } else if (startTimestamp == 0 && endTimestamp == 0){ %>
92-
<span>No report created. Execute <i>hbck_chore_run</i> in hbase shell to generate a new sub-report.</span>
115+
<span>No report created.</span>
93116
<% } else if (startTimestamp > 0 && endTimestamp == 0){ %>
94117
<span>Checking started at <%= iso8601start %>. Please wait for checking to generate a new sub-report.</span>
95118
<% } else { %>
96-
<span>Checking started at <%= iso8601start %> and generated report at <%= iso8601end %>. Execute <i>hbck_chore_run</i> in hbase shell to generate a new sub-report.</span>
119+
<span>Checking started at <%= iso8601start %> and generated report at <%= iso8601end %>.</span>
97120
<% } %>
98121
</p>
99122
</div>
@@ -204,9 +227,9 @@
204227
<h1>CatalogJanitor <em>hbase:meta</em> Consistency Issues</h1>
205228
<p>
206229
<% if (report != null) { %>
207-
<span>Report created: <%= iso8601reportTime %> (now=<%= iso8601Now %>). Run <i>catalogjanitor_run</i> in hbase shell to generate a new sub-report.</span></p>
230+
<span>Report created: <%= iso8601reportTime %> (now=<%= iso8601Now %>).</span></p>
208231
<% } else { %>
209-
<span>No report created. Run <i>catalogjanitor_run</i> in hbase shell to generate a new sub-report.</span>
232+
<span>No report created.</span>
210233
<% } %>
211234
</div>
212235
</div>

0 commit comments

Comments
 (0)