Hi, Michael,
Comments below.
Michael Watzek wrote:
Hi,
JIRA JDO-13 was filed because a TCK test hangs (org.apache.jdo.tck.lifecycle.PMsCanSharePCClassesButNotPCInstances).
That TCK test starts 5 concurrent threads. Each thread makes an object of class "org.apache.jdo.tck.pc.lifecycle.StateTransitionObj" persistent in a separate transaction. Afterwards, each thread waits for the other threads to finish their transactions. After each threads has finished its transaction, all threads continue execution.
When such a thread makes an object persistent, it increases a counter. After its transaction has finished, it checks that counter and sleeps until the counter equals 5.
Unfortunately, the code is not prepared for exceptions thrown while transactions are executing. In such cases, the counter is not increased and all threads wait forever.
After I fixed this in my workspace, the exception points to the problem:
ERROR 42X05: Table 'STATETRANSITIONOBJ' does not exist.
The files schema1.sql and schema2.sql do not contain that table. Furthermore, I cannot find a .orm file in org/apache/jdo/tck/pc/lifecycle package for that class - neither for datastore identity nor for application identity.
The missing schema and metadata are the subject of JDO-47.
There are .jdo files for both identities. Confusingly, the .jdo file for application identity says datastore identity. I'm not sure if this is a bug, as class "org.apache.jdo.tck.pc.lifecycle.StateTransitionObj" has only two fields and, because of the field names, only one of them seem to be persistent:
private int int_field;
private transient int nonmanaged_field;
However, the .jdo files say that both are persistent. Probably, these files do not comply to TCK20 conventions, as they are no package jdo files?
If it is only one field which is persistent, do we have a problem with application identity? In that case, the field must be the PK.
The jdo files were never modified properly for tck20 because we were planning not to use the tests that require this pc class, but then we decided not to remove the tests. So this is simply unfinished work.
I may as well fix this, because I am changing the schema now anyway. If you fixed it, we would have to merge.
The int_field should be persisistent and is the pk for application identity. We have decided to generally add a column called DATASTORE_IDENTITY to the tables as the pk for datastore identity:
CREATE TABLE <tablename> (
DATASTORE_IDENTITY BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY,
...
CONSTRAINT PT_CONST PRIMARY KEY (DATASTORE_IDENTITY)
);
I am making this change to the metadata and schema right now.
-- Michelle
Summerizing, in addition to the fix in the test code we need to
1) fix the SQL schema
2) add the missing .orm files
3) fix the .jdo files
Eric, Andy, Michelle:
I'm not sure, if the schema is autogenerated or if schema1.sql and/or schema2.sql is used. Can one of you fix the schema issue?
Craig:
I'm not sure which fields of class "org.apache.jdo.tck.pc.lifecycle.StateTransitionObj" are persistent. Can you also help on the application/datastore issue? Is it reasonable to define a second persistent field?
Thanks,
Michael