RE: ResourcePermission Table

thumbnail
Joaquin Cabal, modified 13 Years ago. Regular Member Posts: 106 Join Date: 9/7/09 Recent Posts
Hi I'm working with a liferay portal that is already on Production.
We hase some problem basically related to this issue: http://issues.liferay.com/browse/LPS-14135.

We've entry a lot of users doing some tests, and then we had to deleted these users. After thar the ResourcePermission table is populated with a lot of "obsolet data". Is there a way to delete these invalid entries from the database, I mean How can I see wich entries should I delete?
This table have like 500000 entries, and somethig like 4000 users

Thanks in advance!
thumbnail
David H Nebinger, modified 13 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
Resource permissions are just that, they are permissions on resources.

With 4000 users (active and inactive) but a lot of resources, the current resource permission record count may be accurate.

That said, it is inadvisable to manipulate the Liferay database directly. Liferay uses a database and a lucene index for storing a lot of stuff. Failure to remove records correctly can lead to a broken system.

Basically you should never have been using your production system for this kind of testing.
thumbnail
Joaquin Cabal, modified 13 Years ago. Regular Member Posts: 106 Join Date: 9/7/09 Recent Posts
Thanks Davis, I agree with you, the problem is the CPU seems to be veeery busy doing queries on this table.
I saw on the resourcePermission table doing this query:

"select count(resourcepermissionid),"name",primkey,roleid,actionids
from resourcepermission
where scope = 4
group by "name",primkey,roleid,actionids
having count(resourcepermissionid) > 1
order by count(resourcepermissionid)"

where we have o lot of duplicate entries, the question is , the resourcepermissionid is used in any other table as a relationship?
Thanks!


David H Nebinger:
Resource permissions are just that, they are permissions on resources.

With 4000 users (active and inactive) but a lot of resources, the current resource permission record count may be accurate.

That said, it is inadvisable to manipulate the Liferay database directly. Liferay uses a database and a lucene index for storing a lot of stuff. Failure to remove records correctly can lead to a broken system.

Basically you should never have been using your production system for this kind of testing.
thumbnail
David H Nebinger, modified 13 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
Joaquin Cabal:
where we have o lot of duplicate entries, the question is , the resourcepermissionid is used in any other table as a relationship?


Probably. Liferay treats the database as their own black box. FKs are not created nor enforced, and the virtual table relationships are undocumented also.

That's why deleting rows from the database is so precarious - there is no way to determine where rows might be referenced from what other tables. It gets even more complex since the algorithm for permissions can be changed, so identifying your algorithm and determining which rows to delete will be somewhat overwhelming, IMHO.
thumbnail
Joaquin Cabal, modified 13 Years ago. Regular Member Posts: 106 Join Date: 9/7/09 Recent Posts
Ok, Thanks a lot!
I'll go with the posible solution on the LPS
thumbnail
Hitoshi Ozawa, modified 13 Years ago. Liferay Legend Posts: 7942 Join Date: 3/24/10 Recent Posts
I've heard about this problem too. Luckily the person detected this during test and decided to use newer liferay version.

As David said, it's not wise to execute sql commands in production system. I'll go with the recommended solution in the LPS.