Skip to content

Commit eb6b274

Browse files
SiCheng-Zhengzhengsicheng
andauthored
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>
1 parent fa54381 commit eb6b274

File tree

1 file changed

+32
-1
lines changed
  • hbase-server/src/main/resources/hbase-webapps/master

1 file changed

+32
-1
lines changed

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

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
<% return;
234234
} %>
235235

236-
<% // table split/compact/merge actions
236+
<% // table split/major compact/compact/merge actions
237237
if ( !readOnly && action != null ) { %>
238238
<div class="container-fluid content">
239239
<div class="row inner_header">
@@ -249,6 +249,20 @@
249249
admin.split(TableName.valueOf(fqtn));
250250
}
251251
%> Split request accepted. <%
252+
} else if (action.equals("major compact")) {
253+
if (key != null && key.length() > 0) {
254+
List<RegionInfo> regions = admin.getRegions(TableName.valueOf(fqtn)).get();
255+
byte[] row = Bytes.toBytes(key);
256+
257+
for (RegionInfo region : regions) {
258+
if (region.containsRow(row)) {
259+
admin.majorCompactRegion(region.getRegionName());
260+
}
261+
}
262+
} else {
263+
admin.majorCompact(TableName.valueOf(fqtn));
264+
}
265+
%> major Compact request accepted. <%
252266
} else if (action.equals("compact")) {
253267
if (key != null && key.length() > 0) {
254268
List<RegionInfo> regions = admin.getRegions(TableName.valueOf(fqtn)).get();
@@ -1152,6 +1166,23 @@ Actions:
11521166
<p>
11531167
<center>
11541168
<table class="table" style="border: 0;" width="95%" >
1169+
<tr>
1170+
<form method="get">
1171+
<input type="hidden" name="action" value="major compact" />
1172+
<input type="hidden" name="name" value="<%= escaped_fqtn %>" />
1173+
<td class="centered">
1174+
<input style="font-size: 12pt; width: 10em" type="submit" value="Major Compact" class="btn" />
1175+
</td>
1176+
<td style="text-align: center;">
1177+
<input type="text" name="key" size="40" placeholder="Row Key (optional)" />
1178+
</td>
1179+
<td>
1180+
This action will force a major compaction of all regions of the table, or,
1181+
if a key is supplied, only the region major containing the
1182+
given key.
1183+
</td>
1184+
</form>
1185+
</tr>
11551186
<tr>
11561187
<form method="get">
11571188
<input type="hidden" name="action" value="compact" />

0 commit comments

Comments
 (0)