core icon indicating copy to clipboard operation
core copied to clipboard

Pushing content does not push the language

Open cfalzone opened this issue 12 years ago • 5 comments

So if you have content on the sending server that is in a language that does not exist on the receiving server it fails to push. Would be a nice improvement if the push included the language and created it on the destination server if it does not exist.

cfalzone avatar Jan 22 '14 14:01 cfalzone

Interesting there are cases where this works. Did you get an error on the receiver? Or maybe was in the push history cache

jtesser avatar Jan 22 '14 15:01 jtesser

On the receiving node it failed to publish a contentlet because language id did not exist. Log at the end. Once I created the languages on the receiving node it worked fine.

I did notice the other order of things here though. It seems like it sends the languages but does not import them until after the content.

For instance every push pretty much looks like:

[22/01/14 16:10:38:404 EST]  INFO rest.PublishThread:  : [BundleID: 8caa7496-f2d3-46b7-a973-189a5f10c9e5.tar.gz] Started bundle publish process
[22/01/14 16:10:53:605 EST]  INFO handler.ContentHandler:  : [BundleID: 8caa7496-f2d3-46b7-a973-189a5f10c9e5.tar.gz] Content published. Id: SYSTEM_HOST

...

[22/01/14 16:11:36:997 EST]  INFO handler.ContentHandler:  : [BundleID: 8caa7496-f2d3-46b7-a973-189a5f10c9e5.tar.gz] Content published. Id: 4a6a62a6-315d-4b37-a539-995c8d2bd81c
*** [22/01/14 16:11:50:507 EST]  INFO handler.LanguageHandler:  : [BundleID: 8caa7496-f2d3-46b7-a973-189a5f10c9e5.tar.gz] Languages published ***
[22/01/14 16:11:52:841 EST]  INFO cluster.metadata: [dotCMS_1] [working_20140122092247] update_mapping [content] (dynamic)
[22/01/14 16:11:52:962 EST]  INFO cluster.metadata: [dotCMS_1] [live_20140122092247] update_mapping [content] (dynamic)
[22/01/14 16:12:08:394 EST]  INFO rest.PublishThread:  : [BundleID: 8caa7496-f2d3-46b7-a973-189a5f10c9e5.tar.gz] Finished bundle publish process

Notice that the languages seem to always be pushed after the content. In our case it was languageId 3 existed on the source server but not the destination and it caused a content publish to fail in the contentletAPI.

The error it was throwing:

978653-[22/01/14 09:48:33:103 EST] ERROR business.PublisherAPIImpl: Error Publishing Bundle: Unable to flush Hibernate Session 
978774-com.dotcms.publishing.DotPublishingException: Unable to flush Hibernate Session 
978855- at com.dotcms.enterprise.publishing.remote.handler.ContentHandler.a(SourceFile:230)
978940- at com.dotcms.enterprise.publishing.remote.handler.ContentHandler.handle(SourceFile:82)
979029- at com.dotcms.enterprise.publishing.remote.handler.ContentHandler.handle(SourceFile:72)
979118- at com.dotcms.publisher.receiver.BundlePublisher.process(BundlePublisher.java:137)
979202- at com.dotcms.rest.PublishThread.run(PublishThread.java:42)
979263- at java.lang.Thread.run(Thread.java:724)
979305-Caused by: com.dotmarketing.exception.DotHibernateException: Unable to flush Hibernate Session 
979401- at com.dotmarketing.db.HibernateUtil.saveWithPrimaryKey(HibernateUtil.java:821)
979482- at com.dotcms.content.elasticsearch.business.ESContentFactoryImpl.save(ESContentFactoryImpl.java:1407)
979586- at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.checkin(ESContentletAPIImpl.java:2123)
979691- at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.checkin(ESContentletAPIImpl.java:1959)
979796- at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.checkin(ESContentletAPIImpl.java:1955)
979901- at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.checkin(ESContentletAPIImpl.java:1912)
980006- at com.dotmarketing.portlets.contentlet.business.ContentletAPIInterceptor.checkin(ContentletAPIInterceptor.java:256)
980124- at com.dotcms.enterprise.publishing.remote.handler.ContentHandler.a(SourceFile:257)
980209- at com.dotcms.enterprise.publishing.remote.handler.ContentHandler.a(SourceFile:147)
980294- ... 5 more
980306-Caused by: net.sf.hibernate.exception.ConstraintViolationException: could not insert: [com.dotmarketing.portlets.contentlet.business.Contentlet#23df83f2-b7fd-4270-855f-dd3a531ad98a]
980488- at net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:62)
980572- at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
980660- at net.sf.hibernate.persister.AbstractEntityPersister.convert(AbstractEntityPersister.java:1331)
980758- at net.sf.hibernate.persister.NormalizedEntityPersister.insert(NormalizedEntityPersister.java:464)
980858- at net.sf.hibernate.persister.NormalizedEntityPersister.insert(NormalizedEntityPersister.java:426)
980958- at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:37)
981039- at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449)
981108- at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435)
981180- at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2392)
981249- at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261)
981316- at com.dotmarketing.db.HibernateUtil.saveWithPrimaryKey(HibernateUtil.java:819)
981397- ... 13 more
981410-Caused by: org.postgresql.util.PSQLException: ERROR: insert or update on table "contentlet" violates foreign key constraint "fk_contentlet_lang"
981555:  Detail: Key (language_id)=(3) is not present in table "language".
981623- at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
981718- at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
981807- at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
981888- at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
981977- at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
982075- at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334)
982170- at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
982282- at net.sf.hibernate.persister.NormalizedEntityPersister.insert(NormalizedEntityPersister.java:454)
982382- ... 20 more

cfalzone avatar Jan 22 '14 21:01 cfalzone

Passed, pushing content also pushing language.

prasadbhvn avatar Feb 27 '14 10:02 prasadbhvn

@brentgriffin this is not in master-2.5.5

jtesser avatar May 14 '14 12:05 jtesser

Fixed, tested on master-2.5 // MySQL // FF

bryanboza avatar May 20 '14 14:05 bryanboza