IDMUserListAccess.getSize() needs to call query for obtain all users from table
"jbid_io"
------------------------------------------------------------------------------------------
Key: GTNPORTAL-1904
URL:
https://issues.jboss.org/browse/GTNPORTAL-1904
Project: GateIn Portal
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Identity integration, Performance
Affects Versions: 3.1.0-GA
Environment: JBoss EPP 5.1.0
Reporter: Marek Posolda
Assignee: Boleslaw Dawidowicz
Fix For: 3.2.0-GA
1) Add 50000 users into DB
2) Login as john
3) Go to page with organization management portlet.
The thing is that when UIListUsers component is rendered first time, it uses empty
instance of org.exoplatform.services.organization.Query (query without any restrictions) .
This is calling UserDAOImpl.findUsers(Query query) which is then using IDMUserListAccess
.
The thing is that even if there is lazy list, method IDMUserListAccess.getSize() needs to
be called and it needs to obtain all instances of user from "jbid_io_user" .
It's because of this code snippet in IDMUserListAccess.getSize() :
if (countAll)
{
result = idmService.getIdentitySession().getPersistenceManager().getUserCount();
}
else
{
userQueryBuilder.page(0, 0);
UserQuery query = userQueryBuilder.sort(SortOrder.ASCENDING).createQuery();
result = idmService.getIdentitySession().execute(query).size();
}
So we need to execute whole query even if we need only size (because countAll is false).
This means that this SQL select is called:
select this_.ID as ID4_2_, this_.IDENTITY_TYPE as IDENTITY2_4_2_, this_.NAME as NAME4_2_,
this_.REALM as REALM4_2_, type2_.ID as ID11_0_, type2_.NAME as NAME11_0_, rm1_.ID as
ID0_1_, rm1_.NAME as NAME0_1_ from jbid_io this_ inner join jbid_io_type type2_ on
this_.IDENTITY_TYPE=type2_.ID inner join jbid_realm rm1_ on this_.REALM=rm1_.ID where
rm1_.NAME='idm_realm' and type2_.NAME='USER' and this_.NAME like
'%' order by this_.NAME asc
This is very slow when we have many users in DB and it's hardly dependent on number of
users in DB. I guess it can be tuned so that IDMUserListAccess.getSize() will call SQL
query for obtain only real number of users and not expensive query and creating 50000
objects via Hibernate.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira