-
Notifications
You must be signed in to change notification settings - Fork 505
METRON-2175 Introduce HBase Connection Abstractions for HBase 2.0.2 #1456
METRON-2175 Introduce HBase Connection Abstractions for HBase 2.0.2 #1456
Conversation
...tform/metron-hbase/metron-hbase-common/src/main/java/org/apache/metron/hbase/ColumnList.java
Show resolved
Hide resolved
| * <p>Maintains a static, in-memory set of records to mimic the behavior of | ||
| * an {@link HBaseClient} that interacts with HBase. | ||
| */ | ||
| public class FakeHBaseClient implements HBaseClient, Serializable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ends up being very useful as an abstraction to test things that need to interact with HBase. The implementation ended up being a little more complex than I had hoped. That is why I also added a test for this class in FakeHBaseClientTest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is my understanding correct that FakeHBaseClient and FakeHBaseClientFactory are not directly used in this PR? I agree that FakeHBaseClient looks fairly complex for a testing class. Is this used in PRs that follow or am I just missing where it's included?
My experience with MockHTable has been that it's very complex and difficult to maintain. I would prefer to move away from depending on something like this for unit testing (integration tests use an in-memory server correct?).
I trust that you created this for a reason but it's hard for me to wrap my head around it without some context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good point. Let me see if I can drop those from this PR and add them to one of the follow-on PRs where they are actually used.
Maybe there is a way that we can think of to avoid some complexity here. But obviously you won't be able to help unless you see these classes in use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the Fake* classes and will introduce them in later PRs.
|
Just curious, if the new API existed in the earlier version, would it make sense to perform this change against master? I'm not sure there are any tangible benefits aside from it de-risking merges and other code changes. |
|
I think it would be better to just continue on in the feature branch. After all the changes required for the HBase 2.0.2 get merged I'd like to run it through a good set of acceptance tests. It will be a bit safer to progress through this in the feature branch. |
|
@nickwallen - ok, sounds good to me. |
...hbase/metron-hbase-common/src/main/java/org/apache/metron/hbase/client/HBaseTableClient.java
Outdated
Show resolved
Hide resolved
|
Looks like a good start to me. +1 |
|
This has been merged into |
… 2.0.2 (nickwallen) closes apache#1456" This reverts commit ef3a76c.
This PR is for the
feature/METRON-2088-support-HDP-3.1feature branch.Description
The major change in migration to HBase 2.0.2 is that connection management must now be managed by the client (us). Previously this was managed internally within the HBase client.
More specifically, previously you could just instantiate a Table whenever you like and not worry about closing it. Now you must first establish a
Connectionand from thatConnection, you can create aTable. Both of those need to be closed after use. AConnectioncan be shared by multiple threads, but aTablecannot be shared.Most of our existing abstractions were not designed to handle connection management, specifically closing the
ConnectionandTableresources after use. This is why the HBase upgrade is quite involved.This Jira will introduce the new abstractions that allow Metron to interact with HBase 2.0.2, but not remove the existing ones. I will then introduce additional follow-on PRs to start using these new abstractions in various parts of the Metron code base. Finally, the existing abstractions that do not work with HBase 2.0.2 will be removed as a final step.
Changes
Moved the legacy HBase client from
HBaseClienttoLegacyHBaseClient. This allows the code to continue to function while the new abstractions are introduced. TheLegacyHBaseClientwill be removed before the feature branch for HDP-3.1 is merged into master.Introduced two new profiles
HDP-2.6andHDP-3.1. TheHDP-2.6profile is currently the default and will continue to compile Metron with all the same versions that we do today. After the HBase upgrade work is complete, we will change the default profile toHDP-3.1.Created the
HBaseClientinterface that expands on the methods provided by theLegacyHBaseClient. These additional methods will allow it to be used more broadly across the code base in future PRs.HBaseTableClientwhich uses HBase's Table to interact with HBase.Created the
HBaseClientFactorythat allows anHBaseClientto be injected as needed.Created a
HBaseConnectionFactorythat is responsible for creating connections to HBase.Acceptance Testing
This should not impact the deployment and functioning of the system. As a sanity check, spin-up Full Dev and ensure alerts are visible.
Pull Request Checklist