Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-31879

Unable to Purge Trash, Unable to Successfully Delete Space, Page Watchers Are Not Visible After Upgrade to 5.3.x Because CONTENTID Column Is NULL (PAGEID Data Were Not Migrated To CONTENTID In NOTIFICATIONS Table)

      Possibly there is an underlying bug in the upgrade task to 5.3.x when the database in use is MS SQL Server. In 5.3.x, PAGEID column should be replaced with CONTENTID instead in NOTIFICATIONS table, but for this case somehow both columns exist and the value in CONTENTID column is all NULL. Somehow the migration task did not migrate PAGEID data in NOTIFICATIONS table to CONTENTID column and drop the PAGEID column.

      This causes three different issues so far:

      1. Unable to purge a trash or any trash at all. The issue occurred after an upgrade to 5.3.x and the following appears in the atlassian-confluence.log:
        2013-10-22 13:33:13,681 ERROR [http-8090-2] [sf.hibernate.util.JDBCExceptionReporter] logExceptions The DELETE statement conflicted with the REFERENCE constraint "FK594ACC88C38FBEA". The conflict occurred in database "confluence", table "dbo.NOTIFICATIONS", column 'PAGEID'.
         -- url: /pages/dopurgetrashitem.action | userName: admin | referer: http://confluence:8090/pages/purgetrashitem.action?key=PLAY&contentId=30114153 | action: dopurgetrashitem
        
      2. Space deletion seems successful however all users still able to access the deleted space (rebuilding the index didn't make any difference) and the following appears in the atlassian-confluence.log:
        2013-11-27 22:05:32,216 ERROR [Long running task: Space removal long running task] [atlassian.event.internal.AsynchronousAbleEventDispatcher] run There was an exception thrown trying to dispatch event 'com.atlassian.confluence.event.events.space.SpaceRemoveEvent[source=com.atlassian.confluence.spaces.DefaultSpaceManager@4e636bd6]' from the invoker 'SingleParameterMethodListenerInvoker{method=public void com.atlassian.confluence.plugins.createcontent.listeners.RemoveSpaceListener.onSpaceRemoveEvent(com.atlassian.confluence.event.events.space.SpaceRemoveEvent), listener=com.atlassian.confluence.plugins.createcontent.listeners.RemoveSpaceListener@779a9a3f}'.
         -- space: 17596426 | url: /conf/spaces/doremovespace.action | userName: admin | referer: http://localhost:8531/conf/spaces/removespace.action?key=AMP7 | action: doremovespace
        java.lang.RuntimeException: deleted object would be re-saved by cascade (remove deleted object from associations): 17596426, of class: com.atlassian.confluence.spaces.Space; nested exception is net.sf.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): 17596426, of class: com.atlassian.confluence.spaces.Space
            at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54)
         
        Caused by: net.sf.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): 17596426, of class: com.atlassian.confluence.spaces.Space
            at net.sf.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:778)
            at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:756)
            at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1401)
            at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
         
      3. After an upgrade to 5.3.x, you can no longer see the list of page watchers although there were users watching the page before the upgrade. When you look into the NOTIFICATIONS table, the watch notifications were listed there and they were tied to the correct usernames. However they were referencing to PAGEID instead of CONTENTID. CONTENTID is all NULL instead.
      Resolution

      All of the above can be fixed by implementing the steps below:

      1. Stop Confluence
      2. Backup Confluence database and Home Directory.
      3. Run the following SQL query to copy the PAGEID values into the CONTENTID column
        UPDATE NOTIFICATIONS SET CONTENTID = PAGEID WHERE PAGEID IS NOT NULL;
        
      4. Run the following query to drop the PAGEID Foreign Key constraint (double check the actual key name in the NOTIFICATIONS table)
        ALTER TABLE NOTIFICATIONS DROP FK594ACC88C38FBEA;
        
      5. Run query to drop the index on the PAGEID column
        drop index NOTIFICATIONS.n_pageid_idx;
        
      6. Run this query to drop the actual PAGEID column
        ALTER TABLE NOTIFICATIONS DROP COLUMN PAGEID;
        
      7. Start Confluence
      8. You should now be able to purge the trash, delete any space, and see a list of page watchers in Watch > Manage Watchers.
      Important note

      The original bug in the upgrade task has been fixed. This means customers upgrading from Confluence versions lower than 5.3 to 5.4.4+ should no longer be affected by this.

      However if you have previously upgraded from an older version of Confluence and are affected by this problem upgrading again to Confluence 5.4.4+ will NOT rerun the upgrade task. Therefore for customers in this situation it is still necessary to run the workaround, since upgrading alone is not sufficient to fix this problem.

            [CONFSERVER-31879] Unable to Purge Trash, Unable to Successfully Delete Space, Page Watchers Are Not Visible After Upgrade to 5.3.x Because CONTENTID Column Is NULL (PAGEID Data Were Not Migrated To CONTENTID In NOTIFICATIONS Table)

            John Price added a comment -

            I am on Confluence 5.7.4 and have been trying for several versions to update my demo space using https://confluence.atlassian.com/pages/viewpage.action?pageId=331914443. I finally figured out that this issue was the problem - it was somewhat masked. I followed the instructions above to update the db schema manually and then was able to purge the trash and also delete the space.

            John Price added a comment - I am on Confluence 5.7.4 and have been trying for several versions to update my demo space using https://confluence.atlassian.com/pages/viewpage.action?pageId=331914443 . I finally figured out that this issue was the problem - it was somewhat masked. I followed the instructions above to update the db schema manually and then was able to purge the trash and also delete the space.

            tshobbs added a comment -

            Yes, still having this issue in latest release.

            tshobbs added a comment - Yes, still having this issue in latest release.

            Agreed. Attempted an upgrade from 5.0 to latest. It's not resolved in the latest installer.

            Systems Group added a comment - Agreed. Attempted an upgrade from 5.0 to latest. It's not resolved in the latest installer.

            This bug is not fixed. Please reopen it. Thanks.

            Adhip Pokharel added a comment - This bug is not fixed. Please reopen it. Thanks.

            The issue occurs in 5.6.6 too. Just followed the Resolution per Atlassian's Tech Support and it is now resolved. We were unable to move some pages within the same space and this is how we found out about this issue when trying to purge trash.

            Adhip Pokharel added a comment - The issue occurs in 5.6.6 too. Just followed the Resolution per Atlassian's Tech Support and it is now resolved. We were unable to move some pages within the same space and this is how we found out about this issue when trying to purge trash.

            Problem occurs in 5.5.6 too!

            Christoph Giess added a comment - Problem occurs in 5.5.6 too!

            5.4.4 Still seeing this problem. MS SQL Server 2008 R2

            Roman Serazhiev (Inactive) added a comment - 5.4.4 Still seeing this problem. MS SQL Server 2008 R2

            Never mind, manually ran the migrations and was able to purge trash properly. Would have been nice if newer versions could have applied this fix automatically rather than having to do it manually. Shouldn't be that difficult to check if the column PAGEID is still on the NOTIFICATIONS table or not before running that migration.

            Denis Cabasson added a comment - Never mind, manually ran the migrations and was able to purge trash properly. Would have been nice if newer versions could have applied this fix automatically rather than having to do it manually. Shouldn't be that difficult to check if the column PAGEID is still on the NOTIFICATIONS table or not before running that migration.

            I have the purge trash issue using 5.5.1 Was this fixed implemented in the 5.5.x branch as well?

            Denis Cabasson added a comment - I have the purge trash issue using 5.5.1 Was this fixed implemented in the 5.5.x branch as well?

            Evelin added a comment -

            Hi, we have problems in our productive Confluence (5.4.1) as well as n our staging server (5.5.2).
            5.4.1: We cannot delete spaces but purge pages and view watchers is ok.
            5.2.2: We cannot delete spaces + cannot purge pages but view watchers is ok.
            I will raise a support request.

            Evelin added a comment - Hi, we have problems in our productive Confluence (5.4.1) as well as n our staging server (5.5.2). 5.4.1: We cannot delete spaces but purge pages and view watchers is ok. 5.2.2: We cannot delete spaces + cannot purge pages but view watchers is ok. I will raise a support request.

              dave@atlassian.com dave (Inactive)
              hsuhailah Hanis Suhailah (Inactive)
              Affected customers:
              7 This affects my team
              Watchers:
              39 Start watching this issue

                Created:
                Updated:
                Resolved: