Skip to content
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-28346: Expose checkQuota to Coprocessor Endpoints #6066

Merged
merged 6 commits into from
Aug 6, 2024

Conversation

charlesconnell
Copy link
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.

Copy link
Contributor

@rmdmattingly rmdmattingly left a comment

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
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
Contributor Author

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
Contributor Author

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.

Copy link
Member

@ndimiduk ndimiduk left a comment

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.hadoop.hbase.regionserver.OnlineRegions;
import org.apache.hadoop.hbase.regionserver.Region;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;

import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos;
Copy link
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
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
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
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
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
Contributor Author

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.

@@ -131,6 +138,12 @@ public RegionEnvironment(final RegionCoprocessor impl, final int priority, final
this.services = services;
this.metricRegistry =
MetricsCoprocessor.createRegistryForRegionCoprocessor(impl.getClass().getName());
// lets unit tests through
Copy link
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
Contributor Author

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
Member

Choose a reason for hiding this comment

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

unsed?

Copy link
Contributor Author

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

@charlesconnell charlesconnell force-pushed the coprocessor-env-quota branch from e27117f to 2825e30 Compare July 25, 2024 11:57
@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 48s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
_ master Compile Tests _
+1 💚 mvninstall 4m 4s master passed
+1 💚 compile 3m 46s master passed
+1 💚 checkstyle 0m 49s master passed
+1 💚 spotbugs 1m 52s master passed
+1 💚 spotless 0m 48s branch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 30s the patch passed
+1 💚 compile 3m 5s the patch passed
+1 💚 javac 3m 5s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 39s the patch passed
+1 💚 spotbugs 2m 0s the patch passed
+1 💚 hadoopcheck 12m 7s Patch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚 spotless 0m 44s patch has no errors when running spotless:check.
_ Other Tests _
+1 💚 asflicense 0m 11s The patch does not generate ASF License warnings.
40m 51s
Subsystem Report/Notes
Docker ClientAPI=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 Issue HBASE-28346
Optional Tests dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
uname Linux 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 tool maven
Personality dev-support/hbase-personality.sh
git revision master / 2825e30
Default Java Eclipse Adoptium-17.0.11+9
Max. process+thread count 84 (vs. ulimit of 30000)
modules C: hbase-server U: hbase-server
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6066/5/console
versions git=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 39s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed 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 💚 mvninstall 3m 53s master passed
+1 💚 compile 1m 10s master passed
+1 💚 javadoc 0m 35s master passed
+1 💚 shadedjars 6m 38s branch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 45s the patch passed
+1 💚 compile 1m 6s the patch passed
+1 💚 javac 1m 6s the patch passed
+1 💚 javadoc 0m 32s the patch passed
+1 💚 shadedjars 6m 27s patch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚 unit 246m 48s hbase-server in the patch passed.
276m 31s
Subsystem Report/Notes
Docker ClientAPI=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 Issue HBASE-28346
Optional Tests javac javadoc unit compile shadedjars
uname Linux 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 tool maven
Personality dev-support/hbase-personality.sh
git revision master / 2825e30
Default Java Eclipse Adoptium-17.0.11+9
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6066/5/testReport/
Max. process+thread count 4437 (vs. ulimit of 30000)
modules C: hbase-server U: hbase-server
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6066/5/console
versions git=2.34.1 maven=3.9.8
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@ndimiduk ndimiduk merged commit 158b6d0 into apache:master Aug 6, 2024
1 check passed
@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
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Aug 6, 2024
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Aug 6, 2024
ndimiduk pushed a commit that referenced this pull request Aug 7, 2024
ndimiduk added a commit that referenced this pull request Aug 7, 2024
ndimiduk added a commit that referenced this pull request Aug 7, 2024
charlesconnell added a commit to HubSpot/hbase that referenced this pull request Aug 7, 2024
charlesconnell added a commit to HubSpot/hbase that referenced this pull request Aug 19, 2024
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Sign up for free to 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