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

HDDS-3500. Hide OMFailoverProxyProvider usage behind an interface #900

Closed
wants to merge 35 commits into from

Conversation

elek
Copy link
Member

@elek elek commented May 6, 2020

What changes were proposed in this pull request?

OzoneManagerProtocolClientSideTranslatorPB uses OmFailoverProxyProvider to access OM HA, but this class is not supported in Hadoop 2.x environment.

It would be better to

  1. separated ProtocolClientSideTranslator from the transport layer logic
  2. Remove implementation specific method from the OzoneManagerProtocol (getOMFailoverProxyProvider should be removed)
  3. Use a simple OMTransport interface to handle all the connection logic in one, isolated place

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-3500

How was this patch tested?

With my own form

@elek
Copy link
Member Author

elek commented May 14, 2020

@bharatviswa504 Can you please help me the review?

@adoroszlai adoroszlai self-requested a review May 18, 2020 19:30
Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @elek for working on this. The change LGTM. Tested by (currently disabled) OM HA acceptance test (after fixing the Dockerfile for HDDS-3618):

$ cd hadoop-ozone/dist/target/ozone-0.6.0-SNAPSHOT/compose/ozone-om-ha
$ ./test_disabled.sh
...
ozone-om-ha-testOMHA :: Smoketest ozone cluster startup
==============================================================================
Stop Leader OM and Verify Failover                                    | PASS |
------------------------------------------------------------------------------
Test Multiple Failovers                                               | PASS |
------------------------------------------------------------------------------
Restart OM and Verify Ratis Logs                                      | PASS |
------------------------------------------------------------------------------
ozone-om-ha-testOMHA :: Smoketest ozone cluster startup               | PASS |
3 critical tests, 3 passed, 0 failed
3 tests total, 3 passed, 0 failed

@bharatviswa504
Copy link
Contributor

@bharatviswa504 Can you please help me the review?

@elek I will take a look at it today.
I have not completed my review, looked at a high level.

Copy link
Contributor

@bharatviswa504 bharatviswa504 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 @elek for the contribution and now code looks cleaner with separation.
Overall LGTM, I have a few minor comments.

static OmTransportFactory createFactory() throws IOException {
ServiceLoader<OmTransportFactory> transportFactoryServiceLoader =
ServiceLoader.load(OmTransportFactory.class);
Iterator<OmTransportFactory> iterator =
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: We have not added any file with name org.apache.hadoop.ozone.om.protocolPB.OmTransportFactory in meta-inf/services. Then why we need this serviceLoader.

And just by creating the file named org.apache.hadoop.ozone.om.protocolPB.OmTransportFactory with content org.apache.hadoop.ozone.om.protocolPB.Hadoop3OmTransport. We don't need line 50:61 code right?

Not sure if I am missing something here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. This is because we need a default and an option to choose a different implementation.

If we create a service file for the default transport factory (Hadoop3OmTransportFactory) than it would be hard to override it. In case of the Hadoop2 client we would have two different implementation defined without an easy way to choose between them.

With this approach the default is always defined by line 50:61 but you have the option to define your own version.

Copy link
Contributor

Choose a reason for hiding this comment

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

Question: what is alternative way other then having meta-inf/services to load class for OmTransportFactory?

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently there is no alternative way. I couldn't see any usage for any other approach, but if you see any use case, I am open to implement it. Let's create a new issue if you see some interesting direction...

Copy link
Contributor

Choose a reason for hiding this comment

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

Then I am confused, what is the purpose of the code?
Because I think meta-inf/services is packaged along with jar right?

@elek
Copy link
Member Author

elek commented May 21, 2020

Thanks the review and the suggestions @bharatviswa504, I addressed all the comments and pushed the improved version.

@bharatviswa504
Copy link
Contributor

I have one question, other than that it LGTM.

@elek
Copy link
Member Author

elek commented May 27, 2020

Thanks the review @bharatviswa504 and @adoroszlai

I am pushing it now.

@bharatviswa504 If you think we need to improve the pluggability, let's continue this work and create new issues...

@elek elek closed this in 734862e May 27, 2020
@bharatviswa504
Copy link
Contributor

I have a question, and posted my comments to the discussion.

@elek
Copy link
Member Author

elek commented Jun 2, 2020

@bharatviswa504 Please check #992 about the usage of META-INF/service. We can further improve in there, if you have any specific suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants