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-28716: Users of QuotaRetriever should pass an existing connection (master) #6065

Merged
merged 4 commits into from
Jul 19, 2024

Conversation

charlesconnell
Copy link
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
Contributor Author

unit test failure appears unrelated

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.

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.

* Should QutoaRetriever manage the state of the connection, or leave it be.
*/
private boolean isManagedConnection = false;

QuotaRetriever() {
Copy link
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
Contributor Author

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

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

* @return the QuotaRetriever
* @throws IOException if a remote or network exception occurs
*/
public static QuotaRetriever open(final Configuration conf) throws IOException {
return open(conf, null);
public static QuotaRetriever open(final Connection conn) throws IOException {
Copy link
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
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
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.

@charlesconnell charlesconnell requested a review from ndimiduk July 17, 2024 17:31
@Apache-HBase

This comment has been minimized.

Copy link
Contributor

@pankaj72981 pankaj72981 left a comment

Choose a reason for hiding this comment

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

+1 LGTM

* @return the QuotaRetriever
* @throws IOException if a remote or network exception occurs
*/
public static QuotaRetriever open(final Configuration conf) throws IOException {
return open(conf, null);
public static QuotaRetriever open(final Connection conn) throws IOException {
Copy link
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?

@@ -168,7 +168,7 @@ Multimap<TableName, String> getSnapshotsToComputeSize() throws IOException {
filter.addTypeFilter(QuotaType.SPACE);
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
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
Contributor Author

Choose a reason for hiding this comment

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

Yep, you got it!

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.

Thank you @charlesconnell !

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 14s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s 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 _
+0 🆗 mvndep 0m 10s Maven dependency ordering for branch
+1 💚 mvninstall 2m 52s master passed
+1 💚 compile 3m 42s master passed
+1 💚 checkstyle 0m 55s master passed
+1 💚 spotbugs 2m 16s master passed
+1 💚 spotless 0m 43s branch has no errors when running spotless:check.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 11s Maven dependency ordering for patch
+1 💚 mvninstall 2m 54s the patch passed
+1 💚 compile 3m 39s the patch passed
+1 💚 javac 3m 39s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 55s the patch passed
+1 💚 spotbugs 2m 32s the patch passed
+1 💚 hadoopcheck 10m 23s Patch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚 spotless 0m 43s patch has no errors when running spotless:check.
_ Other Tests _
+1 💚 asflicense 0m 21s The patch does not generate ASF License warnings.
39m 15s
Subsystem Report/Notes
Docker ClientAPI=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 Issue HBASE-28716
Optional Tests dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
uname Linux 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 tool maven
Personality dev-support/hbase-personality.sh
git revision master / 6caf25e
Default Java Eclipse Adoptium-17.0.11+9
Max. process+thread count 86 (vs. ulimit of 30000)
modules C: hbase-client hbase-server U: .
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6065/4/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 46s 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 _
+0 🆗 mvndep 0m 16s Maven dependency ordering for branch
+1 💚 mvninstall 3m 32s master passed
+1 💚 compile 1m 29s master passed
+1 💚 javadoc 0m 55s master passed
+1 💚 shadedjars 6m 15s branch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 12s Maven dependency ordering for patch
+1 💚 mvninstall 3m 42s the patch passed
+1 💚 compile 1m 44s the patch passed
+1 💚 javac 1m 44s the patch passed
+1 💚 javadoc 0m 53s the patch passed
+1 💚 shadedjars 6m 26s patch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚 unit 2m 4s hbase-client in the patch passed.
-1 ❌ unit 276m 17s /patch-unit-hbase-server.txt hbase-server in the patch failed.
309m 27s
Subsystem Report/Notes
Docker ClientAPI=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 Issue HBASE-28716
Optional Tests javac javadoc unit compile shadedjars
uname Linux 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 tool maven
Personality dev-support/hbase-personality.sh
git revision master / 6caf25e
Default Java Eclipse Adoptium-17.0.11+9
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6065/4/testReport/
Max. process+thread count 4449 (vs. ulimit of 30000)
modules C: hbase-client hbase-server U: .
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6065/4/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
Copy link
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:master Jul 19, 2024
1 check failed
@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
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Jul 19, 2024
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Jul 19, 2024
ndimiduk pushed a commit to ndimiduk/hbase that referenced this pull request Jul 19, 2024
ndimiduk pushed a commit that referenced this pull request Jul 22, 2024
ndimiduk added a commit that referenced this pull request Jul 23, 2024
#6065)

Signed-off-by: Nick Dimiduk <[email protected]>
Signed-off-by: Pankaj Kumar <[email protected]>
Co-authored-by: Charles Connell <[email protected]>
ndimiduk added a commit to ndimiduk/hbase that referenced this pull request Jul 23, 2024
apache#6065)

Signed-off-by: Nick Dimiduk <[email protected]>
Signed-off-by: Pankaj Kumar <[email protected]>
Co-authored-by: Charles Connell <[email protected]>
ndimiduk added a commit to ndimiduk/hbase that referenced this pull request Jul 23, 2024
apache#6065)

Signed-off-by: Nick Dimiduk <[email protected]>
Signed-off-by: Pankaj Kumar <[email protected]>
Co-authored-by: Charles Connell <[email protected]>
ndimiduk added a commit that referenced this pull request Jul 24, 2024
#6065)

Signed-off-by: Nick Dimiduk <[email protected]>
Signed-off-by: Pankaj Kumar <[email protected]>
Co-authored-by: Charles Connell <[email protected]>
ndimiduk added a commit that referenced this pull request Jul 24, 2024
#6065)

Signed-off-by: Nick Dimiduk <[email protected]>
Signed-off-by: Pankaj Kumar <[email protected]>
Co-authored-by: Charles Connell <[email protected]>
charlesconnell added a commit to HubSpot/hbase that referenced this pull request Jul 24, 2024
apache#6065)

Signed-off-by: Nick Dimiduk <[email protected]>
Signed-off-by: Pankaj Kumar <[email protected]>
Co-authored-by: Charles Connell <[email protected]>
charlesconnell added a commit to HubSpot/hbase that referenced this pull request Jul 24, 2024
apache#6065) (#107)

Signed-off-by: Nick Dimiduk <[email protected]>
Signed-off-by: Pankaj Kumar <[email protected]>
Co-authored-by: Nick Dimiduk <[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.

4 participants