Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AclObjectIdentityGormService::findAllByParentObjectIdAndParentAclClassName() performance issue #39

Open
vdusa opened this issue Jul 30, 2019 · 0 comments

Comments

@vdusa
Copy link

vdusa commented Jul 30, 2019

Method AclObjectIdentityGormService::findAllByParentObjectIdAndParentAclClassName() searches now AclObjectIdentity objects so, that ALL objects of AclObjectIdentity are retrieved, and then the result is searched in this list (see below):

    @CompileDynamic
    @ReadOnly
    List<AclObjectIdentity> findAllByParentObjectIdAndParentAclClassName(Long objectId, String aclClassName) {
        //findQueryByParentObjectIdAndParentAclClassName(objectId, aclClassName).list()
        List<AclObjectIdentity> aclObjectIdentityList = findAll()
        aclObjectIdentityList.findAll { AclObjectIdentity oid ->
            (oid?.parent?.aclClass?.className == aclClassName) &&  ( oid?.parent?.objectId == objectId)
        }
    }

This method calls AclObjectIdentityGormService::findAll(), which retrieves all AclObjectIdentity objects. Since we have about 30'000 AclObjectIdentity objects (this amount still increases), then all these objects are in hibernate session, which causes performance problems.

As a workaround, we have created our own bean inherited from AclObjectIdentityGormService, where findAllByParentObjectIdAndParentAclClassName() is overloaded and uses findQueryByParentObjectIdAndParentAclClassName() as it was earlier in the plugin before the commit 4d53a88 from 1. Dec 2017 by @sdelamo has been made.

We don't know, what was the reason of using findAll() here, but we think that such approach is algorithmically unhappy. Could you help us to solve this problem correctly, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant