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

Bug 339271

Summary: Branch Promotion Fails on Subsequent commits
Product: [Modeling] EMF Reporter: Cameron Bateman <cbateman>
Component: cdo.coreAssignee: Project Inbox <emf.cdo-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: jon, lothar, robert.blust, stepper, szbardy
Version: 4.13   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
applyChangeSetData patch none

Description Cameron Bateman CLA 2011-03-08 14:04:56 EST
Build Identifier: 

Starting from source branch S and target branch T, we do a full promote on a model object graph like this:

CDOBranch sourceBranch = getSourceBranch();
CDOBranch targetBranch = getTargetBranch();
CDOTransaction transaction = createTransaction(targetBranch);

CDOMerger merger = new DefaultCDOMerger.PerFeature.ManyValued();
CDOBranchPoint sourceHead = sourceBranch.getHead();
CDOChangeSetData merge = transaction.merge(sourceHead, merger);
transaction.commit();

This works fine on the first try: when S contains a model and T doesn't contain anything.  The first merge/commit successfully copies S into T.

(Note: I have applied https://bugs.eclipse.org/bugs/show_bug.cgi?id=336532 locally to resolve the MySql merge issue)

However, when I make incremental changes to S and then try to promote those changes T using the above code, nothing happens.

Furthermore, when I dump the contents of the CDOChangeSetData that results from the merge, it has no changes in it.


Reproducible: Always
Comment 1 Cameron Bateman CLA 2011-03-08 15:01:45 EST
Looking into this further, I'm wondering if this related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=333058.
Comment 2 Cameron Bateman CLA 2011-03-09 16:44:18 EST
Additional information:

When I do:

CDOChangeSetData compareRevisions = transaction.compareRevisions(sourceHead);

in the same context as the above, the resulting CDOChangeSetData *does* contain the changes I expect.  What I really want to do is the equivalent of taking that CDOChangeSetData and merge/committing it to the target branch.
Comment 3 Eike Stepper CLA 2011-03-12 02:29:48 EST
Cameron, have you tried to use the newer merge() method that has two CDOBranchPoint methods?
Comment 4 Cameron Bateman CLA 2011-03-13 16:35:43 EDT
(In reply to comment #3)
> Cameron, have you tried to use the newer merge() method that has two
> CDOBranchPoint methods?

Yes, but so far whatever "sourceBase" I try to use throws an exception that it is not "contained".  There's also no documentation on it and it wasn't clear how I was supposed to determine what sourceBase to use in the arbitrary case.
Comment 5 Szabolcs Bardy CLA 2011-03-16 06:48:42 EDT
Created attachment 191295 [details]
applyChangeSetData patch

Hi Cameron,

I don't know how your branches are structured, but "not contained" exception occurs when trying to merge a branch to another branch, that is not the ancestor of the branch. (E.g. when creating a branch from MAIN, you can merge the changes back from the branch to MAIN, but not the other way around).
We had problems with merging as well, e.g. once the merge is already done, when the changes are applied, all the changed objects will be compared again, which takes a lot of time when comparing objects with large list. We have created our own applyChangeSetData method (see attachment), that applies an arbitrary change set data to the transaction, thus it can be used to promote changes from one branch to another. We are using the commit infos to compute the change sets on the branch (CDOSesion.getCommitInfoManager().getCommitInfos). On the other hand you can still use CDOMerger.merge to see whether there are conflicting changes.

Eike, it would be fine if you could review this patch, whether it makes sense and usable under some circumstances. In our case the merging of branches became much faster, and there were no problems with incremented changes.
Comment 6 Eike Stepper CLA 2011-03-16 10:00:47 EDT
(In reply to comment #5)
> I don't know how your branches are structured, but "not contained" exception
> occurs when trying to merge a branch to another branch, that is not the
> ancestor of the branch. 

IIRC this exception can only occur if the newer merge() method with the sourceBase branchpoint is used. Then the sourceBase point must be reachable by traveling up from the source point to the MAIN branch. I.e. sourceBase must be a baseline of source. The meaning of the merge is then: Merge all changes that happened between sourceBase and source into the current branch of the transaction. With this method the issue of duplicate objects/changes for remerges with the single branchpoint merge() method are addressed.

> Eike, it would be fine if you could review this patch, whether it makes sense
> and usable under some circumstances. In our case the merging of branches became
> much faster, and there were no problems with incremented changes.

I would definitely like to look at it! I'll return from the EclipseCon after end of March and I have a bugzilla backlog of 28 now. Please don't expect that I'll find time before begining to mid of April ;-(
Comment 7 Eike Stepper CLA 2012-06-05 07:29:47 EDT
Moving all open bug reports to 4.1 because the release is very near and it's hghly unlikely that there will be spare time to address 4.0 problems.

Please make sure that your patches can be applied against the master branch and that your problem is not already fixed there!!!
Comment 8 Eike Stepper CLA 2012-08-14 22:53:09 EDT
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master.
Comment 9 Eike Stepper CLA 2013-06-29 12:18:54 EDT
We'll try to address open problems in 4.3 (master) first and then port fixes back to 4.2.
Comment 10 Eike Stepper CLA 2015-07-14 02:14:08 EDT
Moving all open bugzillas to 4.5.
Comment 11 Eike Stepper CLA 2016-07-31 00:57:10 EDT
Moving all unaddressed bugzillas to 4.6.
Comment 12 Eike Stepper CLA 2017-12-28 01:19:11 EST
Moving all open bugs to 4.7
Comment 13 Eike Stepper CLA 2019-11-08 02:12:45 EST
Moving all unresolved issues to version 4.8-
Comment 14 Eike Stepper CLA 2019-12-13 12:52:47 EST
Moving all unresolved issues to version 4.9
Comment 15 Eike Stepper CLA 2020-12-11 10:38:31 EST
Moving to 4.13.