Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326047 - Revision not revised on rawImport for deleted objects.
Summary: Revision not revised on rawImport for deleted objects.
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard: offline-01
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-23 09:04 EDT by Pascal Lehmann CLA
Modified: 2011-06-23 03:37 EDT (History)
0 users

See Also:


Attachments
Testcase (4.30 KB, patch)
2010-09-23 09:10 EDT, Pascal Lehmann CLA
stepper: iplog+
Details | Diff
Proposed patch (1.77 KB, patch)
2010-09-23 09:57 EDT, Pascal Lehmann CLA
stepper: iplog+
Details | Diff
Combined Patch - for future reference (7.43 KB, patch)
2010-09-23 10:22 EDT, Eike Stepper CLA
no flags Details | Diff
Patch v2 (1.76 KB, patch)
2010-09-28 11:16 EDT, Pascal Lehmann CLA
stepper: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Lehmann CLA 2010-09-23 09:04:58 EDT
Build Identifier: 4.0

When revisions are revised on rawImport, the revisions for deleted objects will not be updated.

Here is a snipped from our database and the used query to illustrate why it won't revise:
	CDO_ID 	CDO_VERSION 	CDO_BRANCH 	CDO_CLASS 	CDO_CREATED 	CDO_REVISED 	CDO_RESOURCE 	CDO_CONTAINER 	CDO_FEATURE 	ID 	LASTEDITTIME 	LASTEDITNAME 	DESCRIPTION 	CREATIONTIME 	NAME 	BEGINTIME 	ENDTIME
58 	3820 	-3 	0 	633 	1285226606812 	0 	0 	0 	0 	null 	null 	null 	null 	null 	null 	null 	null
59 	3820 	1 	0 	633 	1285226492637 	1285226550423 	0 	16 	-5 	e6cadea4-b7df-4788-9122-4ba39b35f138 	2010-09-23 09:21:31.673 	O1-User 1 	null 	2010-09-23 09:21:28.048 	DeleteMe2 	null 	null
60 	3820 	2 	0 	633 	1285226550424 	0 	0 	16 	-5 	e6cadea4-b7df-4788-9122-4ba39b35f138 	2010-09-23 09:22:30.414 	O1-User 1 	null 	2010-09-23 09:21:28.048 	DeleteMe2 	null 	null

Query:
SELECT cdo1.cdo_id, cdo1.cdo_branch, cdo1.cdo_version, cdo2.cdo_created FROM base_layer_Rectangle cdo1, base_layer_Rectangle cdo2 WHERE cdo1.cdo_id=cdo2.cdo_id AND cdo1.cdo_branch=cdo2.cdo_branch AND cdo1.cdo_version=cdo2.cdo_version-1 AND cdo1.cdo_revised=0

Since the deleted version (-3) is not the version-1 before deletion (2) it won't get revised.
This will be a problem when merging, as the generated changeSets do not contain the detached objects.

I'm not sure if this problem also occurs somewhere else, just noticed it in this case.

Reproducible: Always

Steps to Reproduce:
1. Use offlineRepository with rawReplication, create object.
2. Go offline, delete object online, go online again.
3. Let the rawReplication do it's work.
Comment 1 Pascal Lehmann CLA 2010-09-23 09:10:18 EDT
Created attachment 179455 [details]
Testcase

The attached test contains a merge which should usually fail because the same object was modified offline while deleted online.
However, since the changeSet does not contain the detached object (because of the bug), the following exception is thrown on commit:

java.util.ConcurrentModificationException: Attempt by Transaction[4:-1] to modify historical revision: Customer@OID5:0v1
Comment 2 Pascal Lehmann CLA 2010-09-23 09:12:34 EDT
1) The number of lines that you changed is smaller than 250.
confirmed.
2) You are the only author of these changed lines.
confirmed.
3) You apply the EPL to these changed lines.
confirmed.
Comment 3 Pascal Lehmann CLA 2010-09-23 09:57:18 EDT
Created attachment 179458 [details]
Proposed patch

I added the missing version check to the SQL query.

1) The number of lines that you changed is smaller than 250.
confirmed.
2) You are the only author of these changed lines.
confirmed.
3) You apply the EPL to these changed lines.
confirmed.
Comment 4 Eike Stepper CLA 2010-09-23 10:22:34 EDT
Created attachment 179461 [details]
Combined Patch - for future reference

Thank you, Pascal!
Comment 5 Eike Stepper CLA 2010-09-23 10:23:47 EDT
Committed to HEAD
Comment 6 Pascal Lehmann CLA 2010-09-28 11:16:29 EDT
Created attachment 179757 [details]
Patch v2

I was a bit hasty when posting the patch, it does not only revise the previous version for deleted revisions, but also the deleted version itself.
Added another check to the SQL query so only one will get revised.

1) The number of lines that you changed is smaller than 250.
confirmed.
2) You are the only author of these changed lines.
confirmed.
3) You apply the EPL to these changed lines.
confirmed.
Comment 7 Pascal Lehmann CLA 2010-09-28 11:17:21 EDT
reopened, because of better patch.
Comment 8 Eike Stepper CLA 2010-10-01 02:14:18 EDT
Committed patch v2 to HEAD
Comment 9 Eike Stepper CLA 2011-06-23 03:37:47 EDT
Available in R20110608-1407