Bug 743018 - oracle IN clause problem when deleting members from groups
Summary: oracle IN clause problem when deleting members from groups
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: RHQ Project
Classification: Other
Component: Core Server
Version: 4.1
Hardware: Unspecified
OS: Unspecified
low
low vote
Target Milestone: ---
: ---
Assignee: RHQ Project Maintainer
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-10-03 15:24 UTC by John Mazzitelli
Modified: 2011-10-03 15:55 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-10-03 15:55:50 UTC


Attachments (Terms of Use)

Description John Mazzitelli 2011-10-03 15:24:07 UTC
I see this in ResourceGroup entity:

    public static final String QUERY_DELETE_EXPLICIT_BY_RESOURCE_IDS = "DELETE FROM RHQ_RESOURCE_GROUP_RES_EXP_MAP WHERE RESOURCE_ID IN ( :resourceIds )";
    public static final String QUERY_DELETE_IMPLICIT_BY_RESOURCE_IDS = "DELETE FROM RHQ_RESOURCE_GROUP_RES_IMP_MAP WHERE RESOURCE_ID IN ( :resourceIds )";

Anyone using this with a list of more than 1000 resources will hit the Oracle 1000-limit. We need to refactor these queries out or at least chunk their usage.

Comment 1 John Mazzitelli 2011-10-03 15:34:36 UTC
ahh. never mind. looks like the only place we end up using this comes from this chunked code:

        while (i < toBeDeletedResourceIds.size()) {
            int j = i + 1000;
            if (j > toBeDeletedResourceIds.size())
                j = toBeDeletedResourceIds.size();
            List<Integer> idsToDelete = toBeDeletedResourceIds.subList(i, j);
            log.debug("== Bounds " + i + ", " + j);

            boolean hasErrors = uninventoryResourcesBulkDelete(overlord, idsToDelete);
            if (hasErrors) {
                throw new IllegalArgumentException("Could not remove resources from their containing groups");
            }
            i = j;
        }

we should at least javadoc all the locations that use those queries to be careful not to use them as-is - they need to be chunked.


Note You need to log in before you can comment on or make changes to this bug.