Skip to content

HDDS-4876. [SCM HA Security] Add failover proxy to SCM Security Server Protocol#1978

Merged
bharatviswa504 merged 9 commits intoapache:HDDS-2823from
bharatviswa504:HDDS-4876
Mar 9, 2021
Merged

HDDS-4876. [SCM HA Security] Add failover proxy to SCM Security Server Protocol#1978
bharatviswa504 merged 9 commits intoapache:HDDS-2823from
bharatviswa504:HDDS-4876

Conversation

@bharatviswa504
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Implement failover proxy provider for SCM Security Server Protocol.

What is the link to the Apache JIRA

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

How was this patch tested?

Updated few tests and also existing tests should cover. (For HA, later tests will be added end to end)

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.

@bharatviswa504 , what will happen if SCM HA mode is disabled and no serviced id or node ids are defined.?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

buildNodeInfo() takes care of HA/non-HA config, and returns scmNodeInfo.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When serviceId and nodeId are not defined, we use some const values and make the proxy failover work for HA/non-HA.

Copy link
Copy Markdown
Contributor

@bshashikant bshashikant left a comment

Choose a reason for hiding this comment

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

Looks good with minor change.

Comment thread hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/HAUtils.java Outdated
Copy link
Copy Markdown
Contributor

@xiaoyuyao xiaoyuyao left a comment

Choose a reason for hiding this comment

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

Thanks @bharatviswa504 for working on this. The changes LGTM overall, a few comments added inline.

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.

NIT: can you change message to cause and the type to Throwable?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

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.

Do we have a separate configuration for serviceId? If yes, we should assert the one from nodeinfo match with the smcServiceId from config instead of rewriting it each time a new node is loaded.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, we have a separate config for service id.
BuildNodeInfo got the list of ScmNodeInfo for a single scm serviceId, so all scmNodeInfo will have same scmServiceID.

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.

Do we handle failover with leader hints in addition to RR failover?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Currently in SCM we don't have leader hints, Added a TODO for this.

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.

Synchronized on the method for thread safe proxy creation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

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.

can we go through the proxy map, call stopProxy and null the value in the map?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

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.

The same util exists in OmUtils, can we dedup the code with one copy?

Copy link
Copy Markdown
Contributor Author

@bharatviswa504 bharatviswa504 Mar 9, 2021

Choose a reason for hiding this comment

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

It has additional InvalidToken, for that OM has special logic, where it retries all 3 OMs atleast once. So, added a new method.
When SCM also has similar logic for TokenInvalid we can have a single copy of this method.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

should we switch the order of 129-130, and 123-128 so that the exception message from the cause can be preserved in scmSecurityResponse.message?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@bharatviswa504
Copy link
Copy Markdown
Contributor Author

Thank You @xiaoyuyao for the review addressed/replied to review comments.

@xiaoyuyao
Copy link
Copy Markdown
Contributor

Thanks @bharatviswa504 for the update. LGTM, +1.

@bharatviswa504 bharatviswa504 merged commit 20b8bca into apache:HDDS-2823 Mar 9, 2021
@bharatviswa504
Copy link
Copy Markdown
Contributor Author

Thank You @xiaoyuyao and @bshashikant for the review.

mukul1987 pushed a commit to mukul1987/hadoop-ozone that referenced this pull request Mar 12, 2021
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.

3 participants