Follow-up, some details:
* Create large (5GB) DB in BaseX GUI * Copy DB folder manually to another server * Optimize DB * The first db:replace() via RESTXQ creates a second file with the same base-uri() * The second db:replace() via RESTXQ replaces the earlier created second file (duplicate)
I cannot reproduce with a small newly created db. The initial database was created with BaseX 9.0.2, update operation runs with BaseX 9.2.1
Should I try to optimize the database with 9.1.2 before copying and try again? Perhaps this is a database-structure related issue?
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Montag, 29. April 2019 16:00 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] db:replace() in DBA resulting in duplicates
Still, when I browse the database, the /DB/path only exists once (as far as I can
see from the sorting), but querying is giving me two documents, according to db:path() living in the same path.
This should never happen, should it?
This is surprising indeed.
Right now, db:add is still faster than db:replace, because the check for existing database paths can be completely skipped. This allows high-performance database insertions.In a future version of BaseX, I would love to get rid of db:add and db:replace and replace these functions with a db:update function, which will enforce that each document path exists only once in the database. This would surely reduce patterns like the one you encountered.
If you still manage to get this reproduced, just come back to us.