Skip to content

HBASE-28346: Expose checkQuota to Coprocessor Endpoints - #6066

Merged
ndimiduk merged 6 commits into
apache:masterfrom
HubSpot:coprocessor-env-quota
Aug 6, 2024
Merged

HBASE-28346: Expose checkQuota to Coprocessor Endpoints#6066
ndimiduk merged 6 commits into
apache:masterfrom
HubSpot:coprocessor-env-quota

Conversation

@charlesconnell

Copy link
Copy Markdown
Contributor

This new wiring will not have any users in this PR. I want to use this in AggregateImplemention or something like it, but I will put that in a separate ticket because it might be a big change.

@rmdmattinglyrmdmattingly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It might be nice to create a basic minicluster test that implements a coproc using this framework and runs into quotas as expected

Comment on lines +146 to +147
OperationQuota checkScanQuota(Scan scan, long maxBlockBytesScanned,
long prevBlockBytesScannedDifference) throws IOException, RpcThrottlingException;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We'll probably want to add support for checking batch quotas as well. I guess maybe that can be done trivially via the RpcQuotaManager, but could be nice for API consistency maybe?

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.

Done

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@charlesconnell

Copy link
Copy Markdown
ContributorAuthor

Added a new test

@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.

@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.

Looks alright by me. I just have the open question about exposing our shaded-protobufs to coprocessor users.

import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;

import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos;

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.

Just to check, which protobufs are we exposing to Coprocessor implementations, is it the shaded or unshaded module? Do we have an ErrorProne check that we always do the right thing?

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.

Or -- do we ever? Browsing through the other coprocessor interfaces and base classes, I don't see any protobufs used. Instead, it's all pure Java POJOs.

Should this be org.apache.hadoop.hbase.client.Action and that class exposed to IA.LimitedPrivate ?

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.

Ah, but this Quota stuff is all up in the RegionServer's business, where shaded protobufs are indeed used directly.

I think the question stands, of whether we want to expose the shaded protobufs to our coprocessor APIs, or if we need to keep this as a "pure" interface.

@apurtell@Apache9@busbey where do you stand on this question?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

According to the ref guide:

In HBase 3.0.0, the hbase-protocol module has been purged, the CPEP implementation should use the protos in hbase-protocol-shaded module, and also make use of the shaded protobuf in hbase-thirdparty.

I also think I remember Andrew saying that our protos are LimitedPrivate (but cant find that in the refguid). If you look at MultiRowMutationEndpoint in branch-3, it has access to org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos

So it seems like it should be ok to expose it in master/branch-3. I think in branch-2 it might be more tricky. MultiRowMutationEndpoint only has access to unshaded protobuf there, so it wouldn't translate into the server internals which use shaded.

One option here would be to not expose checkBatchQuota with ClientProtos.Action as an argument. The implementation of that method on the server side actually just iterates the batch to count the reads and writes, then calls a different checkBatchQuota that takes those two ints. We could expose something like checkBatchQuota(region, int reads, int writes).

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.

I'm okay with this approach, assuming that we expect downstream implementations to be okay with the lower fidelity summary of the actions list.

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've made that change.

this.services = services;
this.metricRegistry =
MetricsCoprocessor.createRegistryForRegionCoprocessor(impl.getClass().getName());
// lets unit tests through

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.

What does this comment mean?

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.

made this more clear

}

public static class MyCoprocessor implements RegionCoprocessor {
private RegionCoprocessorEnvironment env;

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.

unsed?

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.

indeed


@AfterClass
public static void tearDown() throws Exception {
CONN.close();

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.

docstring on HBaseTestingUtil#getConnection() says,

 /**
* Get a shared Connection to the cluster. this method is thread safe.
* @return A Connection that can be shared. Don't close. Will be closed on shutdown of cluster.
*/

@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 48sDocker 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 _
+1 💚mvninstall4m 4smaster passed
+1 💚compile3m 46smaster passed
+1 💚checkstyle0m 49smaster passed
+1 💚spotbugs1m 52smaster passed
+1 💚spotless0m 48sbranch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚mvninstall3m 30sthe patch passed
+1 💚compile3m 5sthe patch passed
+1 💚javac3m 5sthe patch passed
+1 💚blanks0m 0sThe patch has no blanks issues.
+1 💚checkstyle0m 39sthe patch passed
+1 💚spotbugs2m 0sthe patch passed
+1 💚hadoopcheck12m 7sPatch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚spotless0m 44spatch has no errors when running spotless:check.
_ Other Tests _
+1 💚asflicense0m 11sThe patch does not generate ASF License warnings.
40m 51s
SubsystemReport/Notes
DockerClientAPI=1.46 ServerAPI=1.46 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6066/5/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#6066
JIRA IssueHBASE-28346
Optional Testsdupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
unameLinux 4f7e6ac185cc 5.4.0-186-generic #206-Ubuntu SMP Fri Apr 26 12:31:10 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 2825e30
Default JavaEclipse Adoptium-17.0.11+9
Max. process+thread count84 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6066/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 39sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed 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 _
+1 💚mvninstall3m 53smaster passed
+1 💚compile1m 10smaster passed
+1 💚javadoc0m 35smaster passed
+1 💚shadedjars6m 38sbranch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚mvninstall3m 45sthe patch passed
+1 💚compile1m 6sthe patch passed
+1 💚javac1m 6sthe patch passed
+1 💚javadoc0m 32sthe patch passed
+1 💚shadedjars6m 27spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚unit246m 48shbase-server in the patch passed.
276m 31s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6066/5/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR#6066
JIRA IssueHBASE-28346
Optional Testsjavac javadoc unit compile shadedjars
unameLinux 1b8e3056948b 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 / 2825e30
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6066/5/testReport/
Max. process+thread count4437 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6066/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.

@ndimiduk
ndimiduk merged commit 158b6d0 into apache:masterAug 6, 2024
@ndimiduk
ndimiduk deleted the coprocessor-env-quota branch August 6, 2024 10:47
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Aug 6, 2024
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Aug 6, 2024
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Aug 6, 2024
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
ndimiduk pushed a commit that referenced this pull request Aug 7, 2024
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
ndimiduk added a commit that referenced this pull request Aug 7, 2024
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Charles Connell <cconnell@hubspot.com>
ndimiduk added a commit that referenced this pull request Aug 7, 2024
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Charles Connell <cconnell@hubspot.com>
charlesconnell added a commit to HubSpot/hbase that referenced this pull request Aug 7, 2024
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Charles Connell <cconnell@hubspot.com>
charlesconnell added a commit to HubSpot/hbase that referenced this pull request Aug 19, 2024
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Charles Connell <cconnell@hubspot.com>
ndimiduk added a commit to ndimiduk/hbase that referenced this pull request Oct 4, 2024
ndimiduk added a commit to ndimiduk/hbase that referenced this pull request Oct 7, 2024
… (addendum)
Add default implementations of the new methods so that a custom implementation of
RegionCoprocessorEnvironment will not fail to compile after upgrade.
ndimiduk added a commit that referenced this pull request Oct 8, 2024
…ndum) (#6350)
Add default implementations of the new methods so that a custom implementation of
RegionCoprocessorEnvironment will not fail to compile after upgrade.
Signed-off-by: Nihal Jain <nihaljain@apache.org>
ndimiduk added a commit to ndimiduk/hbase that referenced this pull request Oct 8, 2024
… (addendum) (apache#6350)
Add default implementations of the new methods so that a custom implementation of
RegionCoprocessorEnvironment will not fail to compile after upgrade.
Signed-off-by: Nihal Jain <nihaljain@apache.org>
ndimiduk added a commit that referenced this pull request Oct 8, 2024
…ndum) (#6350)
Add default implementations of the new methods so that a custom implementation of
RegionCoprocessorEnvironment will not fail to compile after upgrade.
Signed-off-by: Nihal Jain <nihaljain@apache.org>
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.

5 participants

@charlesconnell@Apache-HBase@ndimiduk@bbeaudreault@rmdmattingly