[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrew Purtell updated HBASE-19917: --- Fix Version/s: (was: 1.5.0) > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > Fix For: 2.0.0-beta-2, 1.4.2, 2.0.0 > > Attachments: HBASE-19917.branch-1.000.patch, > HBASE-19917.master.000.patch, HBASE-19917.master.001.patch > > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m * n) (2 loops), could be in > O(m + n) if HashSet is used. The trade-off is space complexity is increased. > Another point which could be improved: filterServers() is only called in > filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). > The current filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrew Purtell updated HBASE-19917: --- Fix Version/s: 1.5.0 > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > Fix For: 1.5.0, 2.0.0-beta-2, 1.4.2 > > Attachments: HBASE-19917.branch-1.000.patch, > HBASE-19917.master.000.patch, HBASE-19917.master.001.patch > > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m * n) (2 loops), could be in > O(m + n) if HashSet is used. The trade-off is space complexity is increased. > Another point which could be improved: filterServers() is only called in > filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). > The current filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ted Yu updated HBASE-19917: --- Fix Version/s: 1.4.2 > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > Fix For: 2.0.0-beta-2, 1.4.2 > > Attachments: HBASE-19917.branch-1.000.patch, > HBASE-19917.master.000.patch, HBASE-19917.master.001.patch > > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m * n) (2 loops), could be in > O(m + n) if HashSet is used. The trade-off is space complexity is increased. > Another point which could be improved: filterServers() is only called in > filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). > The current filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiang Li updated HBASE-19917: - Attachment: HBASE-19917.branch-1.000.patch > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > Fix For: 2.0.0-beta-2 > > Attachments: HBASE-19917.branch-1.000.patch, > HBASE-19917.master.000.patch, HBASE-19917.master.001.patch > > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m * n) (2 loops), could be in > O(m + n) if HashSet is used. The trade-off is space complexity is increased. > Another point which could be improved: filterServers() is only called in > filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). > The current filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ted Yu updated HBASE-19917: --- Resolution: Fixed Hadoop Flags: Reviewed Fix Version/s: 2.0.0-beta-2 Status: Resolved (was: Patch Available) Pushed to branch-2 + after fixing long line warning. Thanks for the patch, Xiang. > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > Fix For: 2.0.0-beta-2 > > Attachments: HBASE-19917.master.000.patch, > HBASE-19917.master.001.patch > > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m * n) (2 loops), could be in > O(m + n) if HashSet is used. The trade-off is space complexity is increased. > Another point which could be improved: filterServers() is only called in > filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). > The current filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiang Li updated HBASE-19917: - Status: Patch Available (was: Open) > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > Attachments: HBASE-19917.master.000.patch, > HBASE-19917.master.001.patch > > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m * n) (2 loops), could be in > O(m + n) if HashSet is used. The trade-off is space complexity is increased. > Another point which could be improved: filterServers() is only called in > filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). > The current filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiang Li updated HBASE-19917: - Attachment: HBASE-19917.master.001.patch > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > Attachments: HBASE-19917.master.000.patch, > HBASE-19917.master.001.patch > > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m * n) (2 loops), could be in > O(m + n) if HashSet is used. The trade-off is space complexity is increased. > Another point which could be improved: filterServers() is only called in > filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). > The current filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiang Li updated HBASE-19917: - Status: Open (was: Patch Available) > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > Attachments: HBASE-19917.master.000.patch > > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m * n) (2 loops), could be in > O(m + n) if HashSet is used. The trade-off is space complexity is increased. > Another point which could be improved: filterServers() is only called in > filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). > The current filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiang Li updated HBASE-19917: - Status: Patch Available (was: Open) > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > Attachments: HBASE-19917.master.000.patch > > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m * n) (2 loops), could be in > O(m + n) if HashSet is used. The trade-off is space complexity is increased. > Another point which could be improved: filterServers() is only called in > filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). > The current filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiang Li updated HBASE-19917: - Attachment: HBASE-19917.master.000.patch > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > Attachments: HBASE-19917.master.000.patch > > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m * n) (2 loops), could be in > O(m + n) if HashSet is used. The trade-off is space complexity is increased. > Another point which could be improved: filterServers() is only called in > filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). > The current filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiang Li updated HBASE-19917: - Description: {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} private List filterServers(Collection servers, Collection onlineServers) { ArrayList finalList = new ArrayList(); for (Address server : servers) { for(ServerName curr: onlineServers) { if(curr.getAddress().equals(server)) { finalList.add(curr); } } } return finalList; } {code} filterServers is to return the union of servers and onlineServers. The current implementation has time complexity as O(m * n) (2 loops), could be in O(m + n) if HashSet is used. The trade-off is space complexity is increased. Another point which could be improved: filterServers() is only called in filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). The current filterServers(Collection, Collection) seems could be improved. was: {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} private List filterServers(Collection servers, Collection onlineServers) { ArrayList finalList = new ArrayList(); for (Address server : servers) { for(ServerName curr: onlineServers) { if(curr.getAddress().equals(server)) { finalList.add(curr); } } } return finalList; } {code} filterServers is to return the union of servers and onlineServers. The current implementation has time complexity as O(m*n) (2 loops), could be in O(m + n) if HashSet is used. The trade-off is space complexity is increased. Another point which could be improved: filterServers() is only called in filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). The current filterServers(Collection, Collection) seems could be improved. > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m * n) (2 loops), could be in > O(m + n) if HashSet is used. The trade-off is space complexity is increased. > Another point which could be improved: filterServers() is only called in > filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). > The current filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiang Li updated HBASE-19917: - Description: {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} private List filterServers(Collection servers, Collection onlineServers) { ArrayList finalList = new ArrayList(); for (Address server : servers) { for(ServerName curr: onlineServers) { if(curr.getAddress().equals(server)) { finalList.add(curr); } } } return finalList; } {code} filterServers is to return the union of servers and onlineServers. The current implementation has time complexity as O(m*n) (2 loops), could be in O(m + n) if HashSet is used. The trade-off is space complexity is increased. Another point which could be improved: filterServers() is only called in filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). The current filterServers(Collection, Collection) seems could be improved. was: {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} private List filterServers(Collection servers, Collection onlineServers) { ArrayList finalList = new ArrayList(); for (Address server : servers) { for(ServerName curr: onlineServers) { if(curr.getAddress().equals(server)) { finalList.add(curr); } } } return finalList; } {code} filterServers is to return the union of servers and onlineServers. The current implementation has time complexity as O(m*n) (2 loops), could be in O(m + n) if HashSet is used. Another point which could be improved: filterServers() is only called in filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). The current filterServers(Collection, Collection) seems could be improved. > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m*n) (2 loops), could be in > O(m + n) if HashSet is used. The trade-off is space complexity is increased. > Another point which could be improved: filterServers() is only called in > filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). > The current filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiang Li updated HBASE-19917: - Description: {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} private List filterServers(Collection servers, Collection onlineServers) { ArrayList finalList = new ArrayList(); for (Address server : servers) { for(ServerName curr: onlineServers) { if(curr.getAddress().equals(server)) { finalList.add(curr); } } } return finalList; } {code} filterServers is to return the union of servers and onlineServers. The current implementation has time complexity as O(m*n) (2 loops), could be in O(m + n) if HashSet is used. Another point which could be improved: filterServers() is only called in filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). The current filterServers(Collection, Collection) seems could be improved. was: {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} private List filterServers(Collection servers, Collection onlineServers) { ArrayList finalList = new ArrayList(); for (Address server : servers) { for(ServerName curr: onlineServers) { if(curr.getAddress().equals(server)) { finalList.add(curr); } } } return finalList; } {code} filterServers is to return the union of servers and onlineServers. The current implementation has time complexity as O(m*n) (2 loops), could be in O(m + n) if HashSet is used. One more, filterServers() is only called in filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). The current filterServers(Collection, Collection) seems could be improved. > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m*n) (2 loops), could be in > O(m + n) if HashSet is used. > Another point which could be improved: filterServers() is only called in > filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). > The current filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiang Li updated HBASE-19917: - Description: {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} private List filterServers(Collection servers, Collection onlineServers) { ArrayList finalList = new ArrayList(); for (Address server : servers) { for(ServerName curr: onlineServers) { if(curr.getAddress().equals(server)) { finalList.add(curr); } } } return finalList; } {code} filterServers is to return the union of servers and onlineServers. The current implementation has time complexity as O(m*n) (2 loops), could be in O(m + n) if HashSet is used. One more, filterServers() is only called in filterOfflineServers(). filterOfflineServers calls filterServers(Set, List). The current filterServers(Collection, Collection) seems could be improved. was: {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} private List filterServers(Collection servers, Collection onlineServers) { ArrayList finalList = new ArrayList(); for (Address server : servers) { for(ServerName curr: onlineServers) { if(curr.getAddress().equals(server)) { finalList.add(curr); } } } return finalList; } {code} > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} > filterServers is to return the union of servers and onlineServers. The > current implementation has time complexity as O(m*n) (2 loops), could be in > O(m + n) if HashSet is used. > One more, filterServers() is only called in filterOfflineServers(). > filterOfflineServers calls filterServers(Set, List). The current > filterServers(Collection, Collection) seems could be improved. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (HBASE-19917) Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient
[ https://issues.apache.org/jira/browse/HBASE-19917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiang Li updated HBASE-19917: - Description: {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} private List filterServers(Collection servers, Collection onlineServers) { ArrayList finalList = new ArrayList(); for (Address server : servers) { for(ServerName curr: onlineServers) { if(curr.getAddress().equals(server)) { finalList.add(curr); } } } return finalList; } {code} was: private List filterServers(Collection servers, Collection onlineServers) { ArrayList finalList = new ArrayList(); for (Address server : servers) { for(ServerName curr: onlineServers) { if(curr.getAddress().equals(server)) { finalList.add(curr); } } } return finalList; } > Improve RSGroupBasedLoadBalancer#filterServers() to be more efficient > - > > Key: HBASE-19917 > URL: https://issues.apache.org/jira/browse/HBASE-19917 > Project: HBase > Issue Type: Improvement > Components: rsgroup >Reporter: Xiang Li >Assignee: Xiang Li >Priority: Minor > > {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java|borderStyle=solid} > private List filterServers(Collection servers, > Collection onlineServers) { > ArrayList finalList = new ArrayList(); > for (Address server : servers) { > for(ServerName curr: onlineServers) { > if(curr.getAddress().equals(server)) { > finalList.add(curr); > } > } > } > return finalList; > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)