Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions hbase-server/src/main/resources/hbase-webapps/master/table.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@
import="org.apache.hadoop.hbase.Size"
import="org.apache.hadoop.hbase.TableName"
import="org.apache.hadoop.hbase.TableNotFoundException"
import="org.apache.hadoop.hbase.client.Admin"
import="org.apache.hadoop.hbase.client.AsyncAdmin"
import="org.apache.hadoop.hbase.client.AsyncConnection"
import="org.apache.hadoop.hbase.client.ColumnFamilyDescriptor"
import="org.apache.hadoop.hbase.client.CompactionState"
import="org.apache.hadoop.hbase.client.Connection"
import="org.apache.hadoop.hbase.client.RegionInfo"
import="org.apache.hadoop.hbase.client.RegionInfoBuilder"
import="org.apache.hadoop.hbase.client.RegionLocator"
import="org.apache.hadoop.hbase.client.RegionReplicaUtil"
import="org.apache.hadoop.hbase.client.Table"
import="org.apache.hadoop.hbase.client.TableDescriptor"
import="org.apache.hadoop.hbase.client.TableDescriptorBuilder"
import="org.apache.hadoop.hbase.client.TableState"
import="org.apache.hadoop.hbase.client.ColumnFamilyDescriptor"
import="org.apache.hadoop.hbase.http.InfoServer"
Expand All @@ -77,6 +81,7 @@
<%@ page import="org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas" %>
<%@ page import="org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota" %>
<%@ page import="java.util.stream.Collectors" %>
<%@ page import="org.apache.hadoop.hbase.rsgroup.RSGroupAdminClient" %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On master branch please just use Admin instead of RSGroupAdminClient?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On master branch please just use Admin instead of RSGroupAdminClient?

I analyzed that only RSGroupAdminClient supports the moveTables method, and Admin does not support the moveTables method

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, on master, the RSGroup information is stored as a table property, you just need to modify the table's property, then the table will be moved to the new rs group.

<%!
/**
* @return An empty region load stamped with the passed in <code>regionInfo</code>
Expand Down Expand Up @@ -233,7 +238,7 @@
<% return;
} %>

<% // table split/major compact/compact/merge actions
<% // table split/major compact/compact/merge/move actions
if ( !readOnly && action != null ) { %>
<div class="container-fluid content">
<div class="row inner_header">
Expand Down Expand Up @@ -282,7 +287,19 @@
admin.mergeRegions(Bytes.toBytesBinary(left), Bytes.toBytesBinary(right), false);
}
%> Merge request accepted. <%
} %>
} else if (action.equals("move")) {
Connection connect = master.getConnection();
Admin newAdmin = connect.getAdmin();
TableName tableName = TableName.valueOf(fqtn);
TableDescriptor td = TableDescriptorBuilder.newBuilder(newAdmin.getDescriptor(tableName))
.setRegionServerGroup(key).build();
newAdmin.modifyTable(td);
RSGroupAdminClient rsGroupAdminClient = new RSGroupAdminClient(connect);
Set<TableName> tableNameSet = new HashSet<>();
tableNameSet.add(tableName);
rsGroupAdminClient.moveTables(tableNameSet,key);
%> Move Table group accepted. <%
}%>
<jsp:include page="redirect.jsp" />
</div>
<% return;
Expand Down Expand Up @@ -1235,6 +1252,18 @@ Actions:
</td>
</form>
</tr>
<tr>
<form method="get">
<input type="hidden" name="action" value="move">
<input type="hidden" name="name" value="<%= fqtn %>">
<td style="border-style: none; text-align: center">
<input style="font-size: 12pt; width: 10em" type="submit" value="Move" class="btn">
</td>
<td style="border-style: none" width="5%">&nbsp;</td>
<td style="border-style: none">Target Group:<input type="text" name="key" size="40"></td>
<td style="border-style: none">Move table to Target Group</td>
</form>
</tr>
</table>
</center>
</p>
Expand Down