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

Bug 327094

Summary: Determine base timestamp for new branches on the server (if not set by the client)
Product: [Modeling] EMF Reporter: Pascal Lehmann <pascal.lehmann>
Component: cdo.coreAssignee: Eike Stepper <stepper>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: enhancement    
Priority: P3 CC: cyril.jaquier, stepper
Version: 4.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: Lighter, Faster and Better
Attachments:
Description Flags
Patch v1 - for future reference none

Description Pascal Lehmann CLA 2010-10-06 08:23:21 EDT
Build Identifier: 4.0

When creating an initial model, then immediately creating a branch, and trying to access the object on the branch, an occasional ObjectNotfoundException is thrown. This is usually the setup in testCases and might be the problem for the failed test on Hudson.

The reason this happens is that the timestamp of the branch is older than the timestamp of the object on main branch, so the branchRevisionManager will return null even though it has a revision (with newer timestamp) in the cache.
The cause for the branch being older than the object itself seems to be in the getTimeStamp() method of the CDOTimeProvider which will use an approximate time when createBranch on CDOBranchManager is called with CDOBranchPoint.UNSPECIFIED_DATE.

Reproducible: Sometimes

Steps to Reproduce:
1. create initial model.
2. immediately after create a branch.
3. access some of the model objects on branch.
Comment 1 Eike Stepper CLA 2010-10-06 10:41:01 EDT
Hi Pascal,

I've always felt unhappy with the createBranch(String) method, the one without the timestamp parameter. It generally seems better to explicitely control the time of the base branch point.

An alternative would be to determine the timestamp on the server but I tend to remove the "unexplicit" API from the client.

What do you think?
Comment 2 Pascal Lehmann CLA 2010-10-07 05:16:09 EDT
I find it quite convenient to just use the createBranch method without a time parameter if I just want to create a branch "now". To be on the safe side the server should probably set the actual time for "now", but as discussed yesterday this might invole some major changes.
So we might as well just remove the "unexplicit" API unless there is a good way to get a reliable last server timestamp. Maybe something like the responding time from the last refreh timeResult.
Comment 3 Eike Stepper CLA 2010-10-07 06:13:47 EDT
I'm going to provide a fix...
Comment 4 Eike Stepper CLA 2010-10-07 06:14:12 EDT
Created attachment 180406 [details]
Patch v1 - for future reference
Comment 5 Eike Stepper CLA 2010-10-07 06:18:11 EDT
Tests run fine ;-)

Committed to HEAD
Comment 6 Eike Stepper CLA 2011-06-23 03:36:57 EDT
Available in R20110608-1407