12-28-05 12:45 PM
[ http://issues.apache.org/jira/browse/JDO-72?page=all ]
Andy Jefferson resolved JDO-72:
-------------------------------
Resolution: Fixed
Assign To: Andy Jefferson (was: Erik Bengtson)
Fixed in JPOX CVS - builds dated 29/12/2005 or later.
Now returns 3 nested exceptions, and the test passes :-)
> Test api.persistencemanager.OptimisticFailure hangs
> ---------------------------------------------------
>
> Key: JDO-72
> URL: http://issues.apache.org/jira/browse/JDO-72
> Project: JDO
> Type: Bug
> Components: tck20
> Environment: JPOX, Derby
> Reporter: Craig Russell
> Assignee: Andy Jefferson
>
> This test is designed to create conflicts in the database from two different JDO t
ransactions. The changes in the cache must not be visible in the datastore or timeou
ts will occur. The exception here occurs when the second optimistic JDO transaction
att
empts to read a row that has been changed in the cache by the first optimistic JDO transacti
on.
> private void runTestOptimistic(PersistenceManager pm1,
> PersistenceManager pm2,
> PersistenceManager pm3) {
> if (!isOptimisticSupported()) {
> if (debug)
> logger.debug("OptimisticFailure tests not run; Optimistic n
ot supported");
> return;
> }
> Transaction tx1 = pm1.currentTransaction();
> Transaction tx2 = pm2.currentTransaction();
> Transaction tx3 = pm3.currentTransaction();
> try {
> tx1.setOptimistic(true);
> tx2.setOptimistic(true);
>
> // create four instances to test
> tx1.begin();
> pm1.makePersistent(p1);
> pm1.makePersistent(p2);
> pm1.makePersistent(p3);
> pm1.makePersistent(p4);
> pm1.makePersistent(p5);
> p1oid = pm1.getObjectId(p1);
> p2oid = pm1.getObjectId(p2);
> p3oid = pm1.getObjectId(p3);
> p4oid = pm1.getObjectId(p4);
> p5oid = pm1.getObjectId(p5);
> tx1.commit();
>
> // update/delete the instances in tx1
> tx1.begin();
> PCPoint p1tx1 = (PCPoint)pm1.getObjectById(p1oid, true);
> PCPoint p2tx1 = (PCPoint)pm1.getObjectById(p2oid, true);
> PCPoint p3tx1 = (PCPoint)pm1.getObjectById(p3oid, true);
> PCPoint p4tx1 = (PCPoint)pm1.getObjectById(p4oid, true);
> p1tx1.setX(101);
> p2tx1.setX(201);
> pm1.deletePersistent(p3tx1);
> pm1.deletePersistent(p4tx1);
>
> // update/delete the instances in tx2
> tx2.begin();
> *** PCPoint p1tx2 = (PCPoint)pm2.getObjectById(p1oid, true); *** this
is where the test hangs ***
> PCPoint p2tx2 = (PCPoint)pm2.getObjectById(p2oid, true);
> PCPoint p3tx2 = (PCPoint)pm2.getObjectById(p3oid, true);
> PCPoint p4tx2 = (PCPoint)pm2.getObjectById(p4oid, true);
> PCPoint p5tx2 = (PCPoint)pm2.getObjectById(p5oid, true);
> p1tx2.setX(102);
> // pm2.deletePersistent(p2tx2); // this should fail but succeeds
due to an RI bug
> p3tx2.setX(202);
> pm2.deletePersistent(p4tx2);
> p5tx2.setX(502); // this change should not be committed
> Set expectedFailedObjects = new HashSet();
> expectedFailedObjects.add(p1tx2);
> // expectedFailedObjects.add(p2tx2);
> expectedFailedObjects.add(p3tx2);
> expectedFailedObjects.add(p4tx2);
>
> // commit tx1 (should succeed)
> tx1.commit();
> tx1 = null;
>
> // commit tx2 (should fail)
> try {
> tx2.commit();
> fail(ASSERTION_FAILED, "concurrent commit not detected");
> }
> catch (JDOOptimisticVerificationException ex) {
> // verify the correct information in the exception
> RUN OptimisticFailure.test[INFO] tck - Exception during setUp or runte
st: <javax.jdo.JDODataStoreException: Fetch request failed: SELECT PCPOINT.
X,PCPOINT.Y,PCPOINT.ID FROM PCPOINT WHERE (PCPOINT.ID = ?)
> [java] NestedThrowables:
> [java] SQL Exception: A lock could not be obtained within the time
requested>javax.jdo.JDODataStoreException: Fetch request failed: SELECT PCP
OINT.X,PCPOINT.Y,PCPOINT.ID FROM PCPOINT WHERE (PCPOINT.ID = ?)
> [java] at org.jpox.store.rdbms.request.FetchRequest.execute(F
etchRequest.java:195)
> [java] at org.jpox.store.rdbms.table.ClassTable.fetch(ClassTa
ble.java:1739)
> [java] at org.jpox.store.StoreManager.fetch(StoreManager.java
:665)
> [java] at org.jpox.state.StateManagerImpl.loadDFGFields(State
ManagerImpl.java:1573)
> [java] at org.jpox.state.StateManagerImpl.loadDefaultFetchGro
up(StateManagerImpl.java:1666)
> [java] at org.jpox.state.StateManagerImpl.validate(StateManag
erImpl.java:3456)
> [java] at org.jpox.AbstractPersistenceManager.getObjectById(A
bstractPersistenceManager.java:2204)
> [java] at org.jpox.AbstractPersistenceManager.getObjectById(A
bstractPersistenceManager.java:2107)
> [java] at org.apache.jdo.tck.api.persistencemanager.Optimisti
cFailure.runTestOptimistic(OptimisticFailure.java:139)
> [java] at org.apache.jdo.tck.api.persistencemanager.Optimisti
cFailure.test(OptimisticFailure.java:83)
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeM
ethodAccessorImpl.java:39)
> [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Del
egatingMethodAccessorImpl.java:25)
> [java] at java.lang.reflect.Method.invoke(Method.java:324)
> [java] at junit.framework.TestCase.runTest(TestCase.java:154)
> [java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:1
81)
> [java] at junit.framework.TestResult$1.protect(TestResult.jav
a:106)
> [java] at junit.framework.TestResult.runProtected(TestResult.
java:124)
> [java] at junit.framework.TestResult.run(TestResult.java:109)
> [java] at junit.framework.TestCase.run(TestCase.java:118)
> [java] at junit.framework.TestSuite.runTest(TestSuite.java:20
8)
> [java] at junit.framework.TestSuite.run(TestSuite.java:203)
> [java] at junit.framework.TestSuite.runTest(TestSuite.java:20
8)
> [java] at junit.framework.TestSuite.run(TestSuite.java:203)
> [java] at junit.textui.TestRunner.doRun(TestRunner.java:116)
> [java] at junit.textui.TestRunner.doRun(TestRunner.java:109)
> [java] at org.apache.jdo.tck.util.BatchTestRunner.start(Batch
TestRunner.java:128)
> [java] at org.apache.jdo.tck.util.BatchTestRunner.main(BatchT
estRunner.java:106)
> [java] NestedThrowablesStackTrace:
> [java] ERROR 40XL1: A lock could not be obtained within the time r
equested
> [java] at org.apache.derby.iapi.error.StandardException.newEx
ception(StandardException.java)
> [java] at org.apache.derby.impl.services.locks.LockSet.lockOb
ject(LockSet.java)
> [java] at org.apache.derby.impl.services.locks.SinglePool.loc
kAnObject(SinglePool.java)
> [java] at org.apache.derby.impl.services.locks.SinglePool.loc
kObject(SinglePool.java)
> [java] at org.apache.derby.impl.store.raw.xact.RowLocking2.lo
ckRecordForRead(RowLocking2.java)
> [java] at org.apache.derby.impl.store.access.heap.HeapControl
ler.lockRow(HeapController.java)
> [java] at org.apache.derby.impl.store.access.heap.HeapControl
ler.lockRow(HeapController.java)
> [java] at org.apache.derby.impl.store.access.btree.index.B2IR
owLocking3.lockRowOnPage(B2IRowLocking3.java)
> [java] at org.apache.derby.impl.store.access.btree.index.B2IR
owLocking3._lockScanRow(B2IRowLocking3.java)
> [java] at org.apache.derby.impl.store.access.btree.index.B2IR
owLockingRR.lockScanRow(B2IRowLockingRR.java)
> [java] at org.apache.derby.impl.store.access.btree.BTreeForwa
rdScan.fetchRows(BTreeForwardScan.java)
> [java] at org.apache.derby.impl.store.access.btree.BTreeScan.
fetchNext(BTreeScan.java)
> [java] at org.apache.derby.impl.sql.execute.TableScanResultSe
t.getNextRowCore(TableScanResultSet.java)
> [java] at org.apache.derby.impl.sql.execute.IndexRowToBaseRow
ResultSet. getNextRowCore(IndexRowToBaseRowResultSe
t.java)
> [java] at org.apache.derby.impl.sql.execute.ProjectRestrictRe
sultSet.getNextRowCore(ProjectRestrictResultSet.java)
> [java] at org.apache.derby.impl.sql.execute.BasicNoPutResultS
etImpl.getNextRow(BasicNoPutResultSetImpl.java)
> [java] at org.apache.derby.impl.jdbc.EmbedResultSet.movePosit
ion(EmbedResultSet.java)
> [java] at org.apache.derby.impl.jdbc.EmbedResultSet.next(Embe
dResultSet.java)
> [java] at org.jpox.store.rdbms.request.FetchRequest.execute(F
etchRequest.java:157)
> [java] at org.jpox.store.rdbms.table.ClassTable.fetch(ClassTa
ble.java:1739)
> [java] at org.jpox.store.StoreManager.fetch(StoreManager.java
:665)
> [java] at org.jpox.state.StateManagerImpl.loadDFGFields(State
ManagerImpl.java:1573)
> [java] at org.jpox.state.StateManagerImpl.loadDefaultFetchGro
up(StateManagerImpl.java:1666)
> [java] at org.jpox.state.StateManagerImpl.validate(StateManag
erImpl.java:3456)
> [java] at org.jpox.AbstractPersistenceManager.getObjectById(A
bstractPersistenceManager.java:2204)
> [java] at org.jpox.AbstractPersistenceManager.getObjectById(A
bstractPersistenceManager.java:2107)
> [java] at org.apache.jdo.tck.api.persistencemanager.Optimisti
cFailure.runTestOptimistic(OptimisticFailure.java:139)
> [java] at org.apache.jdo.tck.api.persistencemanager.Optimisti
cFailure.test(OptimisticFailure.java:83)
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeM
ethodAccessorImpl.java:39)
> [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Del
egatingMethodAccessorImpl.java:25)
> [java] at java.lang.reflect.Method.invoke(Method.java:324)
> [java] at junit.framework.TestCase.runTest(TestCase.java:154)
> [java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:1
81)
> [java] at junit.framework.TestResult$1.protect(TestResult.jav
a:106)
> [java] at junit.framework.TestResult.runProtected(TestResult.
java:124)
> [java] at junit.framework.TestResult.run(TestResult.java:109)
> [java] at junit.framework.TestCase.run(TestCase.java:118)
> [java] at junit.framework.TestSuite.runTest(TestSuite.java:20
8)
> [java] at junit.framework.TestSuite.run(TestSuite.java:203)
> [java] at junit.framework.TestSuite.runTest(TestSuite.java:20
8)
> [java] at junit.framework.TestSuite.run(TestSuite.java:203)
> [java] at junit.textui.TestRunner.doRun(TestRunner.java:116)
> [java] at junit.textui.TestRunner.doRun(TestRunner.java:109)
> [java] at org.apache.jdo.tck.util.BatchTestRunner.start(Batch
TestRunner.java:128)
> [java] at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunne
r.java:106)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secur...nistrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[ Post a follow-up to this message ]
|