Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1148603

Summary: [GSS](6.4.0)HHH-9455 Hibernate AbstractCollectionPersister method processQueuedOps calls a deprecated method which has negative impact on the performance.
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Gary Hu <ghu>
Component: HibernateAssignee: Gail Badner <gbadner>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Simka <msimka>
Severity: high Docs Contact:
Priority: high    
Version: 6.4.0CC: bmaxwell, jmartisk, kkhan, msimka, smarlow
Target Milestone: DR11   
Target Release: EAP 6.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1155389 (view as bug list) Environment:
Last Closed: 2019-08-19 12:41:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1121629, 1155389    
Attachments:
Description Flags
BZ1148603.patch none

Description Gary Hu 2014-10-01 20:22:39 UTC
org.hibernate.persister.collection.AbstractCollectionPersister.java:

public void processQueuedOps(PersistentCollection collection, Serializable key, SessionImplementor session)
			throws HibernateException {
		if ( collection.hasQueuedOperations() ) {
			int nextIndex = getSize( key, session );
			doProcessQueuedOps( collection, key, nextIndex, session );
		}
	}


Please note the line:
   int nextIndex = getSize( key, session );

It actually executes a query "select count xxx" which is expensive and has negative impact on performance. 

More importantly, in the method doProcessQueuedOps:

        @Deprecated
	protected void doProcessQueuedOps(PersistentCollection collection, Serializable key,
			int nextIndex, SessionImplementor session)
			throws HibernateException {
		doProcessQueuedOps( collection, key, session );
	}

The param nextIndex is not even used. 

It appears that the method 
   doProcessQueuedOps(PersistentCollection collection, Serializable key,
			int nextIndex, SessionImplementor session)
is already deprecated and is not supposed to be used any more. 

The method processQueuedOps should call 
   doProcessQueuedOps(PersistentCollection collection, Serializable key, SessionImplementor session)
and no need to invoke getSize method that is very expensive.

Comment 1 Gary Hu 2014-10-20 19:57:32 UTC
Created attachment 948676 [details]
BZ1148603.patch

Comment 4 Gail Badner 2014-10-21 22:38:01 UTC
This has been fixed upstream.

Comment 5 Gail Badner 2014-11-21 03:08:19 UTC
Fixed for EAP 6.4.0.

Comment 6 Kabir Khan 2014-11-21 11:35:47 UTC
Fixed by Hibernate 4.2.16.Final upgrade https://bugzilla.redhat.com/show_bug.cgi?id=1121629

Comment 7 Jan Martiska 2014-11-27 09:26:21 UTC
Verified in EAP 6.4.0.DR11.