Skip to main content



      Home
Home » Modeling » EMF » [CDO] ChangedInTargetAndDetachedInSourceConflict resolution
[CDO] ChangedInTargetAndDetachedInSourceConflict resolution [message #1855630] Mon, 24 October 2022 12:47 Go to next message
Eclipse UserFriend
Hi,

Consider the following use case:
- EObjects A and B exist in the CDO repository with no relation between them
- Client 1 creates EObject A1 as child of A
- Client 1 makes a reference to A1 in B
- Client 2 deletes A and commit
- Client 1 gets the conflict ChangedInTargetAndDetachedInSourceConflict for A

I try to apply a generic resolution for this conflict: delete A, all its children and the references to them.
I found a solution that works but I'm not sure if it's the proper way.

I use a MergingConflictResolver and override the resolveConflicts(Set<CDOObject> conflicts, CDOChangeSet remoteChangeSet) to do for each ChangedInTargetAndDetachedInSourceConflict:
internalCDOObject.cdoInternalSetState(CDOState.CONFLICT);
CDOStateMachine.INSTANCE.detach(internalCDOObject);
lastSavePoint.getDetachedObjects().remove(vCDOID);

A and A1 are deleted but the reference to A1 still exists in B. To remove it, I apply on the new objects removed during the conflict resolution, the the same treatment as in the beginning of the invalidate() method of CDOTransactionImpl:

removeCrossReferences(deletedNewObjects, lastSavePoint.getDirtyObjects().values());
removeCrossReferences(deletedNewObjects, lastSavePoint.getNewObjects().values());

(I had to copy the removeCrossReferences() method, could it be possible to make it not private?)

Is it the best solution to get the desired result?
Re: [CDO] ChangedInTargetAndDetachedInSourceConflict resolution [message #1855826 is a reply to message #1855630] Sun, 06 November 2022 02:33 Go to previous messageGo to next message
Eclipse UserFriend
Hi Vincent,

When you want to use internals of CDOTransactionImpl you're generally on your own.
We won't make removeCrossReferences() public, but you could try to use reflection.

It's impossible to tell whether your solution is the best.
Even to tell whether it's correct is hard because I don't see the full code and have no easy means to reproduce the problem.

Sorry ;-)
Re: [CDO] ChangedInTargetAndDetachedInSourceConflict resolution [message #1855842 is a reply to message #1855826] Mon, 07 November 2022 09:39 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your answer.
I understand that it's difficult to say if my way is the best or not.

But in fact, I was just wondering if there is a generic way to do it as in CDOMergingResolver there is the handleConflict() method that can be overridden but I can't manage this type of conflict as the updateTransactionWithResult() method called next, only manage the changed objects, not the detached ones.
Re: [CDO] ChangedInTargetAndDetachedInSourceConflict resolution [message #1855847 is a reply to message #1855842] Mon, 07 November 2022 11:58 Go to previous messageGo to next message
Eclipse UserFriend
Perhaps you want to provide a patch to enhance CDOMergingConflictResolver.updateTransactionWithResult() so that it interprets CDOChangeSetData.getDetachedObjects(), too?
Re: [CDO] ChangedInTargetAndDetachedInSourceConflict resolution [message #1855867 is a reply to message #1855847] Tue, 08 November 2022 05:21 Go to previous message
Eclipse UserFriend
I would like to, but I'm not sure how to do it, hence this topic. I may look into it in the coming days.
Previous Topic:[CDO] Sporadic IOException: String ID unknown
Next Topic:[CDO] Outdated lock state when releasing a durable lock
Goto Forum:
  


Current Time: Sun Jul 13 13:45:51 EDT 2025

Powered by FUDForum. Page generated in 0.02963 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top