Changes

Jump to navigation Jump to search
246 bytes added ,  14:50, 15 January 2013
=Concurrency Control=
BaseX 7.5.1 introduces locking on database level. Writing transactions do not necessarily block all other transactions any more. The number of parallel transactions can be limited by setting the [[Options#PARALLEL|PARALLEL option]]option.
==Transaction Monitor==
The transaction monitor ensures that just one writing transaction or an arbitrary amount of reading transactions ''per database'' are active at the same time.
Deadlocks are prevented by using preclaiming two phase locking. Execution is starvation-free as lock aquiration is queued per database. Because Due to the specifics of XQuery Update specifies , all updates are written at the end of the query, locking . Locking is strict with the exception that databases for which BaseX recognizes it will not write to are downgraded to read locks.
Locks are not synchronized between multiple BaseX instances. We generally recommend working with the client/server architecture if concurrent write operations are to be performed.
==Limitations==
Database locking is currently is disabled if using the BaseX GuiGUI is used.
As XQuery is a very powerful language, deciding which databases will be accessed by a query is non-trivial. Optimization is work in progress. Databases locked by a query are listed in the GUI's [[GUI#Visualizations|Info View]] and on the command line client if [[Options#QUERYINFO|QUERYINFO]] is set. If you think too much is locked, please give us a note on our [http://basex.org/open-source/ mailing list] with some example code.
Currently identifying The current identification of which databases to lock is limited to queries that access the currently opened database calls directly addressing databases without references (, functions that explicitly specify a database, or none expressions that address no database at all).
Some examples on database-locking enabled queries:
* {{Code|CREATE DB newdb}}, write-locking of "newdb"* {{Code|ADD input.xml}}, write-locking of the database opened by a client* {{Code|//*}, read-locking of the database opened by a client* {{Code|doc('factbook')}}, read-locking of "factbook"* {{Code|collection('db/path/to/docs')}}, read-locking of "db"
* {{Code|fn:sum(1 to 100)}}, locking nothing at all
* {{Code|delete nodes doc('test')//*[string-length(local-name(.)) > 5]}}, write-locking of "test"* {{Code|CREATE DB newdb}}, write-locking "newdb"
All of these queries can be executed in parallel.
Some examples on queries that are not supported by database-locking yet:
* <code>let $db := 'factbook' return doc($db)</code>, will read lock globally: referencing database names isn't isn’t supported yet
* {{Code|for $db in ('factbook') return doc($db)}}, will read lock globally: ditto
* {{Code|doc(doc('test')/reference/text())}}, will read lock globally: ditto
Bureaucrats, editor, reviewer, Administrators
12,951

edits

Navigation menu