[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#5113) pcache returns incomplete results

On Mittwoch, 29. August 2007, Howard Chu wrote:
> rhafer@suse.de wrote:
> > Full_Name: Ralf Haferkamp
> > Version: HEAD
> > OS:
> > URL: ftp://ftp.openldap.org/incoming/
> > Submission from: (NULL) (
> >
> >
> > While the results of a query are being cached, slapo-pcache will answer
> > queries that match the same template from the cache that is currently
> > being populated. This means that subsequent queries will get incomplete
> > results until the original query is completely cached.
> I don't see how that is possible. The query-in-progress isn't added to the
> cache until the final result is received. Until then, query_containment
> should not know anything is there to answer with.
Hm, current HEAD first calls add_query, which adds the CachedQuery to the 
cache and after that calls cache_entries to add the entries of that Query to 
the cache. That means that query_containment already know about the Query 
before its result is completely cached.
In RE23 it is just the other way arround (first cache_entries() then 
I see two possible solution:

1. Switch back to the old behaviour. But I guess the change was made for a 
reason. I don't know that yet. Seems the change happend between r1.95 and 
r1.96 of pcache.c (log message: "Fix concurrency issues").

2. Protect the cached query with an rw_lock. Writelock it while 
cache_entries() is executing and readlock it during searches. This would give 
us the behaviour that Ando suggested in the discussion of ITS#5112. (pcache 
would not try to cache the same search request mulitple times, but block the 
second request until the first one is cached and then answer it from the