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-6387. [Multi-Tenant] Refactor OMMultiTenantManager and OMTenantRequestHelper #3264

Merged
merged 6 commits into from Apr 13, 2022

Conversation

aswinshakil
Copy link
Member

What changes were proposed in this pull request?

  1. Removed unused and unimplemented methods OMMultitenantManager interface.
  2. Moved functions from OMTenantRequestHelper and combined it with OMMultitenantManagerImpl
  3. Removed duplicated function.

What is the link to the Apache JIRA

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

How was this patch tested?

Tested using CI tests.

@errose28 errose28 self-requested a review April 1, 2022 18:27
@aswinshakil aswinshakil requested a review from smengcl April 4, 2022 19:07
Copy link
Contributor

@errose28 errose28 left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @aswinshakil. Mostly LGTM with some minor comments in line.

Copy link
Contributor

@errose28 errose28 left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @aswinshakil. Just some minor things about the new isEmpty check otherwise this looks good to me.

// This helper function is a placeholder for the isTenantEmpty check,
// once tenantCache/Ranger is fixed this will be removed.
if (tenantCache.containsKey(tenantId) &&
!tenantCache.get(tenantId).isTenantEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The tenantCache is supposed to have all the user data for each tenant. I don't think we need to iterate the DB as well. If the tenant is not in the cache, we can throw an IOException like listUsersInTenant does, since this would indicate a bug in our OM code.

Copy link
Member Author

Choose a reason for hiding this comment

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

The caller of isTenantEmpty already throws an OMException when we return false. Should we explicitly throw an IOException here as well? cc: @errose28

Copy link
Contributor

Choose a reason for hiding this comment

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

I think so, because they are two different errors. If this method returns false and the caller throws OMException, it is because the client tried to delete a non-empty tenant. If this method is called with a tenant that does not exist, there is a bug in our code and neither the true or false responses make sense.

This assumes the caller already checked the validity of the tenant it got from the client though. If this method is expected to do that as well, we can through an OMException with TENANT_NOT_FOUND return code from this method instead.

@smengcl smengcl changed the title HDDS-6387.[Multi-Tenant] Refactor OMMultiTenantManager and OMTenantRequestHelper HDDS-6387. [Multi-Tenant] Refactor OMMultiTenantManager and OMTenantRequestHelper Apr 12, 2022
Copy link
Contributor

@errose28 errose28 left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @aswinshakil LGTM.

@errose28 errose28 merged commit d621c82 into apache:HDDS-4944 Apr 13, 2022
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