Skip to content

HBASE-28716: Users of QuotaRetriever should pass an existing connection (master) - #6065

Merged
ndimiduk merged 4 commits into
apache:masterfrom
HubSpot:quota-retriver-reuse-connection
Jul 19, 2024
Merged

HBASE-28716: Users of QuotaRetriever should pass an existing connection (master)#6065
ndimiduk merged 4 commits into
apache:masterfrom
HubSpot:quota-retriver-reuse-connection

Conversation

@charlesconnell

Copy link
Copy Markdown
Contributor

Every call to HBaseAdmin#getQuota() opens a new Connection, and then closes it. As far as I can tell, this is pointless, since it could use the existing Connection object held by the HBaseAdmin. Change this and other uses of QuotaRetriever to use existing Connections.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@charlesconnell

Copy link
Copy Markdown
ContributorAuthor

unit test failure appears unrelated

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

I think this kind of change is the correct thing to do. In principal, our non-service classes should never manage their own Connection instances and instead rely on a caller to provide one. However, we need to execute this change according to our deprecation policy.

*/
private boolean isManagedConnection = false;

QuotaRetriever() {

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 a weird API. This class is decorated as IA.Public but it's only created via these static factory method? Any what's with using the default constructor + an init method -- what happened to RAII ?’

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.

Are non-public methods of an IA.Public class required to go through a deprecation cycle, or only public methods?

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.

Only public methods.

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.

Okay, then this PR is complying with the deprecation policy now

*/
public static QuotaRetriever open(final Configuration conf) throws IOException {
return open(conf, null);
public static QuotaRetriever open(final Connection conn) throws IOException {

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.

Because this is IA.Public, you cannot make these blanket changes in one pass. You'll need to observe a deprecation cycle through a major release in order to make breaking changes to the public API.

We document this in depth over on https://hbase.apache.org/book.html#hbase.versioning

If we're going through the trouble to make breaking changes, let's push RAII and do away with the parameterless constructor + init method.

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.

+1 for the deprecation cycle.

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.

If we're going through the trouble to make breaking changes, let's push RAII and do away with the parameterless constructor + init method.

Since we're opening this worm-can, how about we get rid of these static constructor methods and use constructors like a normal object?

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

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

+1 LGTM

*/
public static QuotaRetriever open(final Configuration conf) throws IOException {
return open(conf, null);
public static QuotaRetriever open(final Connection conn) throws IOException {

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.

If we're going through the trouble to make breaking changes, let's push RAII and do away with the parameterless constructor + init method.

Since we're opening this worm-can, how about we get rid of these static constructor methods and use constructors like a normal object?

try (Admin admin = conn.getAdmin()) {
// Pull all of the tables that have quotas (direct, or from namespace)
for (QuotaSettings qs : QuotaRetriever.open(conf, filter)) {
for (QuotaSettings qs : QuotaRetriever.open(conn, filter)) {

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.

Would you mind also promoting uses of the QuotaRetriever object up to try-with-resource blocks? In this particular case, it looks like we never close the object.

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.

Yep, you got it!

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

Thank you @charlesconnell !

@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 14sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 1sNo 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 10sMaven dependency ordering for branch
+1 💚mvninstall2m 52smaster passed
+1 💚compile3m 42smaster passed
+1 💚checkstyle0m 55smaster passed
+1 💚spotbugs2m 16smaster passed
+1 💚spotless0m 43sbranch has no errors when running spotless:check.
_ Patch Compile Tests _
+0 🆗mvndep0m 11sMaven dependency ordering for patch
+1 💚mvninstall2m 54sthe patch passed
+1 💚compile3m 39sthe patch passed
+1 💚javac3m 39sthe patch passed
+1 💚blanks0m 0sThe patch has no blanks issues.
+1 💚checkstyle0m 55sthe patch passed
+1 💚spotbugs2m 32sthe patch passed
+1 💚hadoopcheck10m 23sPatch 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 21sThe patch does not generate ASF License warnings.
39m 15s
SubsystemReport/Notes
DockerClientAPI=1.46 ServerAPI=1.46 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6065/4/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#6065
JIRA IssueHBASE-28716
Optional Testsdupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
unameLinux 7e142dc30dea 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 6caf25e
Default JavaEclipse Adoptium-17.0.11+9
Max. process+thread count86 (vs. ulimit of 30000)
modulesC: hbase-client hbase-server U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6065/4/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 46sDocker 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 16sMaven dependency ordering for branch
+1 💚mvninstall3m 32smaster passed
+1 💚compile1m 29smaster passed
+1 💚javadoc0m 55smaster passed
+1 💚shadedjars6m 15sbranch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+0 🆗mvndep0m 12sMaven dependency ordering for patch
+1 💚mvninstall3m 42sthe patch passed
+1 💚compile1m 44sthe patch passed
+1 💚javac1m 44sthe patch passed
+1 💚javadoc0m 53sthe patch passed
+1 💚shadedjars6m 26spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚unit2m 4shbase-client in the patch passed.
-1 ❌unit276m 17s/patch-unit-hbase-server.txthbase-server in the patch failed.
309m 27s
SubsystemReport/Notes
DockerClientAPI=1.46 ServerAPI=1.46 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6065/4/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR#6065
JIRA IssueHBASE-28716
Optional Testsjavac javadoc unit compile shadedjars
unameLinux e919e2ed1164 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 / 6caf25e
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6065/4/testReport/
Max. process+thread count4449 (vs. ulimit of 30000)
modulesC: hbase-client hbase-server U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6065/4/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

Copy link
Copy Markdown
Member

Unit test failure looks unrelated

[ERROR] Errors: [ERROR] org.apache.hadoop.hbase.master.assignment.TestRollbackSCP.testFailAndRollback
[ERROR] Run 1: TestRollbackSCP.testFailAndRollback:180 » IllegalArgument scheduler queue not empty: MasterProcedureScheduler[running=true,tableMap=TableQueue[key=test,lockStatus=LockAndQueue[exclusiveLock=false,sharedLockCount=0],size=1,namespaceLockStatus=LockAndQueue[exclusiveLock=false,sharedLockCount=0]],tableWaitingMap={},peerMap=<null>,metaMap=<null>,globalMap=<null>]
[ERROR] Run 2: TestRollbackSCP.testFailAndRollback:177 Waiting timed out after [30,000] msec
[ERROR] Run 3: TestRollbackSCP.testFailAndRollback:177 Waiting timed out after [30,000] msec

@ndimiduk
ndimiduk merged commit b7d11a7 into apache:masterJul 19, 2024
@ndimiduk
ndimiduk deleted the quota-retriver-reuse-connection branch July 19, 2024 10:46
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Jul 19, 2024
apache#6065)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Jul 19, 2024
apache#6065)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Jul 19, 2024
apache#6065)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Jul 19, 2024
apache#6065)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
ndimiduk pushed a commit that referenced this pull request Jul 22, 2024
#6065)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
ndimiduk added a commit that referenced this pull request Jul 23, 2024
#6065)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
Co-authored-by: Charles Connell <cconnell@hubspot.com>
ndimiduk added a commit to ndimiduk/hbase that referenced this pull request Jul 23, 2024
apache#6065)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
Co-authored-by: Charles Connell <cconnell@hubspot.com>
ndimiduk added a commit to ndimiduk/hbase that referenced this pull request Jul 23, 2024
apache#6065)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
Co-authored-by: Charles Connell <cconnell@hubspot.com>
ndimiduk added a commit that referenced this pull request Jul 24, 2024
#6065)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
Co-authored-by: Charles Connell <cconnell@hubspot.com>
ndimiduk added a commit that referenced this pull request Jul 24, 2024
#6065)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
Co-authored-by: Charles Connell <cconnell@hubspot.com>
charlesconnell added a commit to HubSpot/hbase that referenced this pull request Jul 24, 2024
apache#6065)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
Co-authored-by: Charles Connell <cconnell@hubspot.com>
charlesconnell added a commit to HubSpot/hbase that referenced this pull request Jul 24, 2024
apache#6065) (#107)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
Co-authored-by: Nick Dimiduk <ndimiduk@apache.org>
sanjeet006py pushed a commit to sanjeet006py/hbase that referenced this pull request Aug 24, 2025
apache#6065)
Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
Co-authored-by: Charles Connell <cconnell@hubspot.com>
Signed-off-by: apoonia <apoonia@salesforce.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.

4 participants

@charlesconnell@Apache-HBase@ndimiduk@pankaj72981