[PATCH] Remove threading from getBaseRepo handling (#1011555)

Vratislav Podzimek vpodzime at redhat.com
Fri Nov 8 06:45:28 UTC 2013


On Thu, 2013-11-07 at 17:06 -0800, Brian C. Lane wrote:
> From: "Brian C. Lane" <bcl at redhat.com>
> 
> The original purpose of the getBaseRepo cache was to ensure that
> requests it weren't constantly sitting on the _yum_lock. This was
> accomplished with a combination of a cache, decorators to invalidate the
> cache and a thread to re-validate the cache.
> 
> The problem is that the thread can be fired off at any time, and when
> this happens in the middle of a PAYLOAD_MD thread update it can change
> the state of yum's preconf/conf attributes, resulting in a traceback
> the next time it tries to access .preconf
> 
> This patchset hopefully simplifies things a bit by removing the
> threading from the picture. Now what happens is:
> 
> Any method decorated with @invalidate_br_cache ill re-validate the
> cache when the method is *finished* and if it meets the criteria
> passed to the decorator.
> 
> If getBaseRepo is called and the cache is invalid it will immediately
> re-validate it -- all this does is examine repos and their enabled
> attribute, this should not be a long running process.
> 
> In addition to this, in the software watcher it was possible for access
> to payload.groups and payload.environments to stomp on the yum preconf
> state while the PAYLOAD_MD thread was running, so wait for it to finish
> as well.
This looks good to me. I liked the threads making the processing as fast
as possible and allowing e.g. text mode spokes querying the cache with
wait=False because they don't care whether source is not set at all or
just not setup yet. But one has to be careful when playing with yum... I
just hope DNF will be a "better-behaved" child.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list