Changes

Jump to navigation Jump to search
972 bytes removed ,  12:26, 11 December 2015
no edit summary
BaseX provides support for multiple read and single write operations (using preclaiming and starvation-free two phase locking). This means that read transactions are executed in parallel. If an updating transaction comes in, it will be queued and executed after all previous read transaction have been executed. Subsequent operations will also be queued until the updating transaction has completed.
Each database has its own queue: An update on database A will not block operations on database B. This is under the premise that it can be statically determined (, i.e., before the transaction is evaluated) which databases will be accessed by a transaction: <pre class="brush:java">OPEN db; ADD factbook.xml; CLOSEXQUERY insert node <a/> into db:open('db')/*</pre> In the following example, all databases will be blocked, because the name of the second database, which will be opened in the query, will only be known after having opened the first database: <pre class="brush:xquery">let $db1 := db:open('catalog')//db-namesee [[@id = '123'#Limitations|below]]let $db2 := db:open($db)return delete node $db2//text()</pre> . The number of maximum parallel transactions can be adjusted with the [[Options#PARALLEL|PARALLEL]] option.
==External Side Effects==
===XQuery===
As XQuery is a very powerful language, deciding Deciding which databases will be accessed by a query complex XQuery expression is a non-trivialtask. Optimization is work in progress.The current identification Database detection works for the following types of which databases to lock is limited to queries that access the currently opened database, XQuery functions that explicitly specify a database, and expressions that address no database at all. Some examples on database-locking enabled queries, all of these can be executed in parallel:
* {{Code|//item}}, read-locking of the database opened by a client
* {{Code|delete nodes doc('test')//*[string-length(local-name(.)) > 5]}}, write-locking of "test"
Some examples on All databases will be locked by queries that are not supported by database-locking yetof the following kind:
* <code>let $db := 'factbook' return doc($db)</code>, will read-lock: referencing database names isn’t supported yet* {{Code|for $db in ('factbookdb1', 'db2') return doc($db)}}, will read-lock globally* {{Code|doc(doc('test')/reference/text())}}, will read-lock globally* <code>let $db := 'test' return insert nodes <test/> into doc($db)</code>, will write-lock globally
A list You can consult the query info output (which you find in the [[GUI#Visualizations|Info View]] of all locked databases is output if the GUI or which you can turn on by setting <code>[[Options#QUERYINFO|QUERYINFO]]</code> is set to {{Code|true}}. <!-- and in the GUI's [[GUI#Visualizations|Info View]] --> If you think that too much is ) to find out which databases have been locked, please give us by a note on our [http://basex.org/open-source/ mailing list] with some example codequery.
===GUI===
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu