Cloud Tenant deletion caching issue

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Cloud Tenant deletion caching issue

Godwin Shrimal
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Nirmal Fernando-3
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Godwin Shrimal
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <[hidden email]> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Nirmal Fernando-3
I think that should be ok. @Johann wdyt?


On Fri, Sep 5, 2014 at 8:23 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <[hidden email]> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Selvaratnam Uthaiyashankar-2
Even if we have public method, how will it work in a clustered environment? For example, delete request is sent to Node1, (and lets say one way or the other we delete the entry from map on Node1), and create request is sent to Node 2 (which still has the entry in the map). Are we going to use cluster messages to clear the entry from all nodes? 

On Friday, September 5, 2014, Nirmal Fernando <[hidden email]> wrote:
I think that should be ok. @Johann wdyt?


On Fri, Sep 5, 2014 at 8:23 PM, Godwin Amila Shrimal <<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;godwin@wso2.com&#39;);" target="_blank">godwin@...> wrote:
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;nirmal@wso2.com&#39;);" target="_blank">nirmal@...> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;godwin@wso2.com&#39;);" target="_blank">godwin@...> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;Architecture@wso2.org&#39;);" target="_blank">Architecture@...
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;Architecture@wso2.org&#39;);" target="_blank">Architecture@...
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;Architecture@wso2.org&#39;);" target="_blank">Architecture@...
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/




--
S.Uthaiyashankar
VP Engineering
WSO2 Inc.
http://wso2.com/ - "lean . enterprise . middleware"

Phone: +94 714897591


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Nirmal Fernando-3
Shouldn't this tenant event listener be triggered in all the nodes in the cluster? If not, I think we might need to fix it.


On Sat, Sep 6, 2014 at 10:00 AM, Selvaratnam Uthaiyashankar <[hidden email]> wrote:
Even if we have public method, how will it work in a clustered environment? For example, delete request is sent to Node1, (and lets say one way or the other we delete the entry from map on Node1), and create request is sent to Node 2 (which still has the entry in the map). Are we going to use cluster messages to clear the entry from all nodes? 


On Friday, September 5, 2014, Nirmal Fernando <[hidden email]> wrote:
I think that should be ok. @Johann wdyt?


On Fri, Sep 5, 2014 at 8:23 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <[hidden email]> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/




--
S.Uthaiyashankar
VP Engineering
WSO2 Inc.
http://wso2.com/ - "lean . enterprise . middleware"

Phone: <a href="tel:%2B94%20714897591" value="+94714897591" target="_blank">+94 714897591


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Danushka Fernando
Hi 
To the first most problem raised by Goodwin, AFAIU when you call tenant deletion you call deleteTenant in TenantManager. So why cant you clear the tenant from the map in JDBCTenantManger's deleteTenant method?

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : +94716332729


On Sat, Sep 6, 2014 at 8:20 PM, Nirmal Fernando <[hidden email]> wrote:
Shouldn't this tenant event listener be triggered in all the nodes in the cluster? If not, I think we might need to fix it.


On Sat, Sep 6, 2014 at 10:00 AM, Selvaratnam Uthaiyashankar <[hidden email]> wrote:
Even if we have public method, how will it work in a clustered environment? For example, delete request is sent to Node1, (and lets say one way or the other we delete the entry from map on Node1), and create request is sent to Node 2 (which still has the entry in the map). Are we going to use cluster messages to clear the entry from all nodes? 


On Friday, September 5, 2014, Nirmal Fernando <[hidden email]> wrote:
I think that should be ok. @Johann wdyt?


On Fri, Sep 5, 2014 at 8:23 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <[hidden email]> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/




--
S.Uthaiyashankar
VP Engineering
WSO2 Inc.
http://wso2.com/ - "lean . enterprise . middleware"

Phone: <a href="tel:%2B94%20714897591" value="+94714897591" target="_blank">+94 714897591


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Johann Nallathamby



On Sun, Sep 7, 2014 at 6:29 PM, Danushka Fernando <[hidden email]> wrote:
Hi 
To the first most problem raised by Goodwin, AFAIU when you call tenant deletion you call deleteTenant in TenantManager. So why cant you clear the tenant from the map in JDBCTenantManger's deleteTenant method?

Yes. Should be able to do that. But as Shankar explained we need to send cluster messages to do the same in all the nodes.

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729


On Sat, Sep 6, 2014 at 8:20 PM, Nirmal Fernando <[hidden email]> wrote:
Shouldn't this tenant event listener be triggered in all the nodes in the cluster? If not, I think we might need to fix it.


On Sat, Sep 6, 2014 at 10:00 AM, Selvaratnam Uthaiyashankar <[hidden email]> wrote:
Even if we have public method, how will it work in a clustered environment? For example, delete request is sent to Node1, (and lets say one way or the other we delete the entry from map on Node1), and create request is sent to Node 2 (which still has the entry in the map). Are we going to use cluster messages to clear the entry from all nodes? 


On Friday, September 5, 2014, Nirmal Fernando <[hidden email]> wrote:
I think that should be ok. @Johann wdyt?


On Fri, Sep 5, 2014 at 8:23 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <[hidden email]> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/




--
S.Uthaiyashankar
VP Engineering
WSO2 Inc.
http://wso2.com/ - "lean . enterprise . middleware"

Phone: <a href="tel:%2B94%20714897591" value="+94714897591" target="_blank">+94 714897591


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Thanks & Regards,

Johann Dilantha Nallathamby
Associate Technical Lead & Product Lead of WSO2 Identity Server
Integration Technologies Team
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94777776950

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Danushka Fernando
Hi

On Sun, Sep 7, 2014 at 6:59 PM, Johann Nallathamby <[hidden email]> wrote:



On Sun, Sep 7, 2014 at 6:29 PM, Danushka Fernando <[hidden email]> wrote:
Hi 
To the first most problem raised by Goodwin, AFAIU when you call tenant deletion you call deleteTenant in TenantManager. So why cant you clear the tenant from the map in JDBCTenantManger's deleteTenant method?

Yes. Should be able to do that. But as Shankar explained we need to send cluster messages to do the same in all the nodes.
Yes I also agree to that point. +1. 

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729


On Sat, Sep 6, 2014 at 8:20 PM, Nirmal Fernando <[hidden email]> wrote:
Shouldn't this tenant event listener be triggered in all the nodes in the cluster? If not, I think we might need to fix it.


On Sat, Sep 6, 2014 at 10:00 AM, Selvaratnam Uthaiyashankar <[hidden email]> wrote:
Even if we have public method, how will it work in a clustered environment? For example, delete request is sent to Node1, (and lets say one way or the other we delete the entry from map on Node1), and create request is sent to Node 2 (which still has the entry in the map). Are we going to use cluster messages to clear the entry from all nodes? 


On Friday, September 5, 2014, Nirmal Fernando <[hidden email]> wrote:
I think that should be ok. @Johann wdyt?


On Fri, Sep 5, 2014 at 8:23 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <[hidden email]> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/




--
S.Uthaiyashankar
VP Engineering
WSO2 Inc.
http://wso2.com/ - "lean . enterprise . middleware"

Phone: <a href="tel:%2B94%20714897591" value="+94714897591" target="_blank">+94 714897591


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Thanks & Regards,

Johann Dilantha Nallathamby
Associate Technical Lead & Product Lead of WSO2 Identity Server
Integration Technologies Team
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94777776950

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : +94716332729

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Godwin Shrimal
Hi All,

Thanks for the valuable responses, As I understood we have to use cluster messages(Which I need to study more) to delete the map entry in each nodes in clustered environment
@Danushka: Yes we can use the existing deleteTenant method in JDBCTenantManger.

Thanks
Godwin


On Sun, Sep 7, 2014 at 9:59 PM, Danushka Fernando <[hidden email]> wrote:
Hi

On Sun, Sep 7, 2014 at 6:59 PM, Johann Nallathamby <[hidden email]> wrote:



On Sun, Sep 7, 2014 at 6:29 PM, Danushka Fernando <[hidden email]> wrote:
Hi 
To the first most problem raised by Goodwin, AFAIU when you call tenant deletion you call deleteTenant in TenantManager. So why cant you clear the tenant from the map in JDBCTenantManger's deleteTenant method?

Yes. Should be able to do that. But as Shankar explained we need to send cluster messages to do the same in all the nodes.
Yes I also agree to that point. +1. 

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729


On Sat, Sep 6, 2014 at 8:20 PM, Nirmal Fernando <[hidden email]> wrote:
Shouldn't this tenant event listener be triggered in all the nodes in the cluster? If not, I think we might need to fix it.


On Sat, Sep 6, 2014 at 10:00 AM, Selvaratnam Uthaiyashankar <[hidden email]> wrote:
Even if we have public method, how will it work in a clustered environment? For example, delete request is sent to Node1, (and lets say one way or the other we delete the entry from map on Node1), and create request is sent to Node 2 (which still has the entry in the map). Are we going to use cluster messages to clear the entry from all nodes? 


On Friday, September 5, 2014, Nirmal Fernando <[hidden email]> wrote:
I think that should be ok. @Johann wdyt?


On Fri, Sep 5, 2014 at 8:23 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <[hidden email]> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/




--
S.Uthaiyashankar
VP Engineering
WSO2 Inc.
http://wso2.com/ - "lean . enterprise . middleware"

Phone: <a href="tel:%2B94%20714897591" value="+94714897591" target="_blank">+94 714897591


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Thanks & Regards,

Johann Dilantha Nallathamby
Associate Technical Lead & Product Lead of WSO2 Identity Server
Integration Technologies Team
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94777776950

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Godwin Shrimal
Hi.

We had a discussion about cleaning cache data (delete map entry in JDBCTenantManger), As per the discussion, we have to use cluster message to notify all the nodes in the clustered environment to delete the map entry.  Then we have to give a public method in JDBCTenantManger to delete the entry which is accessible from the execute method of the cluster message.

listed below the summary of the implementation.

1. Create a new public method in JDBCTenantManger to delete the map entry.
2. Create a new class which extends ClusteringMessage and implements Serializable. 
3. Implement the execute method on above class to perform the delete map entry method inside the JDBCTenantManger.
4. When execute the deleteTenant method in TenantMgtAdminService, create a object from new Cluster Message class created in #2 and set the tenantId as a property and send to all nodes in the cluster.
5. Nodes will receive the above message, deserialize it and perform the execute method of the cluster message, which will delete the map entry in each nodes.


Please give a feedback on this.


Thanks
Godwin















On Mon, Sep 8, 2014 at 10:07 AM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi All,

Thanks for the valuable responses, As I understood we have to use cluster messages(Which I need to study more) to delete the map entry in each nodes in clustered environment
@Danushka: Yes we can use the existing deleteTenant method in JDBCTenantManger.

Thanks
Godwin


On Sun, Sep 7, 2014 at 9:59 PM, Danushka Fernando <[hidden email]> wrote:
Hi

On Sun, Sep 7, 2014 at 6:59 PM, Johann Nallathamby <[hidden email]> wrote:



On Sun, Sep 7, 2014 at 6:29 PM, Danushka Fernando <[hidden email]> wrote:
Hi 
To the first most problem raised by Goodwin, AFAIU when you call tenant deletion you call deleteTenant in TenantManager. So why cant you clear the tenant from the map in JDBCTenantManger's deleteTenant method?

Yes. Should be able to do that. But as Shankar explained we need to send cluster messages to do the same in all the nodes.
Yes I also agree to that point. +1. 

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729


On Sat, Sep 6, 2014 at 8:20 PM, Nirmal Fernando <[hidden email]> wrote:
Shouldn't this tenant event listener be triggered in all the nodes in the cluster? If not, I think we might need to fix it.


On Sat, Sep 6, 2014 at 10:00 AM, Selvaratnam Uthaiyashankar <[hidden email]> wrote:
Even if we have public method, how will it work in a clustered environment? For example, delete request is sent to Node1, (and lets say one way or the other we delete the entry from map on Node1), and create request is sent to Node 2 (which still has the entry in the map). Are we going to use cluster messages to clear the entry from all nodes? 


On Friday, September 5, 2014, Nirmal Fernando <[hidden email]> wrote:
I think that should be ok. @Johann wdyt?


On Fri, Sep 5, 2014 at 8:23 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <[hidden email]> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/




--
S.Uthaiyashankar
VP Engineering
WSO2 Inc.
http://wso2.com/ - "lean . enterprise . middleware"

Phone: <a href="tel:%2B94%20714897591" value="+94714897591" target="_blank">+94 714897591


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Thanks & Regards,

Johann Dilantha Nallathamby
Associate Technical Lead & Product Lead of WSO2 Identity Server
Integration Technologies Team
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94777776950

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Amila Maha Arachchi
+1

I remember there were two maps or a bidi-map. i.e. It was tracking both tenant ID and tenant domain. Make sure both issues are addressed (if my concern is valid).

On Tue, Sep 9, 2014 at 3:37 AM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi.

We had a discussion about cleaning cache data (delete map entry in JDBCTenantManger), As per the discussion, we have to use cluster message to notify all the nodes in the clustered environment to delete the map entry.  Then we have to give a public method in JDBCTenantManger to delete the entry which is accessible from the execute method of the cluster message.

listed below the summary of the implementation.

1. Create a new public method in JDBCTenantManger to delete the map entry.
2. Create a new class which extends ClusteringMessage and implements Serializable. 
3. Implement the execute method on above class to perform the delete map entry method inside the JDBCTenantManger.
4. When execute the deleteTenant method in TenantMgtAdminService, create a object from new Cluster Message class created in #2 and set the tenantId as a property and send to all nodes in the cluster.
5. Nodes will receive the above message, deserialize it and perform the execute method of the cluster message, which will delete the map entry in each nodes.


Please give a feedback on this.


Thanks
Godwin















On Mon, Sep 8, 2014 at 10:07 AM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi All,

Thanks for the valuable responses, As I understood we have to use cluster messages(Which I need to study more) to delete the map entry in each nodes in clustered environment
@Danushka: Yes we can use the existing deleteTenant method in JDBCTenantManger.

Thanks
Godwin


On Sun, Sep 7, 2014 at 9:59 PM, Danushka Fernando <[hidden email]> wrote:
Hi

On Sun, Sep 7, 2014 at 6:59 PM, Johann Nallathamby <[hidden email]> wrote:



On Sun, Sep 7, 2014 at 6:29 PM, Danushka Fernando <[hidden email]> wrote:
Hi 
To the first most problem raised by Goodwin, AFAIU when you call tenant deletion you call deleteTenant in TenantManager. So why cant you clear the tenant from the map in JDBCTenantManger's deleteTenant method?

Yes. Should be able to do that. But as Shankar explained we need to send cluster messages to do the same in all the nodes.
Yes I also agree to that point. +1. 

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729


On Sat, Sep 6, 2014 at 8:20 PM, Nirmal Fernando <[hidden email]> wrote:
Shouldn't this tenant event listener be triggered in all the nodes in the cluster? If not, I think we might need to fix it.


On Sat, Sep 6, 2014 at 10:00 AM, Selvaratnam Uthaiyashankar <[hidden email]> wrote:
Even if we have public method, how will it work in a clustered environment? For example, delete request is sent to Node1, (and lets say one way or the other we delete the entry from map on Node1), and create request is sent to Node 2 (which still has the entry in the map). Are we going to use cluster messages to clear the entry from all nodes? 


On Friday, September 5, 2014, Nirmal Fernando <[hidden email]> wrote:
I think that should be ok. @Johann wdyt?


On Fri, Sep 5, 2014 at 8:23 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <[hidden email]> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/




--
S.Uthaiyashankar
VP Engineering
WSO2 Inc.
http://wso2.com/ - "lean . enterprise . middleware"

Phone: <a href="tel:%2B94%20714897591" value="+94714897591" target="_blank">+94 714897591


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Thanks & Regards,

Johann Dilantha Nallathamby
Associate Technical Lead & Product Lead of WSO2 Identity Server
Integration Technologies Team
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94777776950

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Amila Maharachchi
Senior Technical Lead
WSO2, Inc.; http://wso2.com

Blog: http://maharachchi.blogspot.com
Mobile: +94719371446


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Godwin Shrimal
Yes, there are two maps as tenantDomainIdMap and tenantIdDomainMap. we'll address both.



On Tue, Sep 9, 2014 at 5:23 PM, Amila Maha Arachchi <[hidden email]> wrote:
+1

I remember there were two maps or a bidi-map. i.e. It was tracking both tenant ID and tenant domain. Make sure both issues are addressed (if my concern is valid).

On Tue, Sep 9, 2014 at 3:37 AM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi.

We had a discussion about cleaning cache data (delete map entry in JDBCTenantManger), As per the discussion, we have to use cluster message to notify all the nodes in the clustered environment to delete the map entry.  Then we have to give a public method in JDBCTenantManger to delete the entry which is accessible from the execute method of the cluster message.

listed below the summary of the implementation.

1. Create a new public method in JDBCTenantManger to delete the map entry.
2. Create a new class which extends ClusteringMessage and implements Serializable. 
3. Implement the execute method on above class to perform the delete map entry method inside the JDBCTenantManger.
4. When execute the deleteTenant method in TenantMgtAdminService, create a object from new Cluster Message class created in #2 and set the tenantId as a property and send to all nodes in the cluster.
5. Nodes will receive the above message, deserialize it and perform the execute method of the cluster message, which will delete the map entry in each nodes.


Please give a feedback on this.


Thanks
Godwin















On Mon, Sep 8, 2014 at 10:07 AM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi All,

Thanks for the valuable responses, As I understood we have to use cluster messages(Which I need to study more) to delete the map entry in each nodes in clustered environment
@Danushka: Yes we can use the existing deleteTenant method in JDBCTenantManger.

Thanks
Godwin


On Sun, Sep 7, 2014 at 9:59 PM, Danushka Fernando <[hidden email]> wrote:
Hi

On Sun, Sep 7, 2014 at 6:59 PM, Johann Nallathamby <[hidden email]> wrote:



On Sun, Sep 7, 2014 at 6:29 PM, Danushka Fernando <[hidden email]> wrote:
Hi 
To the first most problem raised by Goodwin, AFAIU when you call tenant deletion you call deleteTenant in TenantManager. So why cant you clear the tenant from the map in JDBCTenantManger's deleteTenant method?

Yes. Should be able to do that. But as Shankar explained we need to send cluster messages to do the same in all the nodes.
Yes I also agree to that point. +1. 

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729


On Sat, Sep 6, 2014 at 8:20 PM, Nirmal Fernando <[hidden email]> wrote:
Shouldn't this tenant event listener be triggered in all the nodes in the cluster? If not, I think we might need to fix it.


On Sat, Sep 6, 2014 at 10:00 AM, Selvaratnam Uthaiyashankar <[hidden email]> wrote:
Even if we have public method, how will it work in a clustered environment? For example, delete request is sent to Node1, (and lets say one way or the other we delete the entry from map on Node1), and create request is sent to Node 2 (which still has the entry in the map). Are we going to use cluster messages to clear the entry from all nodes? 


On Friday, September 5, 2014, Nirmal Fernando <[hidden email]> wrote:
I think that should be ok. @Johann wdyt?


On Fri, Sep 5, 2014 at 8:23 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <[hidden email]> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/




--
S.Uthaiyashankar
VP Engineering
WSO2 Inc.
http://wso2.com/ - "lean . enterprise . middleware"

Phone: <a href="tel:%2B94%20714897591" value="+94714897591" target="_blank">+94 714897591


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Thanks & Regards,

Johann Dilantha Nallathamby
Associate Technical Lead & Product Lead of WSO2 Identity Server
Integration Technologies Team
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94777776950

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Amila Maharachchi
Senior Technical Lead
WSO2, Inc.; http://wso2.com

Blog: http://maharachchi.blogspot.com
Mobile: <a href="tel:%2B94719371446" value="+94719371446" target="_blank">+94719371446




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Godwin Shrimal
Hi,

As per the discussion had with Azeez offline please see below the solution agreed.

1. Add a new overload method to TenantManager as void deleteTenant(int tenantId, boolean removeFromPersistentStorage) throws UserStoreException;

2. Implement this method in JDBCTenantManager class which use to delete only the map entry and execute in each worker nodes by calling from Cluster message.

3. Modify existing deleteTenant(int tenantId) to delete the persistent  storage which is calling in management node.

Please see below modified code snippet in JDBCTenantManager


         @Override
    public void deleteTenant(int tenantId) throws UserStoreException {
        try {
            deleteTenant(tenantId, true);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UserStoreException(e);
        }
    }

    @Override
    public void deleteTenant(int tenantId, boolean removeFromPersistentStorage)
            throws org.wso2.carbon.user.api.UserStoreException {
        // Remove tenant information from the cache.
        String tenantDomain = (String) tenantIdDomainMap.remove(tenantId);
        tenantDomainIdMap.remove(tenantDomain);

        tenantCacheManager.clearCacheEntry(new TenantIdKey(tenantId));

        if (removeFromPersistentStorage) {
            Connection dbConnection = null;
            PreparedStatement prepStmt = null;
            try {
                dbConnection = getDBConnection();
                String sqlStmt = TenantConstants.DELETE_TENANT_SQL;
                prepStmt = dbConnection.prepareStatement(sqlStmt);
                prepStmt.setInt(1, tenantId);

                prepStmt.executeUpdate();
                dbConnection.commit();
            } catch (SQLException e) {
                DatabaseUtil.rollBack(dbConnection);
                String msg = "Error in deleting the tenant with " + "tenant id: "
                        + tenantId + ".";
                log.error(msg, e);
                throw new UserStoreException(msg, e);
            } finally {
                DatabaseUtil.closeAllConnections(dbConnection,prepStmt);
            }
        }
    }



Thanks
Godwin




On Tue, Sep 9, 2014 at 6:04 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Yes, there are two maps as tenantDomainIdMap and tenantIdDomainMap. we'll address both.



On Tue, Sep 9, 2014 at 5:23 PM, Amila Maha Arachchi <[hidden email]> wrote:
+1

I remember there were two maps or a bidi-map. i.e. It was tracking both tenant ID and tenant domain. Make sure both issues are addressed (if my concern is valid).

On Tue, Sep 9, 2014 at 3:37 AM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi.

We had a discussion about cleaning cache data (delete map entry in JDBCTenantManger), As per the discussion, we have to use cluster message to notify all the nodes in the clustered environment to delete the map entry.  Then we have to give a public method in JDBCTenantManger to delete the entry which is accessible from the execute method of the cluster message.

listed below the summary of the implementation.

1. Create a new public method in JDBCTenantManger to delete the map entry.
2. Create a new class which extends ClusteringMessage and implements Serializable. 
3. Implement the execute method on above class to perform the delete map entry method inside the JDBCTenantManger.
4. When execute the deleteTenant method in TenantMgtAdminService, create a object from new Cluster Message class created in #2 and set the tenantId as a property and send to all nodes in the cluster.
5. Nodes will receive the above message, deserialize it and perform the execute method of the cluster message, which will delete the map entry in each nodes.


Please give a feedback on this.


Thanks
Godwin















On Mon, Sep 8, 2014 at 10:07 AM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi All,

Thanks for the valuable responses, As I understood we have to use cluster messages(Which I need to study more) to delete the map entry in each nodes in clustered environment
@Danushka: Yes we can use the existing deleteTenant method in JDBCTenantManger.

Thanks
Godwin


On Sun, Sep 7, 2014 at 9:59 PM, Danushka Fernando <[hidden email]> wrote:
Hi

On Sun, Sep 7, 2014 at 6:59 PM, Johann Nallathamby <[hidden email]> wrote:



On Sun, Sep 7, 2014 at 6:29 PM, Danushka Fernando <[hidden email]> wrote:
Hi 
To the first most problem raised by Goodwin, AFAIU when you call tenant deletion you call deleteTenant in TenantManager. So why cant you clear the tenant from the map in JDBCTenantManger's deleteTenant method?

Yes. Should be able to do that. But as Shankar explained we need to send cluster messages to do the same in all the nodes.
Yes I also agree to that point. +1. 

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729


On Sat, Sep 6, 2014 at 8:20 PM, Nirmal Fernando <[hidden email]> wrote:
Shouldn't this tenant event listener be triggered in all the nodes in the cluster? If not, I think we might need to fix it.


On Sat, Sep 6, 2014 at 10:00 AM, Selvaratnam Uthaiyashankar <[hidden email]> wrote:
Even if we have public method, how will it work in a clustered environment? For example, delete request is sent to Node1, (and lets say one way or the other we delete the entry from map on Node1), and create request is sent to Node 2 (which still has the entry in the map). Are we going to use cluster messages to clear the entry from all nodes? 


On Friday, September 5, 2014, Nirmal Fernando <[hidden email]> wrote:
I think that should be ok. @Johann wdyt?


On Fri, Sep 5, 2014 at 8:23 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <[hidden email]> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/




--
S.Uthaiyashankar
VP Engineering
WSO2 Inc.
http://wso2.com/ - "lean . enterprise . middleware"

Phone: <a href="tel:%2B94%20714897591" value="+94714897591" target="_blank">+94 714897591


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Thanks & Regards,

Johann Dilantha Nallathamby
Associate Technical Lead & Product Lead of WSO2 Identity Server
Integration Technologies Team
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94777776950

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Amila Maharachchi
Senior Technical Lead
WSO2, Inc.; http://wso2.com

Blog: http://maharachchi.blogspot.com
Mobile: <a href="tel:%2B94719371446" value="+94719371446" target="_blank">+94719371446




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Pushpalanka Jayawardhana
Hi All,

On Wed, 10 Sep 2014 at 21:13, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

As per the discussion had with Azeez offline please see below the solution agreed.

1. Add a new overload method to TenantManager as void deleteTenant(int tenantId, boolean removeFromPersistentStorage) throws UserStoreException;

2. Implement this method in JDBCTenantManager class which use to delete only the map entry and execute in each worker nodes by calling from Cluster message.

3. Modify existing deleteTenant(int tenantId) to delete the persistent  storage which is calling in management node.

Please see below modified code snippet in JDBCTenantManager


         @Override
    public void deleteTenant(int tenantId) throws UserStoreException {
        try {
            deleteTenant(tenantId, true);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UserStoreException(e);
        }
    }

    @Override
    public void deleteTenant(int tenantId, boolean removeFromPersistentStorage)
            throws org.wso2.carbon.user.api.UserStoreException {
        // Remove tenant information from the cache.
        String tenantDomain = (String) tenantIdDomainMap.remove(tenantId);
        tenantDomainIdMap.remove(tenantDomain);

        tenantCacheManager.clearCacheEntry(new TenantIdKey(tenantId));

        if (removeFromPersistentStorage) {
            Connection dbConnection = null;
            PreparedStatement prepStmt = null;
            try {
                dbConnection = getDBConnection();
                String sqlStmt = TenantConstants.DELETE_TENANT_SQL;
                prepStmt = dbConnection.prepareStatement(sqlStmt);
                prepStmt.setInt(1, tenantId);

                prepStmt.executeUpdate();
                dbConnection.commit();
            } catch (SQLException e) {
                DatabaseUtil.rollBack(dbConnection);
                String msg = "Error in deleting the tenant with " + "tenant id: "
                        + tenantId + ".";
                log.error(msg, e);
                throw new UserStoreException(msg, e);
            } finally {
                DatabaseUtil.closeAllConnections(dbConnection,prepStmt);
            }
        }
    }

Did we follow this approach and fix this?
Appreciate some details on how this issue was overcome.

Thanks,
Pushpalanka 


Thanks
Godwin




On Tue, Sep 9, 2014 at 6:04 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Yes, there are two maps as tenantDomainIdMap and tenantIdDomainMap. we'll address both.



On Tue, Sep 9, 2014 at 5:23 PM, Amila Maha Arachchi <[hidden email]> wrote:
+1

I remember there were two maps or a bidi-map. i.e. It was tracking both tenant ID and tenant domain. Make sure both issues are addressed (if my concern is valid).

On Tue, Sep 9, 2014 at 3:37 AM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi.

We had a discussion about cleaning cache data (delete map entry in JDBCTenantManger), As per the discussion, we have to use cluster message to notify all the nodes in the clustered environment to delete the map entry.  Then we have to give a public method in JDBCTenantManger to delete the entry which is accessible from the execute method of the cluster message.

listed below the summary of the implementation.

1. Create a new public method in JDBCTenantManger to delete the map entry.
2. Create a new class which extends ClusteringMessage and implements Serializable. 
3. Implement the execute method on above class to perform the delete map entry method inside the JDBCTenantManger.
4. When execute the deleteTenant method in TenantMgtAdminService, create a object from new Cluster Message class created in #2 and set the tenantId as a property and send to all nodes in the cluster.
5. Nodes will receive the above message, deserialize it and perform the execute method of the cluster message, which will delete the map entry in each nodes.


Please give a feedback on this.


Thanks
Godwin















On Mon, Sep 8, 2014 at 10:07 AM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi All,

Thanks for the valuable responses, As I understood we have to use cluster messages(Which I need to study more) to delete the map entry in each nodes in clustered environment
@Danushka: Yes we can use the existing deleteTenant method in JDBCTenantManger.

Thanks
Godwin


On Sun, Sep 7, 2014 at 9:59 PM, Danushka Fernando <[hidden email]> wrote:
Hi

On Sun, Sep 7, 2014 at 6:59 PM, Johann Nallathamby <[hidden email]> wrote:



On Sun, Sep 7, 2014 at 6:29 PM, Danushka Fernando <[hidden email]> wrote:
Hi 
To the first most problem raised by Goodwin, AFAIU when you call tenant deletion you call deleteTenant in TenantManager. So why cant you clear the tenant from the map in JDBCTenantManger's deleteTenant method?

Yes. Should be able to do that. But as Shankar explained we need to send cluster messages to do the same in all the nodes.
Yes I also agree to that point. +1. 

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729


On Sat, Sep 6, 2014 at 8:20 PM, Nirmal Fernando <[hidden email]> wrote:
Shouldn't this tenant event listener be triggered in all the nodes in the cluster? If not, I think we might need to fix it.


On Sat, Sep 6, 2014 at 10:00 AM, Selvaratnam Uthaiyashankar <[hidden email]> wrote:
Even if we have public method, how will it work in a clustered environment? For example, delete request is sent to Node1, (and lets say one way or the other we delete the entry from map on Node1), and create request is sent to Node 2 (which still has the entry in the map). Are we going to use cluster messages to clear the entry from all nodes? 


On Friday, September 5, 2014, Nirmal Fernando <[hidden email]> wrote:
I think that should be ok. @Johann wdyt?


On Fri, Sep 5, 2014 at 8:23 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <[hidden email]> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/




--
S.Uthaiyashankar
VP Engineering
WSO2 Inc.
http://wso2.com/ - "lean . enterprise . middleware"

Phone: <a href="tel:%2B94%20714897591" value="+94714897591" target="_blank">+94 714897591


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Thanks & Regards,

Johann Dilantha Nallathamby
Associate Technical Lead & Product Lead of WSO2 Identity Server
Integration Technologies Team
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94777776950

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Amila Maharachchi
Senior Technical Lead
WSO2, Inc.; http://wso2.com

Blog: http://maharachchi.blogspot.com
Mobile: <a href="tel:%2B94719371446" value="+94719371446" target="_blank">+94719371446




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165
_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture


--
Pushpalanka.
-- 
Pushpalanka Jayawardhana, B.Sc.Eng.(Hons).
Associate Tech Lead, WSO2 Lanka (pvt) Ltd;  wso2.com/
Mobile: +94779716248
Blog: pushpalankajaya.blogspot.com/ | LinkedIn: lk.linkedin.com/in/pushpalanka/ Twitter: @pushpalanka 



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Reply | Threaded
Open this post in threaded view
|

Re: Cloud Tenant deletion caching issue

Isura Karunaratne
Hi Pushpalanka,

We fixed this by using caches for tenantIdDomainMap and tenantDomainIdMap.  Once an item is removed from a node, other nodes' same cache will be invalidated using local cache invalidations cluster messages.

Cheers,
Isura.

On Thu, Feb 21, 2019 at 7:41 PM Pushpalanka Jayawardhana <[hidden email]> wrote:
Hi All,

On Wed, 10 Sep 2014 at 21:13, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

As per the discussion had with Azeez offline please see below the solution agreed.

1. Add a new overload method to TenantManager as void deleteTenant(int tenantId, boolean removeFromPersistentStorage) throws UserStoreException;

2. Implement this method in JDBCTenantManager class which use to delete only the map entry and execute in each worker nodes by calling from Cluster message.

3. Modify existing deleteTenant(int tenantId) to delete the persistent  storage which is calling in management node.

Please see below modified code snippet in JDBCTenantManager


         @Override
    public void deleteTenant(int tenantId) throws UserStoreException {
        try {
            deleteTenant(tenantId, true);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UserStoreException(e);
        }
    }

    @Override
    public void deleteTenant(int tenantId, boolean removeFromPersistentStorage)
            throws org.wso2.carbon.user.api.UserStoreException {
        // Remove tenant information from the cache.
        String tenantDomain = (String) tenantIdDomainMap.remove(tenantId);
        tenantDomainIdMap.remove(tenantDomain);

        tenantCacheManager.clearCacheEntry(new TenantIdKey(tenantId));

        if (removeFromPersistentStorage) {
            Connection dbConnection = null;
            PreparedStatement prepStmt = null;
            try {
                dbConnection = getDBConnection();
                String sqlStmt = TenantConstants.DELETE_TENANT_SQL;
                prepStmt = dbConnection.prepareStatement(sqlStmt);
                prepStmt.setInt(1, tenantId);

                prepStmt.executeUpdate();
                dbConnection.commit();
            } catch (SQLException e) {
                DatabaseUtil.rollBack(dbConnection);
                String msg = "Error in deleting the tenant with " + "tenant id: "
                        + tenantId + ".";
                log.error(msg, e);
                throw new UserStoreException(msg, e);
            } finally {
                DatabaseUtil.closeAllConnections(dbConnection,prepStmt);
            }
        }
    }

Did we follow this approach and fix this?
Appreciate some details on how this issue was overcome.

Thanks,
Pushpalanka 


Thanks
Godwin




On Tue, Sep 9, 2014 at 6:04 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Yes, there are two maps as tenantDomainIdMap and tenantIdDomainMap. we'll address both.



On Tue, Sep 9, 2014 at 5:23 PM, Amila Maha Arachchi <[hidden email]> wrote:
+1

I remember there were two maps or a bidi-map. i.e. It was tracking both tenant ID and tenant domain. Make sure both issues are addressed (if my concern is valid).

On Tue, Sep 9, 2014 at 3:37 AM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi.

We had a discussion about cleaning cache data (delete map entry in JDBCTenantManger), As per the discussion, we have to use cluster message to notify all the nodes in the clustered environment to delete the map entry.  Then we have to give a public method in JDBCTenantManger to delete the entry which is accessible from the execute method of the cluster message.

listed below the summary of the implementation.

1. Create a new public method in JDBCTenantManger to delete the map entry.
2. Create a new class which extends ClusteringMessage and implements Serializable. 
3. Implement the execute method on above class to perform the delete map entry method inside the JDBCTenantManger.
4. When execute the deleteTenant method in TenantMgtAdminService, create a object from new Cluster Message class created in #2 and set the tenantId as a property and send to all nodes in the cluster.
5. Nodes will receive the above message, deserialize it and perform the execute method of the cluster message, which will delete the map entry in each nodes.


Please give a feedback on this.


Thanks
Godwin















On Mon, Sep 8, 2014 at 10:07 AM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi All,

Thanks for the valuable responses, As I understood we have to use cluster messages(Which I need to study more) to delete the map entry in each nodes in clustered environment
@Danushka: Yes we can use the existing deleteTenant method in JDBCTenantManger.

Thanks
Godwin


On Sun, Sep 7, 2014 at 9:59 PM, Danushka Fernando <[hidden email]> wrote:
Hi

On Sun, Sep 7, 2014 at 6:59 PM, Johann Nallathamby <[hidden email]> wrote:



On Sun, Sep 7, 2014 at 6:29 PM, Danushka Fernando <[hidden email]> wrote:
Hi 
To the first most problem raised by Goodwin, AFAIU when you call tenant deletion you call deleteTenant in TenantManager. So why cant you clear the tenant from the map in JDBCTenantManger's deleteTenant method?

Yes. Should be able to do that. But as Shankar explained we need to send cluster messages to do the same in all the nodes.
Yes I also agree to that point. +1. 

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729


On Sat, Sep 6, 2014 at 8:20 PM, Nirmal Fernando <[hidden email]> wrote:
Shouldn't this tenant event listener be triggered in all the nodes in the cluster? If not, I think we might need to fix it.


On Sat, Sep 6, 2014 at 10:00 AM, Selvaratnam Uthaiyashankar <[hidden email]> wrote:
Even if we have public method, how will it work in a clustered environment? For example, delete request is sent to Node1, (and lets say one way or the other we delete the entry from map on Node1), and create request is sent to Node 2 (which still has the entry in the map). Are we going to use cluster messages to clear the entry from all nodes? 


On Friday, September 5, 2014, Nirmal Fernando <[hidden email]> wrote:
I think that should be ok. @Johann wdyt?


On Fri, Sep 5, 2014 at 8:23 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi Nirmal,

Yes we can do it, But current map doesn't have public access, then we need to have a public method inside the JDBCTenantManager to delete the entry.


On Fri, Sep 5, 2014 at 8:00 PM, Nirmal Fernando <[hidden email]> wrote:
Can't we use a tenant event listener and remove the entry from the map on a tenant deletion event?


On Fri, Sep 5, 2014 at 7:50 PM, Godwin Amila Shrimal <[hidden email]> wrote:
Hi,

We are working on tenant deletion implementation, once we perform the current tenant deletion operation in TenantMgtAdminService it deletes registry, user store etc. data. But it doesn't allow to create a tenant again with the same tenant domain name until restart the server. 

Reason for above situation is tenant domain and id is keeping in a map(tenantDomainIdMap) inside the JDBCTenantManager. When perform delete operation it check the availability from this map.

As per the discussion we can see following solutions for this.

Solution1
Check the tenant availability from database not from memory data, but this will be costly if it is a frequently perform operation.

Solution2
We can give a public access to delete the particular key in the map, this will be a security issue which people can pass tenant domain and perform deletion.

Solution3
Run a periodic operation which check the availability of the tenant in the database and delete from map which are not exist.


We are looking for a feedback on this.

Thanks
Godwin


--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/




--
S.Uthaiyashankar
VP Engineering
WSO2 Inc.
http://wso2.com/ - "lean . enterprise . middleware"

Phone: <a href="tel:%2B94%20714897591" value="+94714897591" target="_blank">+94 714897591


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: <a href="tel:%2B94715779733" value="+94715779733" target="_blank">+94715779733
Blog: http://nirmalfdo.blogspot.com/



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture



_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Thanks & Regards,

Johann Dilantha Nallathamby
Associate Technical Lead & Product Lead of WSO2 Identity Server
Integration Technologies Team
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94777776950

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : <a href="tel:%2B94716332729" value="+94716332729" target="_blank">+94716332729

_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Amila Maharachchi
Senior Technical Lead
WSO2, Inc.; http://wso2.com

Blog: http://maharachchi.blogspot.com
Mobile: <a href="tel:%2B94719371446" value="+94719371446" target="_blank">+94719371446




--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165



--
Godwin Amila Shrimal
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94772264165
_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture


--
Pushpalanka.
-- 
Pushpalanka Jayawardhana, B.Sc.Eng.(Hons).
Associate Tech Lead, WSO2 Lanka (pvt) Ltd;  wso2.com/
Mobile: +94779716248
Blog: pushpalankajaya.blogspot.com/ | LinkedIn: lk.linkedin.com/in/pushpalanka/ Twitter: @pushpalanka 


_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture


--
Isura Dilhara Karunaratne
Associate Technical Lead | WSO2 
lean.enterprise.middleware
Mob : +94 772 254 810




_______________________________________________
Architecture mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture