You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/06/04 15:16:22 UTC

[GitHub] [hbase] wchevreuil commented on a change in pull request #1852: HBASE-24505 Reimplement Hbck.setRegionStateInMeta

wchevreuil commented on a change in pull request #1852:
URL: https://github.com/apache/hbase/pull/1852#discussion_r435336931



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
##########
@@ -2500,31 +2502,39 @@ public GetTableStateResponse setTableStateInMeta(RpcController controller,
    * @return previous states of the regions
    */
   @Override
-  public GetRegionStateInMetaResponse setRegionStateInMeta(RpcController controller,
+  public SetRegionStateInMetaResponse setRegionStateInMeta(RpcController controller,
     SetRegionStateInMetaRequest request) throws ServiceException {
-    final GetRegionStateInMetaResponse.Builder builder = GetRegionStateInMetaResponse.newBuilder();
-    for(ClusterStatusProtos.RegionState s : request.getStatesList()) {
-      try {
-        RegionInfo info = this.master.getAssignmentManager().
-          loadRegionFromMeta(s.getRegionInfo().getRegionEncodedName());
+    SetRegionStateInMetaResponse.Builder builder = SetRegionStateInMetaResponse.newBuilder();
+    try {
+      for (RegionSpecifierAndState s : request.getStatesList()) {
+        RegionSpecifier spec = s.getRegionSpecifier();
+        String encodedName;
+        if (spec.getType() == RegionSpecifierType.ENCODED_REGION_NAME) {
+          encodedName = spec.getValue().toStringUtf8();
+        } else {
+          // TODO: actually, a full region name can save a lot on meta scan, improve later.
+          encodedName = RegionInfo.encodeRegionName(spec.getValue().toByteArray());

Review comment:
       Agreed. If we have how to resolve a full region name from only the encoded name. The motivation to allow only region encoded name is because that's what's easily available for operators, and normally reported on hbck/hbck2. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org