Editing shared draft shows an old version of the page

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.



Problem

When Collaborative Editing is enabled, editing a page appears to display an old version of the page as the Shared Draft instead of the most recently published version of that page. This can result in changes being made to an old version of the page and then published as the live page.


Cause

At the database level, the contents of the Shared Draft is a copy of the old version of the page.

The scenarios described in CONFSERVER-57458 - Getting issue details... STATUS and in  CONFSERVER-58270 - Getting issue details... STATUS are a way of hitting this problem. We still don't have a full visibility of other scenarios that may trigger it.

Diagnosis

Diagnosis 1

Visually, you are able to identify the difference on the Shared Draft is vastly different to the latest Published copy of the page.

Diagnosis 2

If there are subtle changes in the front end, we can try to inspect the database to check whether the saved draft is actually a copy of an old draft version of the page.

  1. Grab the Confluence page ID from the published page we wish to delete the draft from:
    1. Navigate to the published page in Confluence
    2. Hover over the Edit button (but do not click on it)
    3. In the URL status bar, you will see something like http://localhost:8090/pages/editpage.action?pageId=123456
    4. Keep note of the above pageId (i.e. 123456) for the below database SQL
  2. Run the following SQL to retrieve all published versions of the page and the active shared draft:

    select * from CONTENT where contentid = <published_pageid> or prevver=<published_pageid>;
    select * FROM BODYCONTENT where contentid in (select contentid from CONTENT where contentid = <published_pageid> or prevver=<published_pageid>);


    1. This is a sample set of the result set that came back in my local instance for my test pageId 128713064:

      CONTENT:

      contentidcontenttypehibernateversiontitlelowertitleversioncreatorcreationdatelastmodiferlastmoddateprevvercontent_status
      128713069PAGE35My Test Pagemy test page1ff8080004abc958b014ghi002jk100002016-12-20 17:06:54.096ff8080004abc958b014ghi002jk100002017-01-03 08:02:44.538128713064draft
      128713071PAGE16My Test Pagemy test page1ff8080004abc958b014ghi002jk100002016-12-20 17:01:02.694ff8080004abc958b014ghi002jk100002016-12-20 17:06:50.41128713064current
      152438586PAGE28My Test Pagemy test page4ff8080004abc958b014ghi002jk100002016-12-20 17:01:02.694ff8080004abc958b014ghi002jk100002017-01-03 08:02:44.547128713064current
      128713064PAGE60My Test Pagemy test page17ff8080004abc958b014ghi002jk100002016-12-20 17:01:02.694ff8080004abc958b014ghi002jk100002018-02-05 15:20:12.06
      current

         -  Content Id 128713069 (yellow row): This is the shared draft row and there should only be one content_status='draft' row.
         -  Content Id 128713064 (green row): This is the active published page row and there should only be one row that has content_status='current' and prevver=null for this page.
         - The above remaining rows (white rows) are the historic published page versions.

      BODYCONTENT:

      bodycontentidbodycontentid
      128843932<p class=""auto-cursor-target"">hello world 123<br /></p>128713069
      128843933<p class=""auto-cursor-target"">hello world 123<br /></p>128713071
      152471012<p class=""auto-cursor-target"">hello world 456<br /></p>152438586
      128843929<p class=""auto-cursor-target"">hello world 888<br /></p>128713064
    2. From the above BODYCONTENT results, assuming there were no changes to the draft, we expected the BODYCONTENT.body for row bodycontentid 128843932 (i.e. the shared draft) to be the same as the BODYCONTENT.body for row bodycontentid 128843929 (i.e. the latest published page) - which it isn't

    3. If we then compare the BODYCONTENT.body with the other BODYCONTENT rows, we find that it is an exact match of bodycontentid 128843933
    4. BODYCONTENT.bodycontentid 128843933 has contentid 128713071 and jumping back to CONTENT.contentid=128713071, this belongs to a hibernateversion 16 which was last modified on 2016-12-20 17:06:50.41!
    5. In this specific example, we clearly can see that the shared draft is a copy of an old version of the page

    In some cases, in step 2 (c) above, it may not be an exact match if the user had already made significant changes to the draft page. We therefore search for random snippets of BODYCONTENT.body to see how much of the draft page matches to another older draft to identify if the draft was indeed modified from an old draft rather than the latest published page.

Workaround

Workaround 1 - Disable Collaborative Editing

Disabling Collaborative Editing is the fastest temporary work around to ensure only the latest copy of the published page is presented as the editing draft.

  • Navigate to Confluence Administration » Collaborative Editing » Disable Collaborative Editing


(info) Note that turning Collaborative Editing off and on does not fix the problem - re-enabling Collaborative Editing could still bring back the old version of the shared draft.


Work around 2 - Upgrade to Confluence 6.9

Confluence 6.9 introduced the ability to Revert to last published version:


Based on your feedback, we've made some changes to the editor footer. A new ellipsis () menu gives you the option to:

  • preview the page
  • view all changes since the page was last published
  • revert back to the last published version
  • delete the page, if it has never been published.




  • Upgrade to Confluence 6.9 to provide end users the ability to revert to last published page.
  • As always, please test the upgrade in a Staging Environment before applying the upgrade to Production.


(info) However, users still need to be aware that the page they have edited pulled back an old version of the page.


Workaround 3 - Purge the shared draft for a single page from the database

This work around purges the Shared Draft for a single page so editing that one page will create a new Shared draft based on the latest published copy of that page. This work around will need to be applied to each individual page that you wish to purge the shared draft.

  1. Grab the Confluence page ID from the published page we wish to delete the draft from:
    1. Navigate to the published page in Confluence
    2. Hover over the Edit button (but do not click on it)
    3. In the URL status bar, you will see something like http://localhost:8090/pages/editpage.action?pageId=nnnnnn
    4. Keep note of the above pageId (i.e. nnnnnn) for the below database SQL
  2. Navigate to Confluence Administration » General Configuration » Collaborative Editing » Disable Collaborative Editing
  3. Shutdown Confluence
  4. (warning) Backup the Confluence Database
  5. Run the following SQL to purge out the draft for a single page:

    Substitute <PAGEID> with the above Page ID
    delete from CONFANCESTORS;
    
    delete from CONTENTPROPERTIES where CONTENTID in (select CONTENTID from CONTENT where contenttype = 'PAGE' and content_status = 'draft' and title is not null and prevver is not null and prevver = <PAGEID>);
    
    delete from USERCONTENT_RELATION where targetcontentid in (select CONTENTID from CONTENT where contenttype = 'PAGE' and content_status = 'draft' and title is not null and prevver is not null and prevver = <PAGEID>);
    
    delete from BODYCONTENT where contentid in (select CONTENTID from CONTENT where contenttype = 'PAGE' and content_status = 'draft' and title is not null and prevver is not null and prevver = <PAGEID>);
    
    delete FROM links where contentid in (select CONTENTID from CONTENT where contenttype = 'PAGE' and content_status = 'draft' and title is not null and prevver is not null and prevver = <PAGEID>);
    
    delete from CONTENT where contentid in (select CONTENTID from CONTENT where contenttype = 'PAGE' and content_status = 'draft' and title is not null and prevver is not null and prevver = <PAGEID>);
    
    TRUNCATE TABLE "EVENTS";
    TRUNCATE TABLE "SNAPSHOTS";
    TRUNCATE TABLE "SECRETS";
  6. Start up Confluence
  7. Rebuild the Ancestor Table
  8. Rebuild the search indexes
  9. Navigate to Confluence Administration » General Configuration » Collaborative Editing » Enable Collaborative Editing
  10. Check that Editing the affected page now brings back the latest version

Workaround 4 - Purge ALL the shared drafts from the database

This work around is the best permanent fix and will restore confidence that editing any page will create a new Shared Draft based on the latest published copy of pages.

  1. Ask users to save any content of the draft they wish to keep into a temporary document
  2. Follow the instructions at How to remove all shared drafts and start with a clean slate using Collaborative Editing


Last modified on May 9, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.