Concurrency

Tuesday, 6 November 2012 · 5 messages
RK
Rainer Klute6 Nov 2012 14:35 #
I have two independent databases A and B in the same context and would like to access them concurrently. To be precise: I want to read from A while writing to B. However, I seem to run into all kinds of [b]locking problems, i.e. reading from A blocks while writing to B. Is this a bug or a feature? How can I circumvent this? Would using two separate contexts be the only alternative or is there something more sophisticated?
-- Best regards Rainer Klute
CG
Christian Grün6 Nov 2012 14:51 #
You shouldn't encounter any problems if you are accessing the two databases in a single XQuery expression. Could you give some more details on what you've tried so far? ___________________________ Christian Grün Box 188, Uni KN D-78457 Konstanz http://christian-gruen.de
Quoted text · Rainer Klute · 23 lines
On Tue, Nov 6, 2012 at 2:35 PM, Rainer Klute <rainer.klute at itemis.de> wrote: > I have two independent databases A and B in the same context and would > like to access them concurrently. To be precise: I want to read from A > while writing to B. However, I seem to run into all kinds of [b]locking > problems, i.e. reading from A blocks while writing to B. > > Is this a bug or a feature? > > How can I circumvent this? Would using two separate contexts be the only > alternative or is there something more sophisticated? > > -- > > Best regards > Rainer Klute > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
RK
Rainer Klute6 Nov 2012 15:05 #
Quoted text · Christian Grün · 4 lines
On 06.11.2012 14:51, Christian Grün wrote: > You shouldn't encounter any problems if you are accessing the two > databases in a single XQuery expression. Could you give some more > details on what you've tried so far?
Christian, I use a QueryProcessor to fetch the complete database A, and I use the internal API (aka ANode) to navigate the tree up and down in an interactive application (on Android). In parallel, a separate thread creates a separate database B from an XML document. This takes quite some time, and while B is written, the user should be able to navigate A. Hm, I just encountered an OutOfMemoryError; will have to look closer at it...
-- Best regards Rainer Klute
CG
Christian Grün6 Nov 2012 15:15 #
If you call register() on the QueryProcessor, and if your query includes update operations, you won't be able to run other concurrent queries. This may change in a future version of BaseX. I would indeed recommend to include all read and write operations in a single XQuery, even if it may take some time to get to know the nuts and bolts of the language. Christian
Quoted text · Christian Grün · 21 lines
On Tue, Nov 6, 2012 at 3:05 PM, Rainer Klute <rainer.klute at itemis.de> wrote: > On 06.11.2012 14:51, Christian Grün wrote: >> You shouldn't encounter any problems if you are accessing the two >> databases in a single XQuery expression. Could you give some more >> details on what you've tried so far? > > Christian, I use a QueryProcessor to fetch the complete database A, and > I use the internal API (aka ANode) to navigate the tree up and down in > an interactive application (on Android). In parallel, a separate thread > creates a separate database B from an XML document. This takes quite > some time, and while B is written, the user should be able to navigate A. > > Hm, I just encountered an OutOfMemoryError; will have to look closer at > it... > > -- > > Best regards > Rainer Klute > >
RK
Rainer Klutein reply to Rainer Klute, 6 Nov 2012, 15:056 Nov 2012 15:18 #
Quoted text · Rainer Klute · 9 lines
On 06.11.2012 15:05, Rainer Klute wrote: > Christian, I use a QueryProcessor to fetch the complete database A, and > I use the internal API (aka ANode) to navigate the tree up and down in > an interactive application (on Android). In parallel, a separate thread > creates a separate database B from an XML document. This takes quite > some time, and while B is written, the user should be able to navigate A. > > Hm, I just encountered an OutOfMemoryError; will have to look closer at > it...
Ah, it seems my database got corrupted due to an interrupted import (CreateDB). I guess I have to use the Inspect command to check its integrity.
-- Best regards Rainer Klute

⚡Generated with XQuery