-
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-25836 RegionStates#getAssignmentsForBalancer should only care about OPEN or OPENING regions #3219
Conversation
Tested in an integration cluster test scenario (see #3208) but let's see what the unit test results in the CR report looks like. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java
Show resolved
Hide resolved
// to be online at that server until possibly the next balancer iteration or unless | ||
// we decide to move it. Other states are not interesting as the region will either | ||
// be closing, or splitting/merging, or will not be deployed. | ||
if (!(node.isInState(State.OPEN)||node.isInState(State.OPENING))) { |
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.
nit: spaces missing on either side of ||
or can be simplified to !node.isInState(State.OPEN, State.OPENING)
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.
Except for existing comments, changes look good
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java
Show resolved
Hide resolved
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java
Show resolved
Hide resolved
Updated after feedback |
Update the new comment in RegionStates to be more clear. |
Whitespace fix. |
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.
Left one nit reg log placeholder, else good to go
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java
Outdated
Show resolved
Hide resolved
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java
Outdated
Show resolved
Hide resolved
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java
Outdated
Show resolved
Hide resolved
…bout OPEN or OPENING regions RegionStates#getAssignmentsForBalancer is used by the HMaster to collect all regions of interest to the balancer for the next chore iteration. We check if a table is in disabled state to exclude regions that will not be of interest (because disabled regions are or will be offline) or are in a state where they shouldn't be mutated (like SPLITTING). The current checks are not actually comprehensive. Filter out regions not in OPEN or OPENING state when building the set of interesting regions for the balancer to consider. Only regions open (or opening) on the cluster are of interest to balancing calculations for the current iteration. Regions in all other states can be expected to not be of interest – either offline (OFFLINE, or FAILED_*), not subject to balancer decisions now (SPLITTING, SPLITTING_NEW, MERGING, MERGING_NEW), or will be offline shortly (CLOSING) – until at least the next chore iteration. Add TRACE level logging.
Address @virajjasani 's comment |
// decides to move it. Regions in other states are not eligible for balancing, because | ||
// they are closing, splitting, merging, or otherwise already in transition. | ||
if (!node.isInState(State.OPEN, State.OPENING)) { | ||
if (LOG.isTraceEnabled()) { |
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.
Doing both isTraceEnabled() check and parameterized logging seems wasteful, its usually either one or the other.. I think the recommendation from log4j is to do the latter for concise code and avoid unnecessary temporary string objects...
🎊 +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. |
…bout OPEN or OPENING regions (#3219) RegionStates#getAssignmentsForBalancer is used by the HMaster to collect all regions of interest to the balancer for the next chore iteration. We check if a table is in disabled state to exclude regions that will not be of interest (because disabled regions are or will be offline) or are in a state where they shouldn't be mutated (like SPLITTING). The current checks are not actually comprehensive. Filter out regions not in OPEN or OPENING state when building the set of interesting regions for the balancer to consider. Only regions open (or opening) on the cluster are of interest to balancing calculations for the current iteration. Regions in all other states can be expected to not be of interest – either offline (OFFLINE, or FAILED_*), not subject to balancer decisions now (SPLITTING, SPLITTING_NEW, MERGING, MERGING_NEW), or will be offline shortly (CLOSING) – until at least the next chore iteration. Add TRACE level logging. Signed-off-by: Bharath Vissapragada <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Viraj Jasani <[email protected]>
…bout OPEN or OPENING regions (#3219) RegionStates#getAssignmentsForBalancer is used by the HMaster to collect all regions of interest to the balancer for the next chore iteration. We check if a table is in disabled state to exclude regions that will not be of interest (because disabled regions are or will be offline) or are in a state where they shouldn't be mutated (like SPLITTING). The current checks are not actually comprehensive. Filter out regions not in OPEN or OPENING state when building the set of interesting regions for the balancer to consider. Only regions open (or opening) on the cluster are of interest to balancing calculations for the current iteration. Regions in all other states can be expected to not be of interest – either offline (OFFLINE, or FAILED_*), not subject to balancer decisions now (SPLITTING, SPLITTING_NEW, MERGING, MERGING_NEW), or will be offline shortly (CLOSING) – until at least the next chore iteration. Add TRACE level logging. Signed-off-by: Bharath Vissapragada <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Viraj Jasani <[email protected]>
RegionStates#getAssignmentsForBalancer is used by the HMaster to collect all regions of interest to the balancer for the next chore iteration. We check if a table is in disabled state to exclude regions that will not be of interest (because disabled regions are or will be offline) or are in a state where they shouldn't be mutated (like SPLITTING).
The current checks are not actually comprehensive. For example, splitting states are considered, but not merging.
Filter out regions not in OPEN or OPENING state when building the set of interesting regions for the balancer to consider. Only regions open (or opening) on the cluster are of interest to balancing calculations for the current iteration. Regions in all other states can be expected to not be of interest – either offline (OFFLINE, or FAILED_*), not subject to balancer decisions now (SPLITTING, SPLITTING_NEW, MERGING, MERGING_NEW), or will be offline shortly (CLOSING) – until at least the next chore iteration.