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 (apache#4793)

Co-authored-by: zhengsicheng <[email protected]>
Signed-off-by: Duo Zhang <[email protected]>
(cherry picked from commit eb6b274)
  • Loading branch information
SiCheng-Zheng authored and PDavid committed Dec 13, 2024
1 parent b8829b9 commit 2de2804
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 @@ -232,7 +232,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 @@ -248,6 +248,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 @@ -1150,6 +1164,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 2de2804

Please sign in to comment.