-
Notifications
You must be signed in to change notification settings - Fork 661
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
Improvement of tenant deletion #1882
Conversation
@@ -727,4 +729,21 @@ public boolean accept(File userStores, String name) { | |||
private void clearTenantCache(int tenantId) { | |||
tenantCacheManager.clearCacheEntry(new TenantIdKey(tenantId)); | |||
} | |||
|
|||
private void deleteCachemanager(String tenantDomain, int tenantId) { |
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.
better name would be "clearCacheManager" or "purgeCacheManager"
|
||
Caching.getCacheManagerFactory().close(); | ||
} catch (Exception e) { | ||
log.error("Unable to delete cache for tenant :"+tenantDomain); |
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.
log.error("Unable to delete cache for tenant :"+tenantDomain, e);
Prints the stacktrace upon error, so that finding root cause is easy.
} finally { | ||
PrivilegedCarbonContext.endTenantFlow(); | ||
} | ||
|
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.
No need of this empty lines.
deleteCacheManager method name changed as clearCachemanager
Cleared empty lines
* @param tenantDomain tenant domain | ||
* @param tenantId tenant id | ||
*/ | ||
private void clearCachemanager(String tenantDomain, int tenantId) { |
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.
naming has to be "clearCacheManager"
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.
Changed.
This is already fixed in another PR. |
Purpose
When we delete a tenant(with existing methods) we didn't delete the caches and the entry in globalCacheManagerMap. So when ever we try to create a new tenant with same domain name it checks with map and instead of creating new cache managers it returns existing entry value which owns by previous tenant. This cause the error mentioned in issue given below.
Goals
Fix for the Issue :- Security exception occurred when try to create a tenant with deleted tenant's domain name
Approach
While deleting a tenant delete
Documentation
Tenant Deletion Doc