There is 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-a1c40e44-1ac5-4a8e-8a3c-48199dffcabf XWIKI-22643 Open

Documents can be saved at the same time, leading to lost writes

 
View issue   ยท   Add comment
 

1 comment

 
cid:jira-generated-image-avatar-f24c9cc7-8eeb-47ac-a519-f914393b596c Michael Hamann on 08/Oct/26 16:58
 

Proposed fix: https://github.com/xwiki/xwiki-platform/pull/6687

  • The store now checks inside the save transaction, with a pessimistic lock on the document row, that the stored revision is still the one the saved document was loaded from. A save that loses a race throws the new DocumentRevisionConflictException instead of overwriting the other save. This also covers a document saved as new that was created in the meantime, and cluster setups.
  • XWiki#addUserToGroup (the scenario of this issue), attachment uploads from the WYSIWYG editor (XWiki.WYSIWYG.FileUploader) and the save action retry on that conflict. The save action merges again, so a concurrent save that doesn't conflict, e.g. another user adding an attachment, no longer shows any error.
  • Scripts can retry too, with $services.merge.isDocumentRevisionConflict, and Java code with XWiki#updateDocument.
  • The check can be disabled with store.revisionCheck.enabled in xwiki.properties.

This was also behind some failures of RealtimeWYSIWYGEditorIT#dragAndDropFilesAtTheSameTime (XWIKI-22619): two users dropping files into a new page at the same time, and the second upload failed. On MySQL, MariaDB, PostgreSQL and Oracle, concurrent uploads forced into the race were all detected and retried, and every attachment was kept.