Web lists-archives.com

Re: [PATCH 4/4] get_oid(): when an object was not found, try harder

On Thu, Mar 14, 2019 at 01:05:03PM +0900, Junio C Hamano wrote:

> Jeff King <peff@xxxxxxxx> writes:
> > I'm not sure it's really worth addressing (just because I don't think
> > there's a good way to do it that isn't expensive).
> I do not think so, either.  Not at this layer, anyway.
> If a "-x" command newly created an object whose prefix makes it
> ambiguous against an existing object, we would not notice, unless we
> refresh the loose object cache, that we now have two objects that
> share the prefix.  And we will find an object (the older one) with
> the prefix in the stale cache without hitting "oh we do not find it,
> let's retry" codepath.  So to solve both sides of the coin, we'd
> need invalidation either way, which obviously defeats the whole
> caching concept, doesn't it?

Right, that was the conclusion I came to. You cannot solve it in all
cases without checking whether new objects have appeared for every
lookup.  I think that could be as cheap as a stat() on the pack
directory and one on the appropriate loose directory, but I suspect even
that might be measurably slower.