Bug 335610 - Regression: p2 downloads are much slower due to picking remote artifacts even when a local file: URL is available
Summary: Regression: p2 downloads are much slower due to picking remote artifacts even...
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.6.1   Edit
Hardware: PC All
: P3 critical (vote)
Target Milestone: 3.6.2   Edit
Assignee: DJ Houghton CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on: 335153
Blocks:
  Show dependency tree
 
Reported: 2011-01-27 15:38 EST by DJ Houghton CLA
Modified: 2013-11-10 22:31 EST (History)
6 users (show)

See Also:
jeffmcaffer: pmc_approved+


Attachments
patch (3.13 KB, patch)
2011-01-27 15:44 EST, DJ Houghton CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description DJ Houghton CLA 2011-01-27 15:38:48 EST
Cloned to track release into the R36x branch.

+++ This bug was initially created as a clone of Bug #335153 +++

ProvisioningContext itself has a private method named 'getLoadedArtifactRepositories' that is sorted all the available repositories, the local repository has higher priority.

There is no public API to get all artifact repositories from ProvisioningContext, so clients use below query to query out all the artifact repositories from ProvisioningContext instance like DownloadManager. The query result is stored by a set container that never keeps the results in a certain sequence.

If some artifact keys with same id and version in both local repository and remote repository, DownloadManager probably downloads them from remote repository. It's very annoying to cost much more time and bandwidth to download them.

The code snippet of DownloadManager.start():

IQueryable<IArtifactRepository> repoQueryable = provContext.getArtifactRepositories(subMonitor.newChild(250));
IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION);
IArtifactRepository[] repositories = repoQueryable.query(all, subMonitor.newChild(250)).toArray(IArtifactRepository.class);

The fix for DownloadManager is sorting the array of query result again. Maybe it's better and common to add public interface to get sorted repositories on ProvisioningContext.
Comment 1 DJ Houghton CLA 2011-01-27 15:44:52 EST
Created attachment 187774 [details]
patch

Patch for R36x branch.
Comment 2 DJ Houghton CLA 2011-01-27 15:45:19 EST
Adding Tom to CC for PMC approval.
Comment 3 DJ Houghton CLA 2011-01-31 16:51:47 EST
Tom is away this week, added Jeff for PMC approval instead.
Comment 4 Jeff McAffer CLA 2011-01-31 22:49:48 EST
guess I am "less off" this week so here you go
Comment 5 DJ Houghton CLA 2011-02-01 07:47:53 EST
You are voted most likely to check his email. We know you too well. :-) 
Thanks.
Comment 6 DJ Houghton CLA 2011-02-01 10:27:50 EST
Released to branch.