Re: [PATCH v3] unpack_trees: fix breakage when o->src_index != o->dst_index
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Apr 30, 2018, 16:29 UTC
- Message-ID
- <CACsJy8CeDhrT9GXe9q5gqsAeq_sSQ8jyF2nMOFxzjwKtE31oPQ@mail.gmail.com>
- In-Reply-To
- <CABPp-BFsEPbTXq0cFE+gkXcXtP_1LOyQAUMMXBOdB16OJknDig@mail.gmail.com>
On Mon, Apr 30, 2018 at 6:19 PM, Elijah Newren <newren@gmail.com> wrote:
Show 40 quoted lines
> Hi Duy, > > On Mon, Apr 30, 2018 at 7:45 AM, Duy Nguyen <pclouds@gmail.com> wrote: >> On Mon, Apr 30, 2018 at 4:42 PM, Duy Nguyen <pclouds@gmail.com> wrote: >>> On Sun, Apr 29, 2018 at 10:53 PM, Johannes Schindelin >>> <Johannes.Schindelin@gmx.de> wrote: >>>>> > @@ -1412,12 +1422,13 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options >>>>> > WRITE_TREE_SILENT | >>>>> > WRITE_TREE_REPAIR); >>>>> > } >>>>> > - move_index_extensions(&o->result, o->dst_index); >>>>> > + move_index_extensions(&o->result, o->src_index); >>>>> >>>>> While this looks like the right thing to do on paper, I believe it's >>>>> actually broken for a specific case of untracked cache. In short, >>>>> please do not touch this line. I will send a patch to revert >>>>> edf3b90553 (unpack-trees: preserve index extensions - 2017-05-08), >>>>> which essentially deletes this line, with proper explanation and >>>>> perhaps a test if I could come up with one. >>>>> >>>>> When we update the index, we depend on the fact that all updates must >>>>> invalidate the right untracked cache correctly. In this unpack >>>>> operations, we start copying entries over from src to result. Since >>>>> 'result' (at least from the beginning) does not have an untracked >>>>> cache, it has nothing to invalidate when we copy entries over. By the >>>>> time we have done preparing 'result', what's recorded in src's (or >>>>> dst's for that matter) untracked cache may or may not apply to >>>>> 'result' index anymore. This copying only leads to more problems when >>>>> untracked cache is used. >>>> >>>> Is there really no way to invalidate just individual entries? >>> >>> Grr.... the short answer is the current code (i.e. without Elijah's >>> changes) works but in a twisted way. So you get to keep untracked >>> cache in the end. >> >> GAAAHH.. it works _with_ Elijah's changes (since he made the change >> from dst to src) not without (and no performance regression). > > So...is that an Acked-by for the patch
Yes, Acked-by: me.
Show 5 quoted lines
> or does the "two wrong make a > right, I guess" comment suggest that we should still drop the > move_index_extensions change (essentially reverting to v1 of the PATCH > as found at 20180421193736.12722-1-newren@gmail.com), and you'll fix > things up further in a separate series?
I think I'll stay away from this file for a while. When I gather enough courage, I'll need to read it through since it sounds like a mine field.
-- Duy