Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » P2: cached repository data
P2: cached repository data [message #848641] Wed, 18 April 2012 12:45 Go to next message
Christian Sell is currently offline Christian SellFriend
Messages: 51
Registered: August 2010
Member
Hello,

I am having am issue with the repository cache maintained by P2 update: for reasons outside of my control, we are completely replacing the repository every time we deploy a new version of our application. When the app starts up, the (built-in) P2 autoupdate reads that repository through the ever-same URL.

Now I discovered that, even though the repository contains new versions of the alreday installed bundles/features, the update operation reports a STATUS_NOTHING_TO_UPDATE. I then discovered 2 files in the p2/org.eclipse.equinox.p2.repository/cache subdirectory of the installation, which I deleted. After that, the new versions were discovered and installed correctly.

My question: how does P2 determine whether the cache is stale? Can I disable caching altogether?

TIA,
chris
Re: P2: cached repository data [message #849274 is a reply to message #848641] Thu, 19 April 2012 02:37 Go to previous messageGo to next message
Pascal Rapicault is currently offline Pascal RapicaultFriend
Messages: 333
Registered: July 2009
Location: Ottawa
Senior Member
Once a repository has been loaded in memory it is kept into a soft reference based cache (see AbstractRepositoryManager#repositories). It means that until the VM GC this, the repository will not be reloaded from disk nor from the remote location.

Everytime a repo is loaded, the timestamp of the file is checked against the remote (see SimpleMetadataRepositoryFactory#getLocalFile()).

=-=-=
Pascal
Consulting, training, bug fixing - pascal at rapicault dot net
Re: P2: cached repository data [message #849827 is a reply to message #849274] Thu, 19 April 2012 13:35 Go to previous messageGo to next message
Christian Sell is currently offline Christian SellFriend
Messages: 51
Registered: August 2010
Member
I am still not getting anywhere with this. Heres my scenario:

1. I start my application, which updates from a remote repository. Afterwards, I find 2 files in the p2\org.eclipse.equinox.p2.repository\cache directory, namely artifacts646910755.jar and content646910755.jar. Both have a file timestamp of, say, 15:17. I close the app.

2. I replace the repository with another one, which contains updated features. The second repository was exported after the first one, therefore all file timestamps are later. However, the timestamps in the cache are (obviously) the youngest.

3. I again start the app, expecting autoupdate to happen. However, it reports "no updates found"! I have to go and manually delete the files mentioned in 1., and restart the app. Now the update takes place.

I have looked at the code you mentioned (SimpleMetadataRepositoryFactory#getLocalFile()), but couldn't gather from there what the issue is. Any help appreciated..

thanks,
chris
Re: P2: cached repository data [message #849912 is a reply to message #849827] Thu, 19 April 2012 15:18 Go to previous messageGo to next message
Pascal Rapicault is currently offline Pascal RapicaultFriend
Messages: 333
Registered: July 2009
Location: Ottawa
Senior Member
Without seeing the actual repositories and the actual install it is going to be hard to figure out.
Two things to verify:
- Make sure that the new repo you publish actually has a newer timestamp than the one it replaces. It should but who knows. (curl -I <pathToFile> to get the timestamp from a remote)
- Make sure that the top level IU that needs to be updated has a higher version than the one that is currently installed.

HTH

=-=-=
Pascal
Consulting, training, bug fixing - pascal at rapicault dot net
Re: P2: cached repository data [message #850775 is a reply to message #849912] Fri, 20 April 2012 10:11 Go to previous messageGo to next message
Christian Sell is currently offline Christian SellFriend
Messages: 51
Registered: August 2010
Member
It seems I have located the caching issue with the help of a remote debugger. The problem lies in the following line, taken CacheManager.java, line 195, from the P2 SDK which comes with Eclipse Helios SR1 (3.6.1), which is what we are using:

stale = lastModifiedRemote > lastModified || (name != null && name.endsWith(JAR_EXTENSION) || lastModifiedRemote <= 0);


that line compares the modification date of the cached file (which is the time when it was cached!) against the modification date of the repository file (which in my case is older, since I first built all versions before starting the test). Luckily, in the Indogo release, this line was changed to

stale = lastModifiedRemote != lastModified || (name != null && name.endsWith(JAR_EXTENSION) || lastModifiedRemote <= 0);


So I guess our solution for now is to keep the sequence of building/deploying that is required for the old code to work, until we have migrated to 3.7. I suppose there exists a bugzilla entry for this somewhere..
Re: P2: cached repository data [message #850797 is a reply to message #850775] Fri, 20 April 2012 10:39 Go to previous messageGo to next message
Christian Sell is currently offline Christian SellFriend
Messages: 51
Registered: August 2010
Member
Quote:
So I guess our solution for now is to keep the sequence of building/deploying

which, I have to add, does not work. Our client is running the application on a virtual machine which is rebooted from scratch every day, meaning that the cache is also created on a daily basis and will therefore in all likelihood be younger than the repository files. I really dont think that comparing file modification timestamps is a good practice here, even when looking at the indigo code..
Re: P2: cached repository data [message #850810 is a reply to message #850797] Fri, 20 April 2012 10:54 Go to previous message
Christian Sell is currently offline Christian SellFriend
Messages: 51
Registered: August 2010
Member
a quick search yields Bug 324200 and Bug 343513 in the eclipse bugzilla. The latter is marked as duplicate of the former, and the former dates from 09/2010 and has ASSIGNDED status, although the corresponding fix is already in the indigo code base. I think it should be marked CLOSED.
Previous Topic:[P2] Extending RepositoryTrackerComponent
Next Topic:Custom OSGi command
Goto Forum:
  


Current Time: Thu Apr 25 05:10:18 GMT 2024

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

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

Back to the top