Transaction management in BaseX 8.6.4

Wednesday, 8 August 2018 · 3 messages · last reply 9 Aug 2018
MC
Marc Coenegracht8 Aug 2018 22:31 #
Hi, A CMS occasionally recreates some existing databases of a production site. The databases are deleted and again created with the new content within a few seconds. What happens if a read operation is taking place during this process? Can it cause problems with the recreation of the DB or with the BaseX server instance? Of course it is possible to update the databases instead, but this process is a lot simpler and probably faster too. All operations are executed running xquery scripts with REST using the BaseX http server. Marc
CG
Christian Grün8 Aug 2018 23:51 #
Hi Marc, As one XQuery expression is one transaction, the best approach is to define your operations in a single query. If you call db:create, an existing database will be overwritten, and the function allows you to specify some initial input. Hope this helps, Christian
Quoted text · Marc Coenegracht · 20 lines
On Wed, Aug 8, 2018 at 10:31 PM Marc Coenegracht <marc at crosseyed.nl> wrote: > > Hi, > > A CMS occasionally recreates some existing databases of a production site. > The databases are deleted and again created with the new content within > a few seconds. > > What happens if a read operation is taking place during this process? Can > it cause problems with the recreation of the DB or with the BaseX server > instance? > > Of course it is possible to update the databases instead, but this process > is a lot simpler and probably faster too. > > All operations are executed running xquery scripts with REST using the > BaseX http server. > > > Marc
CG
Christian Grün9 Aug 2018 08:28 #
Hi Marc (cc to the list), If the database replacement is defined as a single REST operation, you won’t encounter any problems; other transactions will need to wait until your database has been fully created. Best, Christian
Quoted text · Christian Grün · 57 lines
Marc Coenegracht <marc at crosseyed.nl> schrieb am Do., 9. Aug. 2018, 00:21: > Hi Christian, > > Thanks for the quick answer. > > Defining the operations in a single query would be preferable but isn't > possible, since the read operation is simply triggered by a website > visitor, and the creation of the new DB (indeed overwriting the old DB > with db:create) is performed by an action of the CMS admin. > > So, these operations can happen at the exact same moment. The > inconvenience at the front-end will be minimal, I'm just wondering if > these concurrent operations can cause problems with BaseX or the > db:create operation. > > best, > Marc > > On Wed, 8 Aug 2018, Christian Grün wrote: > > > Hi Marc, > > > > As one XQuery expression is one transaction, the best approach is to > > define your operations in a single query. If you call db:create, an > > existing database will be overwritten, and the function allows you to > > specify some initial input. > > > > Hope this helps, > > Christian > > > > > > > > On Wed, Aug 8, 2018 at 10:31 PM Marc Coenegracht <marc at crosseyed.nl> > wrote: > >> > >> Hi, > >> > >> A CMS occasionally recreates some existing databases of a production > site. > >> The databases are deleted and again created with the new content within > >> a few seconds. > >> > >> What happens if a read operation is taking place during this process? > Can > >> it cause problems with the recreation of the DB or with the BaseX server > >> instance? > >> > >> Of course it is possible to update the databases instead, but this > process > >> is a lot simpler and probably faster too. > >> > >> All operations are executed running xquery scripts with REST using the > >> BaseX http server. > >> > >> > >> Marc > >

⚡Generated with XQuery