[ 
https://issues.apache.org/jira/browse/OPENJPA-2963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18110839#comment-18110839
 ] 

ASF subversion and git services commented on OPENJPA-2963:
----------------------------------------------------------

Commit db2cd9d06a3337961a7712dac6ad23b1cdee6b93 in openjpa's branch 
refs/heads/OPENJPA-2963 from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=db2cd9d06 ]

[OPENJPA-2963] Track dropped tables per database, not per JVM

The dropped-table tracking was one JVM-global set, and clearDroppedTables()
is called whenever any factory with schema generation properties starts up,
so two persistence units initializing at once wiped each other's in-flight
tracking. Keys were bare table names too, so two units on different
databases with a table of the same name aliased onto one entry.

The set is now partitioned by the database a configuration connects to, and
the clear only empties that database's entry. The state stays static: it has
to outlive the configuration that wrote it, because generateSchema() closes
its own factory and a later factory is expected to see what it dropped,
which TestSchemaGenDrop pins. Moving it onto the configuration, as the issue
suggests, would leave it with no readers and break that test. Every access
now holds one monitor, including the trace line, which previously
interpolated the live set while another thread could be writing to it.

The locale half of the issue no longer applies: 53269ab8a already gave every
one of those call sites Locale.ROOT, and the line numbers in the issue are
from before it.

Not addressed here, and worth their own issues: the DDL name matching still
compares a regex-stripped fragment of the raw statement against a
schema-qualified identifier, so it misses and over-matches in several
shapes; and it is claimed that a drop-and-create with a script drop source
suppresses the create it is paired with, which I could not reproduce.


> Static _droppedTables shared across concurrent EMFs
> ---------------------------------------------------
>
>                 Key: OPENJPA-2963
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2963
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Maxim Solodovnik
>            Priority: Major
>
> Discussion thread: 
> https://github.com/apache/openjpa/pull/144#discussion_r3683002126
> **(medium)** `_droppedTables` is JVM-global static mutable state and 
> `clearDroppedTables()` is invoked from JDBCBrokerFactory whenever any EMF 
> with schema-gen properties spins up - with two persistence units initializing 
> concurrently (common in app servers) one EMF wipes the other's in-flight 
> tracking. Matching also uses `toUpperCase()` without `Locale.ROOT` (here, 
> line 1239 and 1519-1529) and compares a full identifier against a name 
> regex-stripped from raw DDL, so schema-qualified or quoted names will not 
> match. Could this state live on the configuration instead?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to