Hello,

we use h2 database internally in this application<http://www.jetprofiler.com> - 
users can save and load data using BACKUP TO ... and Restore.execute(...). 
Multiple instances of the application are allowed, and the h2 file lock 
mechanism is used to avoid using the same workspace database per instance. 
If an instance fails to open the workspace because 
of DATABASE_ALREADY_OPEN_1 or ERROR_OPENING_DATABASE_1, we create a new 
second workspace and so on.

The problem: If instance A of the application is started and begins a 
lengthy Restore-operation, and a new instance B is started, it will 
overwrite A's workspace since the A's file lock is not in place until after 
the database itself has been opened. The error is:

java.lang.ClassCastException: org.h2.index.PageDataLeaf cannot be cast to 
org.h2.store.PageStreamTrunk

probably because the page store gets corrupted by concurrent writing from 
two different processes. More information on the error can be found 
here<http://www.jetprofiler.com/forum/discussion/80/enterprise-jetprofiler-saved-jpp--monitoring-crash/>
.

I know this might not classify as a bug, but may I suggest that you add a 
FileLock to the Restore-operation to make it thread-safe? Alternatively, I 
can write my own file locks.

Best regards,
Bjorn

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/2UESn8eq2ucJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to