[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5372) Improve envers query performance by using new REVEND column

Erik-Berndt Scheper (JIRA) noreply at atlassian.com
Tue Sep 7 06:21:18 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=38305#action_38305 ] 

Erik-Berndt Scheper commented on HHH-5372:
------------------------------------------

First of all: great news; thanks for reviewing the initial patch!

I have attached a new patch file which resolves the issues mentioned above.
In order to achieve this, I have changed the following:

1. The org.hibernate.envers.strategy.AuditStrategy interface has been extended with the following methods:
{noformat}
	void addEntityAtRevisionRestriction(AuditConfiguration auditCfg, QueryBuilder rootQueryBuilder, 
			String revisionProperty, String revisionEndProperty, boolean addAlias, MiddleIdData idData, 
			String revisionPropertyPath, String originalIdPropertyName, String alias1, String alias2);

	void addAssociationAtRevisionRestriction(QueryBuilder rootQueryBuilder,  String revisionProperty, 
			String revisionEndProperty, boolean addAlias, MiddleIdData referencingIdData, 
			String versionsMiddleEntityName, String eeOriginalIdPropertyPath, String revisionPropertyPath,
          String originalIdPropertyName, MiddleComponentData... componentDatas);
{noformat}

These have been implemented in the DefaultAuditStrategy and the ValidTimeAuditStrategy using Matthew's code (thanks).
The DefaultAuditStrategy uses subqueries, whereas the ValidTimeAuditStrategy uses the new end-revision column which greatly improves performance.

2. The class org.hibernate.envers.entities.mapper.relation.query.QueryGeneratorTools has been removed. 
This code is now implemented  in the two AuditStrategy implementations

3. All code-duplicates of the subquery creation / end-revision where clause have been replaced by calls to the AuditStrategy

4. The 'ugly class check' against ValidTimeAuditStrategy  has been removed. This required some minor changes in the initial configuration, including AuditConfiguration, EntitiesConfigurator, AuditMetadataGenerator, CollectionMetadataGenerator, QueryGeneratorBuilder. 

5. A subquery builder is only created when it is used (in DefaultAuditStrategy).


Hopefully this issue can now be resolved; but as always: further improvements are welcome!

> Improve envers query performance by using new REVEND column
> -----------------------------------------------------------
>
>                 Key: HHH-5372
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5372
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: envers
>    Affects Versions: 3.6.0.Beta1
>            Reporter: Matthew B. Jones
>            Assignee: Adam Warski
>         Attachments: HHH-5372-revend_queries-revised-20100907.patch, revend_queries.txt
>
>
> When the ValidTimeAuditStrategy is enabled: <property name="org.hibernate.envers.audit_strategy">org.hibernate.envers.strategy.ValidTimeAuditStrategy</property>, it would be desirable to have the Envers API leverage the useful REVEND columns to avoid slow subselects.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list