From: Christian Grün <christian.gruen@gmail.com>Subject: Re: [basex-talk] Global locks
Date: 11 February 2019 at 12:27:37 GMT
Hi Andy,
The current behavior is correct indeed – but it might not be what one
expects. Currently, we are…
a) collecting all static database references in the query and
b) assigning either read or write locks to these databases, depending
if the overall query is updating or not.
The reason is that it’s often tricky to determine statically (i.e.,
while parsing the query and before compiling and optimizing it) which
databases will be accessed for read or write operations without
analyzing the query in more detail. An arbitrary example:
let $db := db:open('db1')
return insert node <new/> into $db/*
We would need to follow the variable reference in order to find out if
db1 will be updated. In simple queries such as yours, however, this
might be possible; I’ll have some more thoughts on that.
Cheers
Christian