Skip to content

HBASE-28001: Add request attribute support to BufferedMutator - #6076

Merged
ndimiduk merged 15 commits into
apache:masterfrom
HubSpot:HBASE-28001
Sep 5, 2024
Merged

HBASE-28001: Add request attribute support to BufferedMutator#6076
ndimiduk merged 15 commits into
apache:masterfrom
HubSpot:HBASE-28001

Conversation

@eab148

@eab148eab148 commented Jul 12, 2024

Copy link
Copy Markdown
Contributor

Design Doc

As of #5326, we have been able to set request attributes on Table instances via TableBuilder::setRequestAttribute. With request attributes, users can send an attribute once per request, instead of once per operation.

In this PR, we extend the feature to BufferedMutators. One can set a request attribute on a BufferedMutator via a new method BufferedMutatorParams::setRequestAttribute(String key, byte[] value).

Map<String, byte[]> REQUEST_ATTRIBUTES = Map.of(...);
...
BufferedMutatorParams params = new BufferedMutatorParams(REQUEST_ATTRIBUTES_TEST_TABLE);
REQUEST_ATTRIBUTES.forEach(params::setRequestAttribute);
BufferedMutator bufferedMutator = conn.getBufferedMutator(params);
// all calls generated via this buffered mutator will include the given attributes

Jira

cc @bbeaudreault@hgromer@bozzkar@rmdmattingly@krconv@sidkhillon

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

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

@eab148
eab148 marked this pull request as ready for review July 15, 2024 18:41

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

No objections from me. This looks like a straightforward extension of our existing feature. It's been a while since I've thought about these classes, but the use-case and API changes look fine to me.

Since this is public API, let's see if others have an opinion here.

/**
* Set a rpc request attribute.
*/
AsyncBufferedMutatorBuilder setRequestAttribute(String key, byte[] value);

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.

Do we expect this to override all existing requestAttributes and replace the collection with this value? Or, do we expect this method to add an additional requestAttribute to an existing set?

Take a look at the breadth of API exposed on Immutable.Builder implementations around collection objects -- https://immutables.github.io/immutable.html#array-collection-and-map-attributes I'm not saying that we need all of these, but at least consider which semantics we want to support and why.

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, or maybe you're hamstrung by the apis that TableBuilder exposes? Maybe we should look at expanding the scope of these methods in a separate JIRA.

@eab148eab148Jul 17, 2024

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.

Ah, or maybe you're hamstrung by the apis that TableBuilder exposes?

Yeah, currently the AsyncBufferedMutatorBuilderImpl wraps an AsyncTableBuilder (code).

Maybe we should look at expanding the scope of these methods in a separate JIRA.

I think this is a good idea. When I drafted this PR, I had a difficult time understanding what semantics we support and why we chose them.

@ndimiduk

Copy link
Copy Markdown
Member

Do we have anything that demonstrates use of connection or request attributes in hbase-examples? If yes, please add example overage there. If not, would you mind filing an issue to add something to that module? Thanks @eab148 !

@eab148

Copy link
Copy Markdown
ContributorAuthor

Do we have anything that demonstrates use of connection or request attributes in hbase-examples? If yes, please add example overage there. If not, would you mind filing an issue to add something to that module?

We do not. I can create an issue to add request attribute example coverage to the hbase-examples module.

@eab148

Copy link
Copy Markdown
ContributorAuthor

Since this is public API, let's see if others have an opinion here.

Makes sense! Happy to field any questions/concerns and make adjustments.

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

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

@Apache-HBase

This comment has been minimized.

@eab148

Copy link
Copy Markdown
ContributorAuthor

Test failure is unrelated to this change

[ERROR] Tests run: 7, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 768.803 s <<< FAILURE! - in org.apache.hadoop.hbase.TestAcidGuaranteesWithEagerPolicy
[ERROR] org.apache.hadoop.hbase.TestAcidGuaranteesWithEagerPolicy Time elapsed: 618.862 s <<< ERROR!
org.junit.runners.model.TestTimedOutException: test timed out after 780 seconds
at java.base@17.0.11/java.lang.Object.wait(Native Method)
at java.base@17.0.11/java.lang.Thread.join(Thread.java:1313)
at java.base@17.0.11/java.lang.Thread.join(Thread.java:1381)
at app//org.apache.hadoop.hbase.MultithreadedTestUtil$TestContext.stop(MultithreadedTestUtil.java:103)
at app//org.apache.hadoop.hbase.AcidGuaranteesTestTool.runTestAtomicity(AcidGuaranteesTestTool.java:390)
at app//org.apache.hadoop.hbase.AcidGuaranteesTestTool.doWork(AcidGuaranteesTestTool.java:130)
at app//org.apache.hadoop.hbase.util.AbstractHBaseTool.run(AbstractHBaseTool.java:150)
at app//org.apache.hadoop.hbase.AcidGuaranteesTestBase.runTestAtomicity(AcidGuaranteesTestBase.java:102)
at app//org.apache.hadoop.hbase.AcidGuaranteesTestBase.testMobGetAtomicity(AcidGuaranteesTestBase.java:122)
at java.base@17.0.11/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base@17.0.11/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base@17.0.11/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base@17.0.11/java.lang.reflect.Method.invoke(Method.java:568)
at app//org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at app//org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at app//org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at app//org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at app//org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at app//org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at app//org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at app//org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at app//org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at app//org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at app//org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at app//org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at app//org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at app//org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at app//org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at app//org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at app//org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at app//org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at app//org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299)
at app//org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293)
at java.base@17.0.11/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base@17.0.11/java.lang.Thread.run(Thread.java:840)
[ERROR] org.apache.hadoop.hbase.TestAcidGuaranteesWithEagerPolicy Time elapsed: 618.878 s <<< ERROR!
java.lang.Exception: Appears to be stuck in thread MiniHBaseClusterRegionServer-EventLoopGroup-3-1
at app//org.apache.hbase.thirdparty.io.netty.channel.epoll.Native.epollWait0(Native Method)
at app//org.apache.hbase.thirdparty.io.netty.channel.epoll.Native.epollWait(Native.java:193)
at app//org.apache.hbase.thirdparty.io.netty.channel.epoll.EpollEventLoop.epollWait(EpollEventLoop.java:312)
at app//org.apache.hbase.thirdparty.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:376)
at app//org.apache.hbase.thirdparty.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at app//org.apache.hbase.thirdparty.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at app//org.apache.hbase.thirdparty.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base@17.0.11/java.lang.Thread.run(Thread.java:840)

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 44sDocker 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 35sMaven dependency ordering for branch
+1 💚mvninstall3m 29smaster passed
+1 💚compile4m 15smaster passed
+1 💚checkstyle0m 59smaster passed
+1 💚spotbugs2m 46smaster passed
+1 💚spotless0m 45sbranch has no errors when running spotless:check.
-0 ⚠️patch1m 3sUsed diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary.
_ Patch Compile Tests _
+0 🆗mvndep0m 10sMaven dependency ordering for patch
+1 💚mvninstall3m 2sthe patch passed
+1 💚compile4m 13sthe patch passed
+1 💚javac4m 13sthe patch passed
+1 💚blanks0m 0sThe patch has no blanks issues.
+1 💚checkstyle0m 59sthe patch passed
+1 💚spotbugs3m 3sthe patch passed
+1 💚hadoopcheck11m 35sPatch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚spotless0m 48spatch has no errors when running spotless:check.
_ Other Tests _
+1 💚asflicense0m 28sThe patch does not generate ASF License warnings.
45m 27s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6076/10/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#6076
Optional Testsdupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
unameLinux 6a199395ebc9 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 / 0a04b60
Default JavaEclipse Adoptium-17.0.11+9
Max. process+thread count84 (vs. ulimit of 30000)
modulesC: hbase-client hbase-server hbase-examples U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6076/10/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 34sDocker 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 _
+0 🆗mvndep0m 18sMaven dependency ordering for branch
+1 💚mvninstall3m 5smaster passed
+1 💚compile1m 43smaster passed
+1 💚javadoc1m 7smaster passed
+1 💚shadedjars5m 17sbranch has no errors when building our shaded downstream artifacts.
-0 ⚠️patch5m 45sUsed diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary.
_ Patch Compile Tests _
+0 🆗mvndep0m 13sMaven dependency ordering for patch
+1 💚mvninstall2m 57sthe patch passed
+1 💚compile1m 42sthe patch passed
+1 💚javac1m 42sthe patch passed
+1 💚javadoc1m 6sthe patch passed
+1 💚shadedjars5m 20spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚unit1m 37shbase-client in the patch passed.
+1 💚unit225m 49shbase-server in the patch passed.
+1 💚unit2m 13shbase-examples in the patch passed.
258m 5s
SubsystemReport/Notes
DockerClientAPI=1.47 ServerAPI=1.47 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6076/10/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR#6076
Optional Testsjavac javadoc unit compile shadedjars
unameLinux 3f5fc70dab73 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 0a04b60
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6076/10/testReport/
Max. process+thread count5142 (vs. ulimit of 30000)
modulesC: hbase-client hbase-server hbase-examples U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6076/10/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 b19ee00 into apache:masterSep 5, 2024
@ndimiduk
ndimiduk deleted the HBASE-28001 branch September 5, 2024 13:41
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Sep 5, 2024
…#6076)
Co-authored-by: Evie Boland <eboland@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
@ndimiduk

Copy link
Copy Markdown
Member

Thanks a lot for the contribution @eab148 ! Can you please also provide a new PR for branch-2? You can start by cherry-picking the commit that landed on master. Do ping me when you have the PR up, thanks!

ndimiduk pushed a commit that referenced this pull request Sep 9, 2024
Co-authored-by: Evie Boland <eboland@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
This was referenced Sep 13, 2024
ndimiduk pushed a commit that referenced this pull request Sep 17, 2024
Co-authored-by: Evie Boland <eboland@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Sep 17, 2024
…#6076)
Co-authored-by: Evie Boland <eboland@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
ndimiduk pushed a commit that referenced this pull request Sep 17, 2024
Co-authored-by: Evie Boland <eboland@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
eab148 added a commit to HubSpot/hbase that referenced this pull request Oct 3, 2024
…edMutator (apache#6076)
Co-authored-by: Evie Boland <eboland@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
eab148 added a commit to HubSpot/hbase that referenced this pull request Oct 3, 2024
…redMutator (apache#6076)
Co-authored-by: Evie Boland <eboland@hubspot.com>
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
eab148 added a commit to HubSpot/hbase that referenced this pull request Oct 4, 2024
…edMutator (apache#6076) (#116)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Evie Boland <eboland@hubspot.com>
eab148 added a commit to HubSpot/hbase that referenced this pull request Oct 4, 2024
…redMutator (apache#6076) (#118)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Co-authored-by: Evie Boland <eboland@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
…#6076) (addendum)
Add default implementations of the new methods so that a custom implementation of
AsyncBufferedMutatorBuilder will not fail to compile after upgrade.
ndimiduk added a commit to ndimiduk/hbase that referenced this pull request Oct 8, 2024
…#6076) (addendum)
Add default implementations of the new methods so that a custom implementation of
AsyncBufferedMutatorBuilder will not fail to compile after upgrade.
ndimiduk added a commit that referenced this pull request Oct 8, 2024
… (addendum) (#6349)
Add default implementations of the new methods so that a custom implementation of
AsyncBufferedMutatorBuilder will not fail to compile after upgrade.
Signed-off-by: Nihal Jain <nihaljain@apache.org>
Signed-off-by: Istvan Toth <stoty@apache.org>
ndimiduk added a commit to ndimiduk/hbase that referenced this pull request Oct 8, 2024
…#6076) (addendum) (apache#6349)
Add default implementations of the new methods so that a custom implementation of
AsyncBufferedMutatorBuilder will not fail to compile after upgrade.
Signed-off-by: Nihal Jain <nihaljain@apache.org>
Signed-off-by: Istvan Toth <stoty@apache.org>
ndimiduk added a commit that referenced this pull request Oct 8, 2024
… (addendum) (#6349)
Add default implementations of the new methods so that a custom implementation of
AsyncBufferedMutatorBuilder will not fail to compile after upgrade.
Signed-off-by: Nihal Jain <nihaljain@apache.org>
Signed-off-by: Istvan Toth <stoty@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.

3 participants

@eab148@Apache-HBase@ndimiduk