Editing shared draft shows an old version of the page
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
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-57458Getting issue details... STATUS and in - CONFSERVER-58270Getting 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.
- Grab the Confluence page ID from the published page we wish to delete the draft from:
- Navigate to the published page in Confluence
- Hover over the Edit button (but do not click on it)
- In the URL status bar, you will see something like http://localhost:8090/pages/editpage.action?pageId=123456
- Keep note of the above pageId (i.e. 123456) for the below database SQL
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>);
This is a sample set of the result set that came back in my local instance for my test pageId 128713064:
CONTENT:
contentid contenttype hibernateversion title lowertitle version creator creationdate lastmodifer lastmoddate prevver content_status 128713069 PAGE 35 My Test Page my test page 1 ff8080004abc958b014ghi002jk10000 2016-12-20 17:06:54.096 ff8080004abc958b014ghi002jk10000 2017-01-03 08:02:44.538 128713064 draft 128713071 PAGE 16 My Test Page my test page 1 ff8080004abc958b014ghi002jk10000 2016-12-20 17:01:02.694 ff8080004abc958b014ghi002jk10000 2016-12-20 17:06:50.41 128713064 current 152438586 PAGE 28 My Test Page my test page 4 ff8080004abc958b014ghi002jk10000 2016-12-20 17:01:02.694 ff8080004abc958b014ghi002jk10000 2017-01-03 08:02:44.547 128713064 current 128713064 PAGE 60 My Test Page my test page 17 ff8080004abc958b014ghi002jk10000 2016-12-20 17:01:02.694 ff8080004abc958b014ghi002jk10000 2018-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 hascontent_status='current' and prevver=null
for this page.
- The above remaining rows (white rows) are the historic published page versions.
BODYCONTENT:bodycontentid body contentid 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 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
- If we then compare the BODYCONTENT.body with the other BODYCONTENT rows, we find that it is an exact match of bodycontentid 128843933
- 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!
- 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
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.
Workaround 2 - 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.
- Grab the Confluence page ID from the published page we wish to delete the draft from:
- Navigate to the published page in Confluence
- Hover over the Edit button (but do not click on it)
- In the URL status bar, you will see something like http://localhost:8090/pages/editpage.action?pageId=nnnnnn
- Keep note of the above pageId (i.e. nnnnnn) for the below database SQL
- Navigate to Confluence Administration » General Configuration » Collaborative Editing » Disable Collaborative Editing
- Shutdown Confluence
- Backup the Confluence Database
Run the following SQL to purge out the draft for a single page:
Substitute <PAGEID> with the above Page IDdelete 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";
- Start up Confluence
- Rebuild the Ancestor Table
- Rebuild the search indexes
- Navigate to Confluence Administration » General Configuration » Collaborative Editing » Enable Collaborative Editing
- Check that Editing the affected page now brings back the latest version
Workaround 3 - 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.
- Ask users to save any content of the draft they wish to keep into a temporary document
- Follow the instructions at How to remove all shared drafts and start with a clean slate using Collaborative Editing