Uh oh!
There was an error while loading. Please reload this page.
HBASE-28716: Users of QuotaRetriever should pass an existing connection (master) - #6065
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
charlesconnell
commented
Jul 15, 2024
unit test failure appears unrelated |
ndimiduk
left a comment
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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 ?’
There was a problem hiding this comment.
Are non-public methods of an IA.Public class required to go through a deprecation cycle, or only public methods?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
+1 for the deprecation cycle.
There was a problem hiding this comment.
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?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| */ | ||
| public static QuotaRetriever open(final Configuration conf) throws IOException { | ||
| return open(conf, null); | ||
| public static QuotaRetriever open(final Connection conn) throws IOException { |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Apache-HBase
commented
Jul 18, 2024
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Jul 18, 2024
💔 -1 overall
This message was automatically generated. |
ndimiduk
commented
Jul 19, 2024
Unit test failure looks unrelated |
apache#6065) Signed-off-by: Nick Dimiduk <ndimiduk@apache.org> Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
apache#6065) Signed-off-by: Nick Dimiduk <ndimiduk@apache.org> Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
apache#6065) Signed-off-by: Nick Dimiduk <ndimiduk@apache.org> Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
apache#6065) Signed-off-by: Nick Dimiduk <ndimiduk@apache.org> Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
#6065) Signed-off-by: Nick Dimiduk <ndimiduk@apache.org> Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
#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>
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>
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>
#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>
#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>
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>
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>
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>
Every call to
HBaseAdmin#getQuota()opens a newConnection, and then closes it. As far as I can tell, this is pointless, since it could use the existingConnectionobject held by theHBaseAdmin. Change this and other uses of QuotaRetriever to use existing Connections.