Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 359966

Summary: Issues when trying to import changes from PushTransaction in legacy mode
Product: [Modeling] EMF Reporter: Alex Lagarde <alex.lagarde>
Component: cdo.legacyAssignee: Eike Stepper <stepper>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 CC: alex.lagarde, martin.fluegge, steve.monnier
Version: 4.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 352204, 364904    
Bug Blocks:    
Attachments:
Description Flags
bug359966 test
none
CDOStateMachine fork
none
An object diagram to explain the test scenario none

Description Alex Lagarde CLA 2011-10-05 07:46:21 EDT
This issue has been described in the following post http://www.eclipse.org/forums/index.php/t/244583/ .
Comment 1 Alex Lagarde CLA 2011-10-05 07:55:08 EDT
Created attachment 204584 [details]
bug359966 test

TestCase in attachment.

To integrate the test : 
1. Import the zip file of ticket 352204 https://bugs.eclipse.org/bugs/attachment.cgi?id=203829
2. Apply the bug359966 test patch

Launch the "CDO AllTests (MEM legacy)" launch config.
One test will fail, 2 will raise errors (Failing event PREPARE in state CLEAN). This can be explained by https://bugs.eclipse.org/bugs/show_bug.cgi?id=352204.
It is interesting to notice that when using CDOPushTransactions with default File, this issue is not raised.

3. Apply the CDOStateMachine fork
The 3 tests will fail.
Comment 2 Alex Lagarde CLA 2011-10-05 07:55:50 EDT
Created attachment 204585 [details]
CDOStateMachine fork

the fork that allows to avoid issue described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=352204
Comment 3 Eike Stepper CLA 2011-11-22 07:28:05 EST
I've identified the root cause:

In CDOTransactionImpl.importChanges() there was a call to object.cdoInternalPostLoad() missing for new objects.
That caused the revision data from the input stream not being transferred into the legacy object.

Writing more tests to see if that's all...
Comment 4 Eike Stepper CLA 2011-11-22 23:52:13 EST
This is more a PushTransaction than legacy mode issue.
Comment 5 Eike Stepper CLA 2011-11-23 00:11:39 EST
Now addressing the problem of temp ID mapping during import:

org.eclipse.emf.cdo.tests.config.impl.ConfigTestException: Error in TransactionTest.testPushModeNewObjects [Combined, MEM, JVM, Legacy]
	at org.eclipse.emf.cdo.tests.config.impl.ConfigTest.runBare(ConfigTest.java:535)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at org.eclipse.net4j.util.tests.AbstractOMTest.run(AbstractOMTest.java:264)
	at junit.framework.TestSuite.runTest(TestSuite.java:243)
	at org.eclipse.emf.cdo.tests.config.impl.ConfigTestSuite$TestWrapper.runTest(ConfigTestSuite.java:119)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at junit.framework.TestSuite.runTest(TestSuite.java:243)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at junit.framework.TestSuite.runTest(TestSuite.java:243)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.eclipse.emf.cdo.util.ObjectNotFoundException: Object oid2 not found in branch 0 at *
	at org.eclipse.emf.internal.cdo.view.AbstractCDOView.excludeNewObject(AbstractCDOView.java:728)
	at org.eclipse.emf.internal.cdo.view.AbstractCDOView.getObject(AbstractCDOView.java:705)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.getObject(CDOTransactionImpl.java:1068)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.getObject(CDOTransactionImpl.java:1)
	at org.eclipse.emf.internal.cdo.object.CDOLegacyWrapper.getEObjectFromPotentialID(CDOLegacyWrapper.java:703)
	at org.eclipse.emf.internal.cdo.object.CDOLegacyWrapper.revisionToInstanceContainer(CDOLegacyWrapper.java:425)
	at org.eclipse.emf.internal.cdo.object.CDOLegacyWrapper.revisionToInstance(CDOLegacyWrapper.java:387)
	at org.eclipse.emf.internal.cdo.object.CDOLegacyWrapper.cdoInternalPostLoad(CDOLegacyWrapper.java:278)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.importChanges(CDOTransactionImpl.java:1920)
	at org.eclipse.emf.cdo.transaction.CDOPushTransaction.<init>(CDOPushTransaction.java:143)
	at org.eclipse.emf.cdo.transaction.CDOPushTransaction.<init>(CDOPushTransaction.java:115)
	at org.eclipse.emf.cdo.tests.TransactionTest.testPushModeNewObjects(TransactionTest.java:268)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at org.eclipse.net4j.util.tests.AbstractOMTest.runBare(AbstractOMTest.java:218)
	at org.eclipse.emf.cdo.tests.config.impl.ConfigTest.runBare(ConfigTest.java:526)
	... 18 more
Comment 6 Eike Stepper CLA 2011-11-23 00:51:49 EST
commit 5ad3b529cc56776cfb29bd4d43a6487bf9b837d4
Author: Eike Stepper <stepper@esc-net.de> 2011-11-22 11:54:52
Committer: Eike Stepper <stepper@esc-net.de> 2011-11-22 11:54:52
Parent: 40df8b0447094c2c55b11011fdedc1bab7e90a7a (fixed deprecation warnings in Eclipse 3.8)
Branches: master

[359966] Issues when trying to import changes from PushTransaction in legacy mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359966

Test model + tests
Comment 7 Eike Stepper CLA 2011-11-23 00:54:03 EST
Now bug 352204 bites me ;-(
Comment 8 Eike Stepper CLA 2011-11-23 01:04:13 EST
Disabling the two test cases that fail for bug 352204 for now.
Comment 9 Eike Stepper CLA 2011-11-23 01:06:49 EST
commit 57cbcc66f376e0bd6a13d05d580b46e022393b5d
Author: Eike Stepper <stepper@esc-net.de> 2011-11-23 07:06:15
Committer: Eike Stepper <stepper@esc-net.de> 2011-11-23 07:06:15
Parent: 29772285ab4fbc187af24af29effb0dfb311e814 ("long=long*int" instead of "long=int*long")
Branches: master

[359966] Issues when trying to import changes from PushTransaction in legacy mode 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359966
Comment 10 Eike Stepper CLA 2011-11-23 01:07:25 EST
Please note that existing push tx files are no longer valid with this fix!
Comment 11 Eike Stepper CLA 2011-11-23 01:10:54 EST
Created attachment 207400 [details]
An object diagram to explain the test scenario
Comment 12 Eike Stepper CLA 2011-11-23 01:40:46 EST
Maintenance fix via bug 364536
Comment 13 Eike Stepper CLA 2012-09-21 07:18:27 EDT
Closing.