We need to write concurrent transaction tests to show this problem, but it is not very easy at all to do. I spent some weeks experimenting with JCStress. Unfortunately, JCStress is not designed for working with heavy (e.g. slow) test operations (e.g. database operations). I am not sure how to write such tests.
Regardless, the solution I believe is to keep WRITE locks on Documents and Collections for the duration of a transaction. This will likely have a performance impact for eXist-db, but correctness is probably more important than performant data loss ;-)
Even after all the recent work. It is still possible for corruptions to occur in the Journal from concurrent transactions.
This currently affects all versions of eXist-db and the same tests are present in each version branch.
This is a place holder to remind us of:
We need to write concurrent transaction tests to show this problem, but it is not very easy at all to do. I spent some weeks experimenting with JCStress. Unfortunately, JCStress is not designed for working with heavy (e.g. slow) test operations (e.g. database operations). I am not sure how to write such tests.
Regardless, the solution I believe is to keep WRITE locks on Documents and Collections for the duration of a transaction. This will likely have a performance impact for eXist-db, but correctness is probably more important than performant data loss ;-)