Bug 750975

Summary: "Refresh HTML" loses changes I have just made to the XML
Product: [Community] PressGang CCMS Reporter: Misty Stanley-Jones <misty>
Component: Web-UIAssignee: Matthew Casperson <mcaspers>
Status: CLOSED CURRENTRELEASE QA Contact: Misty Stanley-Jones <misty>
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.xCC: cbredesen, lcarlon, lnewson, topic-tool-list
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-02 00:33:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Misty Stanley-Jones 2011-11-03 04:18:22 UTC
[13:52] <misty> When I "Refresh HTML" skynet seems to be reverting changes I made to the actual XML
[13:52] <misty> topic 5398
[13:52] <misty> I have changed the title and the <formlpara> and </formlpara> tags twice now, and when I Refresh HTML, they revert
[14:15] <mcasperson> misty - i think i know what that is. submit a bug and i'll take a look

Comment 1 Matthew Casperson 2011-11-07 02:52:40 UTC
Fixed in 20111107-1246

This was caused by a database race condition:

1. the user edits and saves a topic
2. the saved topic starts a thread to refresh the html view
3. the thread gets a copy of the current topic (possibly with old data depending on whether the XSL transforms had been processed or not)
4. the topic is saved with the changes made by the user
5. the thread renders the HTML, and saves again with the old data

The end result is that it appears that changes to the topic are not saved. However. no data has been lost - the edits made by the user are available under the topic history. Any topics that have been affected can simply copy the XML from the historical version and paste it into the latest version.

The code has been changed so that a background thread will only save the rendered HTML code, and not affect any other fields on the topic. This way the only issue that may arise from the background HTML rendering threads saving a topic entity before the original entity has been update is that an outdated HTML view being saved.