Skip to content

Commit

Permalink
HBASE-27309 Add major compact table or region operation on master web…
Browse files Browse the repository at this point in the history
… table page (#4793)

Co-authored-by: zhengsicheng <zhengsicheng@jd.com>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
  • Loading branch information
SiCheng-Zheng and zhengsicheng committed Oct 4, 2022
1 parent fa54381 commit eb6b274
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion hbase-server/src/main/resources/hbase-webapps/master/table.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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();
Expand Down Expand Up @@ -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" />
Expand Down

0 comments on commit eb6b274

Please sign in to comment.