Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 228903 - Repository manager creation should always add the repository
Summary: Repository manager creation should always add the repository
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 RC1   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 229370 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-04-25 12:29 EDT by John Arthorne CLA
Modified: 2008-05-06 15:43 EDT (History)
5 users (show)

See Also:
john.arthorne: review?


Attachments
Fix (5.32 KB, patch)
2008-05-01 18:27 EDT, John Arthorne CLA
no flags Details | Diff
Updated patch (23.27 KB, patch)
2008-05-02 14:56 EDT, John Arthorne CLA
no flags Details | Diff
Additional patch (1.75 KB, patch)
2008-05-02 16:06 EDT, John Arthorne CLA
no flags Details | Diff
dropins artifact repository patch (3.52 KB, patch)
2008-05-05 09:59 EDT, Simon Kaegi CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2008-04-25 12:29:20 EDT
In bug 219605 we decided to *not* add the repository to the list of known repositories when the create() methods are called.  However, this leads to cases where multiple clients have different repository instances:

Client 1 calls:

  IRepository repo = repositoryManager.create(...);

Client 2 calls:

  IRepository repo - repositoryManager.load(...);

Now client 2 has a different repository instance from client 1, for the same underlying repository in the file system. This leads to synchronization problems, and potentially lost data if both clients modify the repository.

See bug 228806 for a particular example of this problem.
Comment 1 John Arthorne CLA 2008-05-01 17:37:35 EDT
*** Bug 229370 has been marked as a duplicate of this bug. ***
Comment 2 John Arthorne CLA 2008-05-01 17:40:26 EDT
We need to fix this for 3.4. This is causing several problems that are difficult to work around:

  - Could have multiple repository objects in memory for the same repository on disk
  - The repository manager doesn't know if the created repository is a system repository until the next time the repository is loaded.

Almost every client that calls repositoryManager#create immediately calls repositoryManager#add. There is only one instance in the generator where the repository is created but not added to the manager. We can preserve this behavior by calling repositoryManager#remove(URL) to remove the created repository from the list of known repositories.
Comment 3 John Arthorne CLA 2008-05-01 18:27:20 EDT
Created attachment 98387 [details]
Fix
Comment 4 John Arthorne CLA 2008-05-01 18:27:59 EDT
DJ, can you review?
Comment 5 DJ Houghton CLA 2008-05-02 13:30:07 EDT
John, I think the patch is incomplete. It doesn't contain the necessary change in the MetadataRepositoryManager to add the repos in the create call.
Comment 6 John Arthorne CLA 2008-05-02 14:56:41 EDT
Created attachment 98486 [details]
Updated patch

You're right, something must have happened during patch export. Trying again.
Comment 7 John Arthorne CLA 2008-05-02 16:06:01 EDT
Created attachment 98501 [details]
Additional patch

After testing I found one extra place where reconciler.dropins is going around the repositry manager create method and going directly to the repository factory. In this case it needs to add the concrete repository object to the manager, or the system property bit gets lost.  With this extra fx, I never see system repositories in the available repositories view, even directly after first startup.
Comment 8 John Arthorne CLA 2008-05-02 16:13:02 EDT
Fix released.
Comment 9 DJ Houghton CLA 2008-05-02 16:17:09 EDT
+1
Comment 10 Simon Kaegi CLA 2008-05-05 09:59:05 EDT
Created attachment 98635 [details]
dropins artifact repository patch

We should use the same logic to directly add the artifact repositories that are created in the dropins reconciler.
Comment 11 DJ Houghton CLA 2008-05-05 13:53:10 EDT
+1 for Simon's additional patch.
Released.
Comment 12 Susan McCourt CLA 2008-05-06 15:43:06 EDT
Running the latest code from HEAD (which should have this fix)...I'm seeing very strange behavior.

For example, I have some repos disabled.
I go to the installed software page and check for updates.
After doing so, some of my disabled repos are now visible in the available list.

I'm in the middle of something or I would try harder to get a repeatable test case, but wanted to mention I'm seeing really flaky repo behavior and see if anyone else has noticed.