Database Reference
In-Depth Information
Write conflict avoidance
Being able to edit a document and have a history of revisions created for you is all
well and good, but what happens if multiple people start editing the document at the
same time, and all wish to save their changes independently?
When two users open the same document—which is, say, at revision 1—and then
make changes, when the first user saves the document he is effectively creating revi‐
sion 2. What should happen when the second user attempts to save her update of
revision 1? Mitigating the issue of revision 2 being overwritten with a new version
based on revision 1 is known in eXist as write conflict avoidance .
As most XML editor clients that connect to eXist have no awareness of resource ver‐
sioning within eXist, if you enable write conflict avoidance, eXist solves that problem
by prohibiting later revisions from being overwritten by updates to earlier revisions.
Figure 16-3 attempts to show how eXist solves this.
As shown in Figure 16-3 , write conflict avoidance comes in two parts:
1. The versioning trigger can be configured to avoid changes being overwritten by
changes to an earlier revision. However, the versioning trigger can respond only
to changes that it knows about. As the changes are potentially coming from a
third-party client application, we need some mechanism to identify revisions
within the documents that are being accessed; this is where the versioning filter
comes in.
2. The versioning filter can be configured to add versioning attributes to the root
element of any document that is retrieved from eXist and is from a collection
that has the versioning trigger enabled on it. When this document is sent back to
eXist, the versioning trigger will see the versioning attributes on the root ele‐
ment, act on them, and, if there is no conflict, remove them before storing the
document into the database. If there is a conflict, it will reject the operation and
prohibit the document from being stored.
If you wish to enable write conflict avoidance, you need to set the overwrite parame‐
ter on the versioning trigger to false in the collection configuration document ( col‐
lection.xconf ), enable the versioning filter in eXist's configuration file
( $EXIST_HOME/conf.xml ), and then restart eXist. To enable the versioning filter,
make sure the following definition is present and uncommented in the serializer
element of the configuration file:
<custom-filter class= "org.exist.versioning.VersioningFilter" />
Search WWH ::




Custom Search