> I dug further into this problem and found that the root cause is the
> use of the global constraints map in the org.h2.schema.Schema class to
> manage local temporary table constraints. It looks like a similar
> issue was addressed recently for indexes, but not for constraints.
You are right... Sounds like a bug.
I'm not sure what is the best way to solve this problem. One solution
is to add a field "private HashMap localTempTableConstraints" to the
session. Another approach is to add one 'schema' to each session. That
way part of the code can be re-used. But at the moment I would
probably not do that, it sounds more complex.
> concurrent access to the
> constraints and temporaryUniqueNames collections is not threadsafe.
> As a result, a non-unique name can be returned by this method.
That sounds like a bug as well.
> I am working on a patch which will store constraints for local
> temporary tables in the Session object, similar to what is done with
> indexes. This way, all access to the map is done within a single
> Session only. Also, concurrent access to the shared
> temporaryUniqueNames set will have to be synchronized. Please let me
> know if you have any concerns with this approach.
I would like to fix this problem as soon as possible. Please let me
know how far you are with the solution. If you can't finish within the
next days, I will fix it myself.
Thanks a lot for your help!
Regards,
Thomas
Hi,
You are right... Sounds like a bug.
> I dug further into this problem and found that the root cause is the
> use of the global constraints map in the org.h2.schema.Schema class to
> manage local temporary table constraints. It looks like a similar
> issue was addressed recently for indexes, but not for constraints.
I'm not sure what is the best way to solve this problem. One solution
is to add a field "private HashMap localTempTableConstraints" to the
session. Another approach is to add one 'schema' to each session. That
way part of the code can be re-used. But at the moment I would
probably not do that, it sounds more complex.
> concurrent access to theThat sounds like a bug as well.
> constraints and temporaryUniqueNames collections is not threadsafe.
> As a result, a non-unique name can be returned by this method.
I would like to fix this problem as soon as possible. Please let me
> I am working on a patch which will store constraints for local
> temporary tables in the Session object, similar to what is done with
> indexes. This way, all access to the map is done within a single
> Session only. Also, concurrent access to the shared
> temporaryUniqueNames set will have to be synchronized. Please let me
> know if you have any concerns with this approach.
know how far you are with the solution. If you can't finish within the
next days, I will fix it myself.
Thanks a lot for your help!
Regards,
Thomas