-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HBASE-23949 refactor loadBalancer implements for rsgroup balance by t… #1279
Conversation
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
@@ -89,18 +89,18 @@ | |||
void setMasterServices(MasterServices masterServices); | |||
|
|||
/** | |||
* Perform the major balance operation | |||
* Perform the major balance operation for cluster | |||
* @return List of plans | |||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add javadoc for the parameter of balanceCluster and balanceTable?
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
} | ||
|
||
@Override | ||
public synchronized List<RegionPlan> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why synchronized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method of the extends class need be synchronized
} | ||
|
||
@Override | ||
public List<RegionPlan> balanceTable(TableName tableName, Map<ServerName, List<RegionInfo>> clusterLoad){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsupport? Should be abstrat method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes ,it should be abstrat method
@@ -106,6 +106,12 @@ void setNextRegionForUnload(int nextRegionForUnload) { | |||
|
|||
} | |||
|
|||
@Override | |||
public synchronized void setConf(Configuration conf) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I remove it
return balanceCluster(clusterState); | ||
public synchronized List<RegionPlan> balanceCluster(Map<TableName, Map<ServerName, | ||
List<RegionInfo>>> clusterLoadPerTable) { | ||
return super.balanceCluster(clusterLoadPerTable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If call super method directly, no need to add this method here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I remove it
@@ -427,4 +419,9 @@ public void postMasterStartupInitialize() { | |||
public void updateBalancerStatus(boolean status) { | |||
internalBalancer.updateBalancerStatus(status); | |||
} | |||
|
|||
@Override | |||
public List<RegionPlan> balanceTable(TableName tableName, Map<ServerName, List<RegionInfo>> clusterLoad){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not support here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes , it should support
@@ -87,7 +87,8 @@ public synchronized void initialize() throws HBaseIOException { | |||
} | |||
|
|||
@Override | |||
public List<RegionPlan> balanceCluster(Map<ServerName, List<RegionInfo>> clusterState) { | |||
public List<RegionPlan> | |||
balanceCluster(Map<TableName, Map<ServerName, List<RegionInfo>>> clusterLoadPerTable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The balancer should only need to override balanceTable method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes , but method 'balanceCluster' of this class not invoke 'balanceTable' , so just override balanceTable with null return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't get your point. Please add javadoc comment about why retrun null here.
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
return balanceCluster(clusterState); | ||
public synchronized List<RegionPlan> | ||
balanceCluster(Map<TableName, Map<ServerName, List<RegionInfo>>> clusterLoadPerTable) { | ||
setClusterLoad(clusterLoadPerTable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add reason for why need to setClusterLoad?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
}); | ||
return result; | ||
} else { | ||
LOG.debug("Start Generate Balance plan for table: " + HConstants.ENSEMBLE_TABLE_NAME); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no Table ENSEMBLE_TABLE_NAME actually, need to change this log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it convenient to debug ,balance for Table ENSEMBLE_TABLE_NAME , mean balanceByTable is false, we just consider all region as one table's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be good to log ""Start generate balance plan for cluster". No need log the ENSEMBLE_TABLE_NAME. And this log can be info?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you are right
if (isByTable) { | ||
List<RegionPlan> result = new ArrayList<>(); | ||
loadOfAllTable.forEach((tableName, loadOfOneTable) -> { | ||
LOG.debug("Start Generate Balance plan for table: " + tableName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOG.info("Start generate balance plan for table: {}", tableName);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok , I will change this
List<RegionPlan> groupPlans = this.internalBalancer | ||
.balanceCluster(groupClusterState); | ||
List<RegionPlan> groupPlans = null; | ||
if (!loadOfTablesInGroup.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add log here, too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well , I add some log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM.
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
…able to achieve overallbalanced
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
…able to achieve overallbalanced (apache#1279) Signed-off-by: Guanghao Zhang <zghao@apache.org>
…able to achieve overallbalanced (apache#1279) Signed-off-by: Guanghao Zhang <zghao@apache.org>
…able