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

[idbroker] Refactor IDBroker with improved HA support and giving more preference to RAZ when both are configured in Hue #3626

Merged
merged 5 commits into from
Mar 7, 2024

Conversation

Harshg999
Copy link
Collaborator

@Harshg999 Harshg999 commented Feb 20, 2024

What changes were proposed in this pull request?

  • Refactor IDBroker support and give more preference to RAZ when both are configured in Hue.
  • Improved IDBroker HA code section to switchover to healthy instance correctly and not depend only on the first one for every scenario. This should improve Hue page loading performance also.

How was this patch tested?

  • Tested manually in a live E2E setup with RAZ enabled to check for no regressions + correct IDBroker switchover + improved Hue page load time.
  • Update existing unit tests.
  • Adding new unit tests for IDBroker HA.

@Harshg999 Harshg999 changed the title [idbroker] Improve IDBroker HA [DO_NOT_MERGE][idbroker] Improve IDBroker HA Feb 20, 2024
@quadoss
Copy link
Collaborator

quadoss commented Feb 20, 2024

@Harshg999 , what is the numbering 42,50,52 is there a specific need to add the in the debug statements? The rest looks fine but there seem to be failures with LOG.debug. Please check and fix it.

@Harshg999
Copy link
Collaborator Author

This was more for code patching in the repro cluster to check what is the root cause for Hue's dependence on IDBroker in RAZ enabled env. I still have to test out this live.

@Harshg999 Harshg999 force-pushed the idbroker-check branch 3 times, most recently from 32fa5dd to 1c6c54b Compare March 1, 2024 15:32
@Harshg999 Harshg999 changed the title [DO_NOT_MERGE][idbroker] Improve IDBroker HA [idbroker] Improve HA support and give preference to RAZ when IDBroker configs are also present Mar 5, 2024
@Harshg999 Harshg999 changed the title [idbroker] Improve HA support and give preference to RAZ when IDBroker configs are also present [idbroker] Improve HA support and give priority to RAZ when IDBroker configs are also present Mar 5, 2024
@Harshg999 Harshg999 self-assigned this Mar 5, 2024
@Harshg999 Harshg999 changed the title [idbroker] Improve HA support and give priority to RAZ when IDBroker configs are also present [idbroker] Refactor IDBroker with improved HA support and giving more preference to RAZ when both are configured in Hue Mar 6, 2024
Copy link
Contributor

@JohanAhlen JohanAhlen left a comment

Choose a reason for hiding this comment

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

Nice and clean! And glad to see good tests! :-)

@@ -89,7 +82,12 @@ def get_cab_password(fs=None):
def is_idbroker_enabled(fs=None):
from desktop.conf import RAZ # Must be imported dynamically in order to have proper value

return get_cab_address(fs) is not None and not RAZ.IS_ENABLED.get() # Skipping IDBroker for FS when RAZ is present
fs = validate_fs(fs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

so when you are checking the validation of filesystems here it will only give warning in logs but looks like we need to implement like ?
idbroker_addr_from_coresite = get_conf().get(_CNF_CAB_ADDRESS % fs) if fs else None

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For fs = None scenario, validate_fs(fs) will also return None
And then it will try to find the respective config value in this line: idbroker_addr_from_coresite = get_conf().get(_CNF_CAB_ADDRESS % fs)

So get_conf().get('fs.None.ext.cab.address') will also return None because there is no such config.

@Harshg999 Harshg999 enabled auto-merge (squash) March 6, 2024 18:25
try:
response = requests.get(idb.rstrip('/') + '/dt/knoxtoken/api/v1/token', auth=HTTPKerberosAuth(), verify=False)
except Exception as e:
if 'Failed to establish a new connection' in str(e):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we not handle Name or service not known as this could be a different one with failed to establish the connection. Adding this information should also help

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I logged the response for both failure cases: When the whole host was down from AWS console and when the IDBroker instances were down from Data Lake CM.

In both cases, I didn't see Name or service not known string in response but Failed to establish a new connection was present both times.

I think because of the former only old implementation was not working as expected and then I thought that why even check for it when its flaky and only depend on the stuff which was coming in response both times? I used Failed to establish a new connection in implementing other service HA also like Knox JWT and RAZ recently.

What do you think?

Copy link
Collaborator

@agl29 agl29 left a comment

Choose a reason for hiding this comment

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

LGTM!

@Harshg999 Harshg999 merged commit 0e711ea into master Mar 7, 2024
4 checks passed
@Harshg999 Harshg999 deleted the idbroker-check branch March 7, 2024 11:27
athithyaaselvam pushed a commit that referenced this pull request Jun 10, 2024
… giving more preference to RAZ when both are configured in Hue (#3626)

What changes were proposed in this pull request?

- Refactor IDBroker support and give more preference to RAZ when both are configured in Hue.
- Improved IDBroker HA code section to switchover to healthy instance correctly and not depend only on the first one for every scenario. This should improve Hue page loading performance also.

How was this patch tested?

- Tested manually in a live E2E setup with RAZ enabled to check for no regressions + correct IDBroker switchover + improved Hue page load time.
- Update existing unit tests.
- Adding new unit tests for IDBroker HA.

(cherry picked from commit 0e711ea)
(cherry picked from commit 1a25a14f62f0433d79dff251beed75ca148dc2e7)
Change-Id: I1abf2a61823ccb9a87161df51d2b2e0afae266bd
(cherry picked from commit 2233672201dc74401b21971079b2c0872e9d75cf)
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