I've written a process using the Java BaseXClient to load XML documents to one database (A) and save a small amount of data about each document in a second database (B) using a parallel document path. The data in (B) includes a sha1 hash which is used to determine if the source XML document has changed or not to avoid unnecessary reloading. With database (A) the replace command is used to import documents. With database (B) a query is run to get the current sha1 hash (if any) and the db:replace() function is used to create/update a document for each document in (A). This works well for small sets of documents, often loading several documents per second. However after 1,000 - 4,000 documents it eventually crashes with this exception:
[bxerr:BXDB0002] Database (B) is being updated, or update was not completed.
The exception is thrown when reading the sha1 hash from (B). After this exception, it's not possible to connect to database (B) even with the BaseX GUI unless I manually delete the upd.basex file. I have to delete both databases and try again. No other processes are accessing the databases.
It seems like this problem is related to the high number of reads and writes happening on (B).
Has anyone encountered a similar problem or have any suggestions?
Thanks, Vincent