Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add a package object cache #146

Closed
wants to merge 11 commits into from

Conversation

cgwalters
Copy link
Member

This commit implements #24

Needs to be cleaned up, and isn't quite as much of a speedup as I
thought, because unfortunately the "lookup package owner of file" is
actually a non-indexed (i.e. loop over all pkgs) operation in libsolv
=( =( =(

We might be able to fix this by using librpm directly which from my
current reading of the source code has some caching for this.

@cgwalters cgwalters added the WIP label May 20, 2015
@cgwalters
Copy link
Member Author

Of course the same process here just had RPM lay the files out on disk...it should really be able to build the reverse map for us during that.

@james-antill
Copy link
Contributor

It is indexed in rpm, and yum provides/rpm -qf uses it. No idea how hard it'll be to fix libsolv.

cgwalters added 6 commits May 21, 2015 20:15
For a future patch, I want to add an API to get an rpmts for a commit,
instead of a hawkey Sack, because libsolv doesn't expose some
optimized queries that we can get by just going directly to librpm,
such as package file owners.
It was only used to access the yumdb, which we don't use because:

 - It badly exacerbates the OSTree one-HTTP-request-per-object issue
 - We're assembling multiple repos on the server side, so things like
   who took the action aren't relevant.

But the reason I did this patch at the moment is because I want to
unify the code that's creating tempdirs from commits so we can feed
real files to librpm.
As far as I can tell, this is basically a way to specify the temporary
directory.  That significantly complicates the code as it now
needs to keep track of whether or not it owns the temporary directory.

This hinders unifying this code with the hawkey query path.

Because of this, and since I'm not aware of a use case for specifying
this tempdir, let's remove it.
This allows us to more cleanly encapsulate things.
hawkey and libsolv are both patched to look in `usr/share/rpm` if the
db can't be found in `/var/lib/rpm`.  However, librpm itself isn't.
One *can* override it with a macro...which is process global.  Yuck.
Needs fixing.

Anyways, we can just make a symlink.  That's a lot easier than writing
a patch for librpm and waiting a billion years to be able to use it
everywhere we care about.

This will help unify the librpm tempdir code with the hawkey tempdir
code.
And now, finally the actual goal is achieved.  \o/

Only one code path dealing with extracting the rpm database from an
OSTree commit.

An astute reader would notice that the `root` member of the struct was
actually only necessary as of a few commits ago.  But said astute
reader would also realize it's kind of late in the evening and not
worth rebasing it to where it would properly go.
@cgwalters cgwalters mentioned this pull request May 22, 2015
cgwalters added 5 commits May 22, 2015 09:32
While `rpm-util.c` may not best describe this, it's where most
of this code is ending up.  Let's further centralize things.

We more consistently return an `RpmOstreeRefSack` instead of a
`HySack`, where the former supports refcounting and knows how to clean
up its temporary directory if it was allocated from a commit.
The refsack code was using the latter, and it stood out.  Now that
we're making use of explicit export markers, there's no need to uglify
internal APIs with a leading `_`.
This API is intended for use by the caching framework to hold open an
rpmdb for the previous commit.
This commit implements coreos#24

Now using librpm.  This could still be faster.
@cgwalters
Copy link
Member Author

Thinking about this some more, unfortunately all caching like this is potentially invalidated by the presence of postprocess-script and to a lesser degree remove-from-packages. That would need to be addressed somehow.

@cgwalters
Copy link
Member Author

Obsoleted by #209

@cgwalters cgwalters closed this Jan 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants