HBASE-27309 Add major compact table or region operation on master web table page (#4793)

Co-authored-by: zhengsicheng <zhengsicheng@jd.com>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
SiCheng-Zheng 2022-10-04 23:10:25 +08:00 committed by GitHub
parent fa54381cb2
commit eb6b2745c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 1 deletions

View File

@ -233,7 +233,7 @@
<% return;
} %>
<% // table split/compact/merge actions
<% // table split/major compact/compact/merge actions
if ( !readOnly && action != null ) { %>
<div class="container-fluid content">
<div class="row inner_header">
@ -249,6 +249,20 @@
admin.split(TableName.valueOf(fqtn));
}
%> Split request accepted. <%
} else if (action.equals("major compact")) {
if (key != null && key.length() > 0) {
List<RegionInfo> regions = admin.getRegions(TableName.valueOf(fqtn)).get();
byte[] row = Bytes.toBytes(key);
for (RegionInfo region : regions) {
if (region.containsRow(row)) {
admin.majorCompactRegion(region.getRegionName());
}
}
} else {
admin.majorCompact(TableName.valueOf(fqtn));
}
%> major Compact request accepted. <%
} else if (action.equals("compact")) {
if (key != null && key.length() > 0) {
List<RegionInfo> regions = admin.getRegions(TableName.valueOf(fqtn)).get();
@ -1152,6 +1166,23 @@ Actions:
<p>
<center>
<table class="table" style="border: 0;" width="95%" >
<tr>
<form method="get">
<input type="hidden" name="action" value="major compact" />
<input type="hidden" name="name" value="<%= escaped_fqtn %>" />
<td class="centered">
<input style="font-size: 12pt; width: 10em" type="submit" value="Major Compact" class="btn" />
</td>
<td style="text-align: center;">
<input type="text" name="key" size="40" placeholder="Row Key (optional)" />
</td>
<td>
This action will force a major compaction of all regions of the table, or,
if a key is supplied, only the region major containing the
given key.
</td>
</form>
</tr>
<tr>
<form method="get">
<input type="hidden" name="action" value="compact" />