Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-21799

Event statuses are not stored anymore in subwiki DB

    XMLWordPrintable

Details

    • Unknown
    • N/A
    • N/A

    Description

      I noticed the following stack trace when trying to use evenstream.usemainstore=false on XWiki 14.10.20 with subwikis:

      2024-01-12 15:04:12,026 [Asynchronous handler for event store [legacy]] ERROR o.h.e.j.s.SqlExceptionHelper   - integrity constraint violation: foreign key no parent ; FKMWU6UXKC2JL3YVEJ4WI1P0PV0 table: ACTIVITYSTREAM_EVENTS_STATUS value: 1242347565-1705068200000-lYdSS0tw 
      2024-01-12 15:04:12,026 [Asynchronous handler for event store [legacy]] ERROR .x.x.s.XWikiHibernateBaseStore - Exception while close transaction 
      javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
      	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
      	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
      	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
      	at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1411)
      	at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:489)
      	at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3303)
      	at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2438)
      	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:449)
      	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:183)
      	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$300(JdbcResourceLocalTransactionCoordinatorImpl.java:40)
      	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:281)
      	at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:101)
      	at com.xpn.xwiki.internal.store.hibernate.HibernateStore.endTransaction(HibernateStore.java:940)
      	at com.xpn.xwiki.store.XWikiHibernateBaseStore.execute(XWikiHibernateBaseStore.java:840)
      	at com.xpn.xwiki.store.XWikiHibernateBaseStore.executeWrite(XWikiHibernateBaseStore.java:948)
      	at org.xwiki.eventstream.store.internal.LegacyEventStatusManager.lambda$saveEventStatusInStore$2(LegacyEventStatusManager.java:188)
      	at com.xpn.xwiki.internal.namespace.DefaultNamespaceContextExecutor.execute(DefaultNamespaceContextExecutor.java:63)
      	at org.xwiki.eventstream.store.internal.LegacyEventStatusManager.saveEventStatusInStore(LegacyEventStatusManager.java:184)
      	at org.xwiki.eventstream.store.internal.LegacyEventStatusManager.saveEventStatus(LegacyEventStatusManager.java:150)
      	at org.xwiki.eventstream.store.internal.AbstractLegacyEventStore.syncSaveEventStatus(AbstractLegacyEventStore.java:94)
      	at org.xwiki.eventstream.internal.AbstractAsynchronousEventStore.processTask(AbstractAsynchronousEventStore.java:396)
      	at org.xwiki.eventstream.internal.AbstractAsynchronousEventStore.processTasks(AbstractAsynchronousEventStore.java:345)
      	at org.xwiki.eventstream.internal.AbstractAsynchronousEventStore.run(AbstractAsynchronousEventStore.java:327)
      	at java.base/java.lang.Thread.run(Thread.java:840)
      Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement
      	at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:59)
      	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:37)
      	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
      	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
      	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:200)
      	at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:46)
      	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3375)
      	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3937)
      	at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:107)
      	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604)
      	at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:478)
      	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
      	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:475)
      	at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:344)
      	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:40)
      	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
      	at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1407)
      	... 20 common frames omitted
      

      I investigated a bit and I discovered that we are apparently never using the proper wiki context to store the event statuses: as a matter of fact, they are always only stored in the main DB, even if eventstream.uselocalstore is set to true and we are storing the events in both main and subwiki DBs.
      I checked on 11.10.13 and it's a regression compared to it: we used to properly store a duplicate of the event statuses too in subwiki DBs.

      Attachments

        Activity

          People

            surli Simon Urli
            surli Simon Urli
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: