Uploaded image for project: 'FishEye'
  1. FishEye
  2. FE-5270

repository comments may not be deleted on repository deletion

    XMLWordPrintable

Details

    Description

      When deleting a repository all the FishEye changeset comments should be deleted. FishEye attempts to do that, but fails occasionally with the error included below. This is caused by comment threads where DB attempts to delete parent comment reply for was not deleted yet.
      Observed on HSQLDB

      2014-07-11 13:14:04,392 ERROR [qtp1324262781-422 ] com.atlassian.event.internal.AsynchronousAbleEventDispatcher AsynchronousAbleEventDispatcher$1$1-run - There was an exception thrown trying to dispatch event [com.atlassian.fisheye.event.RepositoryDeletedEventImpl@7af6eac8] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.atlassian.fisheye.model.managers.DefaultChangesetCommentManager.onRepositoryDeleted(com.atlassian.fisheye.event.RepositoryDeletedEvent), listener=com.atlassian.fisheye.model.managers.DefaultChangesetCommentManager@2b4bcd6e}]
      java.lang.RuntimeException: could not execute update query
      ...
      Caused by: org.hibernate.exception.ConstraintViolationException: could not execute update query
              at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
              at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
              at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:110)
              at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:421)
              at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:283)
              at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1278)
              at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:117)
              at com.atlassian.fisheye.model.managers.DefaultChangesetCommentManager$5.doInTransaction(DefaultChangesetCommentManager.java:236)
              at com.atlassian.fisheye.model.managers.DefaultChangesetCommentManager$5.doInTransaction(DefaultChangesetCommentManager.java:233)
              at com.atlassian.fisheye.spi.impl.DefaultTxTemplate.execute(DefaultTxTemplate.java:108)
              at sun.reflect.GeneratedMethodAccessor193.invoke(Unknown Source)
      ...
      Caused by: java.sql.SQLException: Integrity constraint violation FK1C588BB9195A8AC5 table: CRU_CHANGESET_COMMENT in statement [delete from cru_changeset_comment where cru_repository=?]
              at org.hsqldb.jdbc.Util.throwError(Unknown Source)
              at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
              at com.jolbox.bonecp.PreparedStatementHandle.executeUpdate(PreparedStatementHandle.java:203)
              at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:101)
              ... 200 more
      

      Actual constraint:

      alter table cru_changeset_comment add constraint FK1C588BB9195A8AC5 foreign key (cru_reply_to_comment_id) references cru_changeset_comment;
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pswiecicki Piotr Swiecicki
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: