git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Tan <jonathantanmy@google.com>
To: stolee@gmail.com
Cc: jonathantanmy@google.com, git@vger.kernel.org
Subject: Re: [PATCH] cache-tree: do not lazy-fetch merge tree
Date: Wed,  4 Sep 2019 15:35:29 -0700	[thread overview]
Message-ID: <20190904223529.135623-1-jonathantanmy@google.com> (raw)
In-Reply-To: <69f2b069-3e11-4a2e-9b81-bde18c463d8c@gmail.com>

> On 9/3/2019 3:42 PM, Jonathan Tan wrote:
> > When cherry-picking (for example), new trees may be constructed. During
> > this process, Git checks whether these trees exist. However, in a
> > partial clone, this causes a lazy fetch to occur, which is both
> > unnecessary (because Git has already constructed this tree as part of
> > the cherry-picking process) and likely to fail (because the remote
> > probably doesn't have this tree).
> 
> If we have constructed the object already, then why do we not see it
> and avoid fetching it? This must be a slightly strange timing issue
> with objects being flushed to disk or added to the object cache.

Thanks for taking a look at this! The answer is that I wasn't precise
when I said "already constructed" - I meant that it is in a struct
strbuf. It hasn't been written to disk yet, so has_object_file() does
not see it.

> One approach is to find all of these has_object_file() calls that should
> really be one with OBJECT_INFO_SKIP_FETCH_OBJECT. Another would be to
> find out why has_object_file() isn't seeing the object we constructed.

By the former, do you mean that we should look at the other
has_object_file() calls? I looked at the others in cache-tree.c and I
think the one in this patch is the only one that is called on an OID
generated from hash_object_file(). (And I answered the latter in the
above paragraph.)

To avoid confusion, maybe this commit message is better:

When cherry-picking (for example), new trees may be constructed. During
this process, Git constructs the new tree in a struct strbuf, computes
the OID of the new tree, and checks if the new OID already exists on
disk. However, in a partial clone, the disk check causes a lazy fetch to
occur, which is both unnecessary (because we have the tree in the struct
strbuf) and likely to fail (because the remote probably doesn't have
this tree).

  reply	other threads:[~2019-09-04 22:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-03 19:42 [PATCH] cache-tree: do not lazy-fetch merge tree Jonathan Tan
2019-09-04  1:37 ` Derrick Stolee
2019-09-04 22:35   ` Jonathan Tan [this message]
2019-09-04 23:35     ` Junio C Hamano
2019-09-09 19:01 ` [PATCH v2] " Jonathan Tan
2019-09-09 19:55   ` Junio C Hamano
2019-09-09 21:05     ` Junio C Hamano
2019-09-09 22:21       ` Jeff King
2019-09-10  1:09         ` Junio C Hamano
2019-09-10 18:15       ` Jonathan Tan
2019-09-10 12:49   ` SZEDER Gábor
2019-09-10 18:19     ` Jonathan Tan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190904223529.135623-1-jonathantanmy@google.com \
    --to=jonathantanmy@google.com \
    --cc=git@vger.kernel.org \
    --cc=stolee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).