virajjasani commented on a change in pull request #3972:
URL: https://github.com/apache/hbase/pull/3972#discussion_r774894839



##########
File path: bin/region_mover.rb
##########
@@ -493,11 +493,22 @@ def getFilename(options, targetServer, port)
   return filename
 end
 
+def getServersRSGroup(rsgroup_admin, hostname, port)
+  rsgroup = rsgroup_admin.getRSGroupOfServer(Address.fromParts(hostname,
+                                             java.lang.Integer.parseInt(port)))
+  # If the rsgroup is nil, that means this server belongs to no rsgroup.
+  # It should be already offline.
+  # Here we directly log and exit.
+  return rsgroup unless rsgroup.nil?
+  $LOG.info('The server ' + hostname + 'belongs to no rsgroup. Exit regions 
moving.')
+  exit 0

Review comment:
       > It's okay to exit with 0 if the server has no rsgroup AND has no 
regions.
   
   > I don't know whether a call to `getOnlineRegions` would succeed.
   
   Hmm, I agree with first statement and that second statement would also be 
true.
   How about we check something like this?
   ```
   rsgroup = rsgroupAdmin.getRSGroupOfServer
   if rsgroup.nil?
     try
       regions = admin.getOnlineRegions(server)
     except
       LOG.warn(.....)
       exit 0
     if not regions.nil? and regions.size == 0:
       exit 0
     else
       LOG.warn('Server is not part of any RSGroup and still hosting some 
regions')
       exit 5
   ```
   




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to