hingu-8103 commented on code in PR #8936:
URL: https://github.com/apache/hbase/pull/8936#discussion_r4707620977
##########
hbase-server/src/main/resources/hbase-webapps/master/hbck.jsp:
##########
@@ -39,27 +39,37 @@
<%@ page import="org.apache.hadoop.hbase.master.janitor.CatalogJanitorReport"
%>
<%@ page import="java.util.Optional" %>
<%@ page import="org.apache.hadoop.hbase.util.EnvironmentEdgeManager" %>
-<%@ page
import="org.apache.hbase.thirdparty.com.google.protobuf.ServiceException" %>
+<%@ page import="java.io.IOException" %>
+<%@ page import="org.apache.hadoop.hbase.http.InfoServer" %>
<%
final String cacheParameterValue = request.getParameter("cache");
final HMaster master = (HMaster)
getServletContext().getAttribute(HMaster.MASTER);
pageContext.setAttribute("pageTitle", "HBase Master HBCK Report: " +
master.getServerName());
- String hbckChoreErrorMessage = null;
+ final boolean canModifyUI =
+ InfoServer.canUserModifyUI(request, getServletContext(),
master.getConfiguration());
String catalogJanitorErrorMessage = null;
- if (!Boolean.parseBoolean(cacheParameterValue)) {
- // Run the two reporters inline w/ drawing of the page. If exception, will
show in page draw.
- try {
- master.getMasterRpcServices().runHbckChore(null, null);
- } catch (ServiceException se) {
- hbckChoreErrorMessage = "Failed generating a new hbck_chore report;
using cache; try again or run hbck_chore_run in the shell: " + se.getMessage();
- }
- try {
- master.getMasterRpcServices().runCatalogScan(null, null);
- } catch (ServiceException se) {
- catalogJanitorErrorMessage = "Failed generating a new catalogjanitor
report; using cache; try again or run catalogjanitor_run in the shell: " +
se.getMessage();
- }
+ String triggerSkippedMessage = null;
+ final HbckChore hbckChore = master.getHbckChore();
+ final CatalogJanitor cj = master.getCatalogJanitor();
+ if (!Boolean.parseBoolean(cacheParameterValue) && master.isInitialized()) {
+ if (!canModifyUI) {
+ triggerSkippedMessage = "This master UI is read-only or you are not
authorized to modify it; "
+ + "showing cached reports. Run hbck_chore_run and catalogjanitor_run
from the HBase shell "
+ + "as an authorized user to generate new reports.";
+ } else {
+ // Run the two reporters inline w/ drawing of the page. If exception,
will show in page draw.
+ if (hbckChore != null) {
+ hbckChore.runChore();
+ }
+ if (cj != null) {
+ try {
+ cj.scan();
Review Comment:
The gate is the web UI admin list
(`hbase.security.authentication.spnego.admin.users/.groups`), which is separate
from HBase's global ADMIN (`hbase:acl` grants, superusers). `cj.scan()`
garbage-collects merged and split parents, and HBASE-19400 added the ADMIN
check on `runCatalogScan`. With this change a UI admin who has no HBase ADMIN
can trigger it from a plain GET. Is that intended?
If not, could we also call
`master.getAccessChecker().requirePermission(webUser, ..., ADMIN)` and show the
info message on `AccessDeniedException`? A test with a UI admin who lacks HBase
ADMIN would document either choice.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]