Re: [PATCH 1/3] wt-status: implement opportunisitc index update correctly
- From
Stefan Beller <sbeller@google.com>
- Date
- Dec 7, 2016, 20:56 UTC
- Message-ID
- <CAGZ79kbZBzF20=cfF85_fSuFdpYZuNyhDNCSKCb9HBpLOSV0hA@mail.gmail.com>
- In-Reply-To
- <CAPc5daX2CZ0=UBMuz70KwFPBDTUgAdi8WoVUJ7gNTq+QEXKxbg@mail.gmail.com>
On Wed, Dec 7, 2016 at 12:53 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
> On Wed, Dec 7, 2016 at 12:48 PM, Stefan Beller <sbeller@google.com> wrote: >> >> So I would expect that we'd rather fix the update_index_if_able instead by >> checking for the lockfile to be in the correct state? > > I actually don't expect that, after looking at other call sites of > that function.
Yes I checked the other callers as well right now and you seem to be correct. My initial response was based on the name of the function, specifically the _if_able part as that hinted to me that I can call the function with no precondition and the _if_able will figure out when to do the actual update_index.
The first part of the condition of the function
(istate->cache_changed || has_racy_timestamp(istate)
reads rather as a _if_needed instead of an _if_able to me.