Skip to content

Commit 0b0ac60

Browse files
SiCheng-Zhengzhengsicheng
authored andcommitted
HBASE-27309 Add major compact table or region operation on master web table page (apache#4793)
Co-authored-by: zhengsicheng <zhengsicheng@jd.com> Signed-off-by: Duo Zhang <zhangduo@apache.org> (cherry picked from commit eb6b274)
1 parent b8d5f98 commit 0b0ac60

1 file changed

Lines changed: 95 additions & 64 deletions

File tree

  • hbase-server/src/main/resources/hbase-webapps/master

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

Lines changed: 95 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
<% return;
233233
} %>
234234

235-
<% // table split/compact/merge actions
235+
<% // table split/major compact/compact/merge actions
236236
if ( !readOnly && action != null ) { %>
237237
<div class="container-fluid content">
238238
<div class="row inner_header">
@@ -248,6 +248,20 @@
248248
admin.split(TableName.valueOf(fqtn));
249249
}
250250
%> Split request accepted. <%
251+
} else if (action.equals("major compact")) {
252+
if (key != null && key.length() > 0) {
253+
List<RegionInfo> regions = admin.getRegions(TableName.valueOf(fqtn)).get();
254+
byte[] row = Bytes.toBytes(key);
255+
256+
for (RegionInfo region : regions) {
257+
if (region.containsRow(row)) {
258+
admin.majorCompactRegion(region.getRegionName());
259+
}
260+
}
261+
} else {
262+
admin.majorCompact(TableName.valueOf(fqtn));
263+
}
264+
%> major Compact request accepted. <%
251265
} else if (action.equals("compact")) {
252266
if (key != null && key.length() > 0) {
253267
List<RegionInfo> regions = admin.getRegions(TableName.valueOf(fqtn)).get();
@@ -1146,69 +1160,86 @@
11461160
</tr>
11471161
</table>
11481162

1149-
<% if (!readOnly) { %>
1150-
<p><hr/></p>
1151-
Actions:
1152-
<p>
1153-
<center>
1154-
<table class="table" style="border: 0;" width="95%" >
1155-
<tr>
1156-
<form method="get">
1157-
<input type="hidden" name="action" value="compact" />
1158-
<input type="hidden" name="name" value="<%= escaped_fqtn %>" />
1159-
<td class="centered">
1160-
<input style="font-size: 12pt; width: 10em" type="submit" value="Compact" class="btn" />
1161-
</td>
1162-
<td style="text-align: center;">
1163-
<input type="text" name="key" size="40" placeholder="Row Key (optional)" />
1164-
</td>
1165-
<td>
1166-
This action will force a compaction of all regions of the table, or,
1167-
if a key is supplied, only the region containing the
1168-
given key.
1169-
</td>
1170-
</form>
1171-
</tr>
1172-
<tr>
1173-
<form method="get">
1174-
<input type="hidden" name="action" value="split" />
1175-
<input type="hidden" name="name" value="<%= escaped_fqtn %>" />
1176-
<td class="centered">
1177-
<input style="font-size: 12pt; width: 10em" type="submit" value="Split" class="btn" />
1178-
</td>
1179-
<td style="text-align: center;">
1180-
<input type="text" name="key" size="40" placeholder="Row Key (optional)" />
1181-
</td>
1182-
<td>
1183-
This action will force a split of all eligible
1184-
regions of the table, or, if a key is supplied, only the region containing the
1185-
given key. An eligible region is one that does not contain any references to
1186-
other regions. Split requests for noneligible regions will be ignored.
1187-
</td>
1188-
</form>
1189-
</tr>
1190-
<tr>
1191-
<form method="get">
1192-
<input type="hidden" name="action" value="merge" />
1193-
<input type="hidden" name="name" value="<%= escaped_fqtn %>" />
1194-
<td class="centered">
1195-
<input style="font-size: 12pt; width: 10em" type="submit" value="Merge" class="btn" />
1196-
</td>
1197-
<td style="text-align: center;">
1198-
<input type="text" name="left" size="40" placeholder="Region Key (required)" />
1199-
<input type="text" name="right" size="40" placeholder="Region Key (required)" />
1200-
</td>
1201-
<td>
1202-
This action will merge two regions of the table, Merge requests for
1203-
noneligible regions will be ignored.
1204-
</td>
1205-
</form>
1206-
</tr>
1207-
</table>
1208-
</center>
1209-
</p>
1210-
<% } %>
1211-
</div>
1163+
<% if (!readOnly) { %>
1164+
<p><hr/></p>
1165+
Actions:
1166+
<p>
1167+
<center>
1168+
<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>
1186+
<tr>
1187+
<form method="get">
1188+
<input type="hidden" name="action" value="compact" />
1189+
<input type="hidden" name="name" value="<%= escaped_fqtn %>" />
1190+
<td class="centered">
1191+
<input style="font-size: 12pt; width: 10em" type="submit" value="Compact" class="btn" />
1192+
</td>
1193+
<td style="text-align: center;">
1194+
<input type="text" name="key" size="40" placeholder="Row Key (optional)" />
1195+
</td>
1196+
<td>
1197+
This action will force a compaction of all regions of the table, or,
1198+
if a key is supplied, only the region containing the
1199+
given key.
1200+
</td>
1201+
</form>
1202+
</tr>
1203+
<tr>
1204+
<form method="get">
1205+
<input type="hidden" name="action" value="split" />
1206+
<input type="hidden" name="name" value="<%= escaped_fqtn %>" />
1207+
<td class="centered">
1208+
<input style="font-size: 12pt; width: 10em" type="submit" value="Split" class="btn" />
1209+
</td>
1210+
<td style="text-align: center;">
1211+
<input type="text" name="key" size="40" placeholder="Row Key (optional)" />
1212+
</td>
1213+
<td>
1214+
This action will force a split of all eligible
1215+
regions of the table, or, if a key is supplied, only the region containing the
1216+
given key. An eligible region is one that does not contain any references to
1217+
other regions. Split requests for noneligible regions will be ignored.
1218+
</td>
1219+
</form>
1220+
</tr>
1221+
<tr>
1222+
<form method="get">
1223+
<input type="hidden" name="action" value="merge" />
1224+
<input type="hidden" name="name" value="<%= escaped_fqtn %>" />
1225+
<td class="centered">
1226+
<input style="font-size: 12pt; width: 10em" type="submit" value="Merge" class="btn" />
1227+
</td>
1228+
<td style="text-align: center;">
1229+
<input type="text" name="left" size="40" placeholder="Region Key (required)" />
1230+
<input type="text" name="right" size="40" placeholder="Region Key (required)" />
1231+
</td>
1232+
<td>
1233+
This action will merge two regions of the table, Merge requests for
1234+
noneligible regions will be ignored.
1235+
</td>
1236+
</form>
1237+
</tr>
1238+
</table>
1239+
</center>
1240+
</p>
1241+
<% } %>
1242+
</div>
12121243
</div>
12131244

12141245
<jsp:include page="footer.jsp" />

0 commit comments

Comments
 (0)