Hi there,
I am finally heading for the first time to use BaseX in a customer project. We need to import XML based product catalogs in different languages. The catalog files should be updated each night without service interruption. What is the best strategy to update and replace an existing document without race condition? Should I uploaded the new version of a catalog under a different filename first and then use REPLACE? Is REPLACE atomic in the sense that an ongoing request will see the „old“ state of the document and new requests will see the new state of the document without any undefined state in between?
Andreas
Hi Andreas,
Is REPLACE atomic in the sense that an ongoing request will see the „old“ state of the document and new requests will see the new state of the document without any undefined state in between?
The transaction manager of BaseX guarantees that there will be no conflicting requests on updated documents (see [1] for more details), so you’ll be safe when using REPLACE.
Should I uploaded the new version of a catalog under a different filename first and then use REPLACE?
This mostly depends on how you use BaseX: If you use our HTTP services (e.g. the PUT method with REST, which is comparable to executing REPLACE), everything could be done in a single step. If you use a separate web server, and only use the client/server architecture of BaseX, uploading the file first may be a good idea.
Feel free to tell us more about your architecture, Christian
Thanks Christian,
sound all good to me.
Andreas
On 1 Aug 2017, at 11:45, Christian Grün wrote:
Hi Andreas,
Is REPLACE atomic in the sense that an ongoing request will see the „old“ state of the document and new requests will see the new state of the document without any undefined state in between?
The transaction manager of BaseX guarantees that there will be no conflicting requests on updated documents (see [1] for more details), so you’ll be safe when using REPLACE.
Should I uploaded the new version of a catalog under a different filename first and then use REPLACE?
This mostly depends on how you use BaseX: If you use our HTTP services (e.g. the PUT method with REST, which is comparable to executing REPLACE), everything could be done in a single step. If you use a separate web server, and only use the client/server architecture of BaseX, uploading the file first may be a good idea.
Feel free to tell us more about your architecture, Christian
basex-talk@mailman.uni-konstanz.de