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

Get ContentletVersionInfo out of hibernate #18550

Closed
wezell opened this issue May 26, 2020 · 5 comments
Closed

Get ContentletVersionInfo out of hibernate #18550

wezell opened this issue May 26, 2020 · 5 comments

Comments

@wezell
Copy link
Contributor

wezell commented May 26, 2020

We have issues with the ContentletVersionInfo table - we need to create a DBTransformer class for the ContentletVersionInfo data and remove it from the hibernate.hbm.xml

This is on a normal content push. The stack trace looks like this. Why could this be happening?

[22/05/20 16:21:06:215 GMT] ERROR handler.ContentHandler: Error on File /data/shared/assets/bundles/01E8YK08NNPVQKDYBPNQ1J4CM3/working/dotcms.com/1/2-content.e75d6ddb-cc41-4080-988a-a2b8bf0f83e0.content.xml, content id:61231477-b081-4dee-92c0-265e4e2e3198 :Unable to save/update Object to Hibernate Session
com.dotmarketing.exception.DotHibernateException: Unable to save/update Object to Hibernate Session
        at com.dotmarketing.db.HibernateUtil.saveOrUpdate(HibernateUtil.java:549) ~[dotcms_5.3.0_999999.jar:?]
        at com.dotmarketing.business.VersionableFactoryImpl.saveContentletVersionInfo(VersionableFactoryImpl.java:349) ~[dotcms_5.3.0_999999.jar:?]
        at com.dotmarketing.business.VersionableAPIImpl.saveContentletVersionInfo_aroundBody44(VersionableAPIImpl.java:671) ~[dotcms_5.3.0_999999.jar:?]
        at com.dotmarketing.business.VersionableAPIImpl$AjcClosure45.run(VersionableAPIImpl.java:1) ~[dotcms_5.3.0_999999.jar:?]
        at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149) ~[aspectjrt-1.8.10.jar:?]
        at com.dotcms.aspects.aspectj.AspectJDelegateMethodInvocation.proceed(AspectJDelegateMethodInvocation.java:42) ~[dotcms_5.3.0_999999.jar:?]
        at com.dotmarketing.db.LocalTransaction.wrapReturnWithListeners(LocalTransaction.java:59) ~[dotcms_5.3.0_999999.jar:?]
        at com.dotcms.aspects.interceptors.WrapInTransactionMethodInterceptor.invoke(WrapInTransactionMethodInterceptor.java:23) ~[dotcms_5.3.0_999999.jar:?]
        at com.dotcms.aspects.aspectj.WrapInTransactionAspect.invoke(WrapInTransactionAspect.java:41) ~[dotcms_5.3.0_999999.jar:?]
        at com.dotmarketing.business.VersionableAPIImpl.saveContentletVersionInfo(VersionableAPIImpl.java:656) ~[dotcms_5.3.0_999999.jar:?]
        at com.dotcms.enterprise.publishing.remote.handler.ContentHandler.a(SourceFile:422) ~[ee-5.3.0.jar:?]
        at com.dotcms.enterprise.publishing.remote.handler.ContentHandler.handle(SourceFile:163) ~[ee-5.3.0.jar:?]
        at com.dotcms.enterprise.publishing.remote.handler.ContentHandler.handle(SourceFile:138) ~[ee-5.3.0.jar:?]
        at com.dotcms.publisher.receiver.BundlePublisher.process(BundlePublisher.java:203) ~[dotcms_5.3.0_999999.jar:?]
        at com.dotcms.rest.PublishThread.run(PublishThread.java:42) ~[dotcms_5.3.0_999999.jar:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: com.dotcms.repackage.net.sf.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
        at com.dotcms.repackage.net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:62) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.BatcherImpl.convert(BatcherImpl.java:328) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:135) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2438) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2393) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotmarketing.db.HibernateUtil.saveOrUpdate(HibernateUtil.java:547) ~[dotcms_5.3.0_999999.jar:?]
        ... 15 more
Caused by: java.sql.BatchUpdateException: Batch entry 0 update contentlet_version_info set working_inode='4ab29e0f-30c2-4df6-89d8-1ccf2231bcd9', live_inode='4ab29e0f-30c2-4df6-89d8-1ccf2231bcd9', deleted='FALSE', locked_by=NULL, locked_on='2020-05-21 10:54:00.428-04', version_ts='2020-05-22 12:21:06.208-04' where identifier='61231477-b081-4dee-92c0-265e4e2e3198' and lang=1 was aborted: ERROR: insert or update on table "contentlet_version_info" violates foreign key constraint "fk_contentlet_version_info_live"
  Detail: Key (live_inode)=(4ab29e0f-30c2-4df6-89d8-1ccf2231bcd9) is not present in table "contentlet".  Call getNextException to see other errors in the batch.
        at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:148) ~[postgresql-42.2.8.jar:42.2.8]
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2234) ~[postgresql-42.2.8.jar:42.2.8]
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:510) ~[postgresql-42.2.8.jar:42.2.8]
        at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:853) ~[postgresql-42.2.8.jar:42.2.8]
        at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1546) ~[postgresql-42.2.8.jar:42.2.8]
        at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128) ~[HikariCP-3.4.2.jar:?]
        at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java) ~[HikariCP-3.4.2.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:128) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2438) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2393) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotmarketing.db.HibernateUtil.saveOrUpdate(HibernateUtil.java:547) ~[dotcms_5.3.0_999999.jar:?]
        ... 15 more
Caused by: org.postgresql.util.PSQLException: ERROR: insert or update on table "contentlet_version_info" violates foreign key constraint "fk_contentlet_version_info_live"
  Detail: Key (live_inode)=(4ab29e0f-30c2-4df6-89d8-1ccf2231bcd9) is not present in table "contentlet".
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2497) ~[postgresql-42.2.8.jar:42.2.8]
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2233) ~[postgresql-42.2.8.jar:42.2.8]
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:510) ~[postgresql-42.2.8.jar:42.2.8]
        at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:853) ~[postgresql-42.2.8.jar:42.2.8]
        at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1546) ~[postgresql-42.2.8.jar:42.2.8]
        at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128) ~[HikariCP-3.4.2.jar:?]
        at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java) ~[HikariCP-3.4.2.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:128) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2438) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2393) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotcms.repackage.net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261) ~[dot.hibernate-2.1.7_3.jar:?]
        at com.dotmarketing.db.HibernateUtil.saveOrUpdate(HibernateUtil.java:547) ~[dotcms_5.3.0_999999.jar:?]
        ... 15 more
@dsilvam dsilvam added this to the Falcon Current milestone May 27, 2020
@dsilvam dsilvam modified the milestones: 060220_FALCON, Falcon Current Jun 4, 2020
@erickgonzalez erickgonzalez modified the milestones: Falcon Current, Bug Sprint Jun 18, 2020
@dsilvam dsilvam modified the milestones: 061620_FALCON, Falcon Current Jun 19, 2020
@dsilvam dsilvam modified the milestones: 072820_FALCON, Falcon Current Jul 29, 2020
@wezell wezell changed the title We have seen this PP error on dotcms.com Get ContentletVersionInfo out of hibernate Jul 30, 2020
dsilvam added a commit that referenced this issue Sep 17, 2020
@dsilvam dsilvam self-assigned this Sep 18, 2020
dsilvam added a commit that referenced this issue Sep 18, 2020
dsilvam added a commit that referenced this issue Sep 18, 2020
dsilvam added a commit that referenced this issue Sep 22, 2020
dsilvam added a commit that referenced this issue Sep 23, 2020
dsilvam added a commit that referenced this issue Sep 23, 2020
dsilvam added a commit that referenced this issue Sep 23, 2020
@dsilvam
Copy link
Contributor

dsilvam commented Sep 23, 2020

PR: #19294

dsilvam added a commit that referenced this issue Sep 29, 2020
@dsilvam
Copy link
Contributor

dsilvam commented Sep 29, 2020

dsilvam added a commit that referenced this issue Sep 30, 2020
dsilvam added a commit that referenced this issue Sep 30, 2020
dsilvam added a commit that referenced this issue Oct 2, 2020
dsilvam added a commit that referenced this issue Oct 6, 2020
dsilvam added a commit that referenced this issue Oct 7, 2020
@dsilvam dsilvam modified the milestones: Falcon Current, Maintenance Sprint Oct 8, 2020
dsilvam added a commit that referenced this issue Oct 8, 2020
dsilvam added a commit that referenced this issue Oct 14, 2020
dsilvam added a commit that referenced this issue Oct 14, 2020
* #18550 first draft

* #18550 cast to String to preserve null

* #18550 try with new factory impl

* #18550 create cvi migrated to dotconnect

* #18550 fix transformer

* #18550 return empty object instead of null, like hibernate did

* #18550 codacy feedback

* #18550 proper doc

* #18550 include deprecated annotation

* #18550 change signature of getContentletVersion info part I

* #18550 custom ee jar to run tests

* #18550 fix wrong return

* #18550 fixing beanutils call

* #18550 fix red in jsps

* #18550 fix usage of optional

* #18550 fix behavior when CVI not present

* #18550 remove throws from method signature

* #18550 remove commeted out code

* #18550 code-review

* Update gradle.properties

* Update it-dotcms-config-cluster.properties

* Update it-dotmarketing-config.properties

* Update it-dotmarketing-config.properties

* Update it-dotmarketing-config.properties

* Update oracle-db-config.properties

* Update postgres-db-config.properties

* Update ESContentFactoryImpl.java

* Update DependencySet.java

* Update it-dotcms-config-cluster.properties

* Update oracle-db-config.properties

* #18550 remove new linews

* #18550 git rid of CVI definition in hbm files

* #18550 changes after removing CVI from hbm files

* #18550 migrate deleteContentByStructure to dotConnect

* #18550 fat-contentlet db transformer

* #18550 fix failing tests

* #18550 fix more failing tests

* #18550 create pp-filter fot test

* #18550 replace hibernate call with new one

* #18550 remove unneeded validation

* Update gradle.properties
@dsilvam dsilvam added the Merged label Oct 14, 2020
@dsilvam dsilvam removed their assignment Oct 14, 2020
@dsilvam
Copy link
Contributor

dsilvam commented Oct 14, 2020

Note to QA: Test the following actions:

  1. Create new content
  2. Create multiple versions of existing content
  3. Delete content

@victoralfaro-dotcms
Copy link
Contributor

Both Page and Banner contents were created and modified several times to generate a version for each.
then both were unpublished, archived and finally deleted.

@bryanboza
Copy link
Member

Fixed, tested on release-20.11 // Postgres // FF

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

No branches or pull requests

5 participants