-
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-23944 The method setClusterLoad of SimpleLoadBalancer is incorr… #1243
Conversation
@@ -402,13 +402,13 @@ protected void updateLoad(final Map<ServerName, ServerAndLoad> map, | |||
return servers; | |||
} | |||
|
|||
protected HashMap<TableName, TreeMap<ServerName, List<RegionInfo>>> mockClusterServersWithTables(Map<ServerName, List<RegionInfo>> clusterServers) { | |||
HashMap<TableName, TreeMap<ServerName, List<RegionInfo>>> result = new HashMap<>(); | |||
protected Map<TableName, Map<ServerName, List<RegionInfo>>> mockClusterServersWithTables(Map<ServerName, List<RegionInfo>> clusterServers) { |
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 change TreeMap to Map?
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.
use the return value of method mockClusterServersWithTables as clusterLoad
the extend feature of treeMap is no use , Map is enough
Map<TableName, Map<ServerName, List<RegionInfo>>> clusterLoad = new TreeMap<>(); | ||
Map<ServerName, List<RegionInfo>> clusterServers = mockUniformClusterServers(mockUniformCluster); | ||
List<ServerAndLoad> clusterList = convertToList(clusterServers); | ||
clusterLoad.put(TableName.valueOf(name.getMethodName()), clusterServers); | ||
// use overall can achieve both table and cluster level balance | ||
HashMap<TableName, TreeMap<ServerName, List<RegionInfo>>> result1 = mockClusterServersWithTables(clusterServers); | ||
loadBalancer.setClusterLoad(clusterLoad); | ||
Map<TableName, Map<ServerName, List<RegionInfo>>> result1 = mockClusterServersWithTables(clusterServers); |
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 difference of results1 and clusterLoad is?
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.
clusterLoad's value is map (server to all region on it , whatever region's table), clusterLoad's key is no use
results1's value is map(server to region ,the region only belong to the key table), results1's key is actual tableName
in balance by table, we should use results1
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
…ect when balance by table
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
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.
+1
…ect when balance by table (#1243) Signed-off-by: Guanghao Zhang <zghao@apache.org>
…ect when balance by table (#1243) Signed-off-by: Guanghao Zhang <zghao@apache.org>
…ect when balance by table (#1243) Signed-off-by: Guanghao Zhang <zghao@apache.org>
…ect when balance by table (apache#1243) Signed-off-by: Guanghao Zhang <zghao@apache.org>
…ect when balance by table (apache#1243) Signed-off-by: Guanghao Zhang <zghao@apache.org>
…ect when balance by table (apache#1243) Signed-off-by: Guanghao Zhang <zghao@apache.org>
…ect when balance by table (apache#1243) Signed-off-by: Guanghao Zhang <zghao@apache.org> (cherry picked from commit 6587a95) Change-Id: Icb9adfb5af4613e40c806fc8c07ab9fa78c7f5f1
…ect when balance by table