Confluence has been updated to version 6.15.9

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

Whenever there are 2 systems that are updating the same information in a distributed manner, conflicts can arise.

...

This is, of course, a situation to be avoided, because the values on both ends are not the same anymore. 

Introducing ConflictHelper


ConflictHelper is an example of an external script for Jira Server which ensures that updates are only done in a safe way.
The ConflictHelper will calculate for each field that has been updated by a user, the most recent change so that the synchronization transactions can be sequenced, and out of sequence updates avoided.

Deploying the ConflictHelper

The example script can be downloaded from here and deployed on the <jira-home>/scripts folder

Note

This is an example script - just showing how one can avoid update conflicts.


How to use the ConflictHelper

On the outgoing side, use the send method

...

Snippet
if (ConflictHelper.safeUpdate("summary", "description", "status", "resolution", "mood") {
   // update all fields listed as argument
   issue.summary = replica.summary
   issue.description = replica.description
   issue.resolution = nodeHelper.getResolution(replica.resolution?.name)
   issue.customFields."mood".value = replica.customFields."mood"?.value
   Status.receive()
}


How does it work


  • ConflictHelper.send
    is adding a CustomKey with the name 'ConflictHelper.lastUpdated' to the replica. 
    • This is a JSON serialized map of the last update date of each of the fields
    • ConflictHelper calculates this map from the ChangeHistory of the issue
  • ConflictHelper.safeUpdate(fieldname1, fieldname2 ...)
    Will return false if any of the fields in the method call have been updated later than the updates which will be applied.
    For instance, if the issue.summary has been updated after the update of the summary, then the summary should not be overwritten.

Caveats

  • The time clock on all servers must be identical

...