Skip to content

HBASE-29074 Balancer conditionals should support meta table isolation - #6722

Merged
rmdmattingly merged 2 commits into
apache:masterfrom
HubSpot:rmattingly-HBASE-29074
Feb 27, 2025
Merged

HBASE-29074 Balancer conditionals should support meta table isolation#6722
rmdmattingly merged 2 commits into
apache:masterfrom
HubSpot:rmattingly-HBASE-29074

Conversation

@rmdmattingly

Copy link
Copy Markdown
Contributor

In HBASE-28513 we added support for balancer conditionals which will the balancer discrete rules to follow when generating plans. This PR adds support for meta table isolation that works in a more flexible, lightweight, and cost effective way compared to RegionServer groups.

In a subsequent PR I'll solve HBASE-29075 by extending this framework to support generic system table isolation as well. The triad of 28513, 29074, and 29075 will complete my team's initial vision for balancer conditionals, unlocking support for system table isolation, meta table isolation, and improved secondary replica distribution.

}

if (LOG.isDebugEnabled()) {
if (LOG.isTraceEnabled()) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These logs are really noisy in tests, and low value imo, so I've demoted them to trace

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +101 to 111
boolean isServerHostingIsolatedTables(BalancerClusterState cluster, int serverIdx) {
Set<TableIsolationConditional> tableIsolationConditionals =
conditionals.stream().filter(TableIsolationConditional.class::isInstance)
.map(TableIsolationConditional.class::cast).collect(Collectors.toSet());
for (TableIsolationConditional tableIsolationConditional : tableIsolationConditionals) {
if (tableIsolationConditional.isServerHostingIsolatedTables(cluster, serverIdx)) {
return true;
}
}
return false;
}

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helps us power sloppy server evaluation that's compatible with table isolation

* If enabled, this class will help the balancer ensure that the meta table lives on its own
* RegionServer. Configure this via {@link BalancerConditionals#ISOLATE_META_TABLE_KEY}
*/
class MetaTableIsolationConditional extends TableIsolationConditional {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation, and the MetaTableIsolationCandidateGenerator, are so lightweight because I anticipate adding a SystemTableIsolationConditional/CandidateGenerator soon

Comment on lines +67 to +71
BalanceAction batchMovesAndResetClusterState(BalancerClusterState cluster,
List<MoveRegionAction> moves) {
if (moves.isEmpty()) {
return BalanceAction.NULL_ACTION;
}

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning a null action is better here, because it signifies that there's no work to be done by the generator — whereas a batch, even an empty one, is easily misinterpreted as actionable work

Comment on lines +437 to +441
if (
!balancerConditionals.isTableIsolationEnabled() // table isolation is inherently incompatible
// with naive "sloppy server" checks
&& sloppyRegionServerExist(cs)
) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In reality, I still think we will fix "sloppy" servers more effectively than a non-conditional balancer implementation by way of the SlopFixingCandidateGenerator (which is table isolation compatible, and performs better than the cost function based approach in my testing)

return generateCandidate(cluster, false);
}

BalanceAction generateCandidate(BalancerClusterState cluster, boolean isWeighing) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is pretty straightforward in my opinion; if there's any head scratching complexity, then it's in this method. I'm happy to explore breaking up this method, which is admittedly probably too long, but doing so would probably introduce a much larger diff because we'd need more objects to represent the state that should be passed around across the goals of isolation + colocation

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@ndimidukndimiduk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just comments and questions. Really nice to see how these play out in test.

}

if (LOG.isDebugEnabled()) {
if (LOG.isTraceEnabled()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

boolean shouldSkipSloppyServerEvaluation() {
return isConditionalBalancingEnabled();
boolean isTableIsolationEnabled() {
return conditionalClasses.contains(MetaTableIsolationConditional.class);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This strategy of feature enablement by class presence is interesting. I wonder how we'll have to change this approach if we introduce user-provided implementations in the future. Just a thought.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I introduce SystemTableIsolation I anticipate making this an isAssignableFrom check much like isReplicaDistributionEnabled


@Override
boolean isRegionToIsolate(RegionInfo regionInfo) {
return regionInfo.isMetaRegion();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it kind of a code smell that both the CandidateGenerator and the Conditional implementation have repeated logic? As you land your additional implementations, I wonder if this will suggest a change to the interfaces.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably yes, let me think about reusability maybe. But I might chalk this up as a relatively small imperfection

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to leave this alone for now, I think it's a disappointing but small reality of the logical divide between conditionals and candidate generators. Will keep thinking on this as I introduce the system table isolation conditional though

private static void validateRegionLocationsWithRetry(Connection connection,
Set<TableName> tableNames, TableName productTableName, boolean areDistributed,
boolean runBalancerOnFailure) throws InterruptedException, IOException {
for (int i = 0; i < 100; i++) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use a Waiter instead?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same limitations apply that make me hesitant to use a waiter — I don't see how callbacks are supported to the degree that I need. Am I looking in the wrong place with Waiter#waitFor(...Predicate...)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, that's the waiter I mean.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

if (this == o) {
return true;
}
if (!(o instanceof ReplicaKey other)) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change adheres to our restrictions around new language features, please see #6729

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 29sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+0 🆗codespell0m 0scodespell was not available.
+0 🆗detsecrets0m 0sdetect-secrets was not available.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
_ master Compile Tests _
+0 🆗mvndep0m 11sMaven dependency ordering for branch
+1 💚mvninstall3m 2smaster passed
+1 💚compile3m 26smaster passed
-0 ⚠️checkstyle0m 9s/buildtool-branch-checkstyle-hbase-balancer.txtThe patch fails to run checkstyle in hbase-balancer
+1 💚spotbugs1m 56smaster passed
+1 💚spotless0m 45sbranch has no errors when running spotless:check.
_ Patch Compile Tests _
+0 🆗mvndep0m 11sMaven dependency ordering for patch
+1 💚mvninstall3m 2sthe patch passed
+1 💚compile3m 24sthe patch passed
-0 ⚠️javac0m 22s/results-compile-javac-hbase-balancer.txthbase-balancer generated 2 new + 58 unchanged - 0 fixed = 60 total (was 58)
+1 💚blanks0m 0sThe patch has no blanks issues.
-0 ⚠️checkstyle0m 9s/results-checkstyle-hbase-balancer.txthbase-balancer: The patch generated 2 new + 0 unchanged - 0 fixed = 2 total (was 0)
+1 💚spotbugs2m 6sthe patch passed
+1 💚hadoopcheck11m 42sPatch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚spotless0m 43spatch has no errors when running spotless:check.
_ Other Tests _
+1 💚asflicense0m 16sThe patch does not generate ASF License warnings.
40m 19s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6722/5/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#6722
Optional Testsdupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
unameLinux 104f92c2ba33 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / c1314d7
Default JavaEclipse Adoptium-17.0.11+9
Max. process+thread count84 (vs. ulimit of 30000)
modulesC: hbase-balancer hbase-server U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6722/5/console
versionsgit=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 26sDocker mode activated.
-0 ⚠️yetus0m 2sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗mvndep0m 10sMaven dependency ordering for branch
+1 💚mvninstall3m 13smaster passed
+1 💚compile1m 10smaster passed
+1 💚javadoc0m 39smaster passed
+1 💚shadedjars5m 55sbranch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+0 🆗mvndep0m 14sMaven dependency ordering for patch
+1 💚mvninstall3m 3sthe patch passed
+1 💚compile1m 12sthe patch passed
+1 💚javac1m 12sthe patch passed
+1 💚javadoc0m 41sthe patch passed
+1 💚shadedjars5m 55spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚unit6m 59shbase-balancer in the patch passed.
+1 💚unit214m 28shbase-server in the patch passed.
249m 10s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6722/5/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR#6722
Optional Testsjavac javadoc unit compile shadedjars
unameLinux 0928d25c0126 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / c1314d7
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6722/5/testReport/
Max. process+thread count5307 (vs. ulimit of 30000)
modulesC: hbase-balancer hbase-server U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6722/5/console
versionsgit=2.34.1 maven=3.9.8
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@rmdmattingly
rmdmattingly merged commit 189c513 into apache:masterFeb 27, 2025
@rmdmattingly
rmdmattingly deleted the rmattingly-HBASE-29074 branch February 27, 2025 22:12
rmdmattingly added a commit that referenced this pull request Feb 27, 2025
…#6722)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
rmdmattingly added a commit that referenced this pull request Feb 28, 2025
…#6722) (#6735)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
rmdmattingly added a commit that referenced this pull request Feb 28, 2025
…#6722)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
rmdmattingly added a commit that referenced this pull request Feb 28, 2025
…#6722)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
rmdmattingly added a commit that referenced this pull request Mar 4, 2025
…#6722)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
rmdmattingly added a commit that referenced this pull request Mar 5, 2025
…#6722)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
rmdmattingly added a commit that referenced this pull request Mar 6, 2025
…#6722) (#6737)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
rmdmattingly added a commit to HubSpot/hbase that referenced this pull request Mar 7, 2025
…apache#6722) (apache#6737)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
rmdmattingly added a commit to HubSpot/hbase that referenced this pull request Mar 7, 2025
…ta table isolation (apache#6722) (apache#6737) (will be in 2.7)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
charlesconnell pushed a commit to HubSpot/hbase that referenced this pull request Mar 7, 2025
…ta table isolation (apache#6722) (apache#6737) (will be in 2.7)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
charlesconnell pushed a commit to HubSpot/hbase that referenced this pull request Jun 25, 2025
…ta table isolation (apache#6722) (apache#6737) (will be in 2.7)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
charlesconnell pushed a commit to HubSpot/hbase that referenced this pull request Jul 1, 2025
…ta table isolation (apache#6722) (apache#6737) (will be in 2.7)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
mokai87 pushed a commit to mokai87/hbase that referenced this pull request Aug 7, 2025
…apache#6722) (apache#6737)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Ray Mattingly <rmattingly@hubspot.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@rmdmattingly@Apache-HBase@ndimiduk