[ 
https://issues.apache.org/jira/browse/HBASE-21987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16785190#comment-16785190
 ] 

Xiang Li commented on HBASE-21987:
----------------------------------

Hi [~xucang],thanks for your review and comments!
 Regarding
{quote}For the comment "servers of default group", maybe " servers in default 
group"
{quote}
Fixed and patch v002 is uploaded. Some lines are over 80 letters, due to the 
comments added, but I think it might be better to have the comment stay in the 
same line. Are you(or the rules) ok with it? And do I need to provide patches 
for other branches?

Regarding
{quote}Then " !oldGroupMap.equals(newGroupMap)" becomes redundant, correct?
{quote}
Yes, when it is in off-line mode, and newGroupMap(the input) is 
this.rsGroupMap, "!oldGroupMap.equals(newGroupMap)" becomes redundant, so is 
the the following logic in the context
 * Get default group info out of newGroupMap and oldGroupMap(a copy of 
rsGroupMap)
 * Compare
 ** Both tables and servers in other groups
 ** Only tables in default group
 * Put default group info back to newGroupMap
 * Refresh rsGroupMap with newGroupMap

When it is in off-line mode, but newGroupMap(the input) is not this.rsGroupMap, 
the logic above is still needed.

> Simplify RSGroupInfoManagerImpl#flushConfig() for offline mode
> --------------------------------------------------------------
>
>                 Key: HBASE-21987
>                 URL: https://issues.apache.org/jira/browse/HBASE-21987
>             Project: HBase
>          Issue Type: Improvement
>          Components: rsgroup
>            Reporter: Xiang Li
>            Assignee: Xiang Li
>            Priority: Minor
>         Attachments: HBASE-21987.master.000.patch, 
> HBASE-21987.master.001.patch
>
>
> The logic to handle offline mode in 
> RSGroupInfoManagerImpl#flushConfig(Map<String, RSGroupInfo> newGroupMap) 
> could be simplified.
> {code:title=RSGroupInfoManagerImpl.java # flushConfig(Map<String, 
> RSGroupInfo> newGroupMap)|borderStyle=solid}
> if (!isOnline()) {
>     Map<String, RSGroupInfo> m = Maps.newHashMap(rsGroupMap);
>     RSGroupInfo oldDefaultGroup = m.remove(RSGroupInfo.DEFAULT_GROUP);
>     RSGroupInfo newDefaultGroup = 
> newGroupMap.remove(RSGroupInfo.DEFAULT_GROUP);
>     if (!m.equals(newGroupMap) ||
>         !oldDefaultGroup.getTables().equals(newDefaultGroup.getTables())) {
>         throw new IOException("Only default servers can be updated during 
> offline mode");
>     }
>     newGroupMap.put(RSGroupInfo.DEFAULT_GROUP, newDefaultGroup);
>     rsGroupMap = newGroupMap;
>     return;
>  }
> {code}
> The logic is to make a copy of the private member called "rsGroupMap" as m, 
> and get the default group out of m and newGroupMap and then compare. Then 
> restore the newGroupMap and update rsGroupMap.
> This function is called by 
> {code:title=RSGroupInfoManagerImpl.java # flushConfig() |borderStyle=solid}
> private synchronized void flushConfig() throws IOException {
>     flushConfig(this.rsGroupMap);
> }
> {code}
> by RSGroupInfoManagerImpl.RSGroupStartupWorker#waitForGroupTableOnline() 
> during HMaster starts, in which, newGroupMap (the input of flushConfig()) is 
> this.rsGroupMap, the comparison is not needed, because they are the same.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to