From: Junio C Hamano <gitster@pobox•com>
To: Shawn Pearce <spearce@spearce•org>
Cc: git <git@vger•kernel.org>
Subject: Re: [PATCH] Introduce experimental remote object access mode
Date: Tue, 11 Feb 2014 11:29:15 -0800 [thread overview]
Message-ID: <xmqqppmtphx0.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAJo=hJsO=FBkiOo5fuPbToxE1SR3Lh8oim0eTAR6bH1a-TcdPA@mail.gmail.com> (Shawn Pearce's message of "Tue, 11 Feb 2014 00:54:54 -0800")
Shawn Pearce <spearce@spearce•org> writes:
> Why would you do this? Perhaps you need more time in your day
> to consume tea or coffee. Set GIT_RTT and enjoy a beverage.
So the conclusion is that it is not practical to do a lazy fetch if
it is done extremely naively at "we want this object --- wait a bit
and we'll give you" level?
I am wondering if we can do a bit better, like "we want this object
--- wait a bit, ah that's a commit, so it is likely that you may
want the trees and blobs associated with it, too, if not right now
but in a near future, let me push a pack that holds them to you"?
>
> So-not-signed-off-by: this author or anyone else
> ---
>
> :-)
>
> sha1_file.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/sha1_file.c b/sha1_file.c
> index 6e8c05d..9bdcbc3 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -38,6 +38,7 @@ const unsigned char null_sha1[20];
>
> static const char *no_log_pack_access = "no_log_pack_access";
> static const char *log_pack_access;
> +static useconds_t rtt;
>
> /*
> * This is meant to hold a *small* number of objects that you would
> @@ -436,9 +437,20 @@ void prepare_alt_odb(void)
> read_info_alternates(get_object_directory(), 0);
> }
>
> +static void apply_rtt()
> +{
> + if (!rtt) {
> + char *rtt_str = getenv("GIT_RTT");
> + rtt = rtt_str ? strtoul(rtt_str, NULL, 10) * 1000 : 1;
> + }
> + if (rtt > 1)
> + usleep(rtt);
> +}
> +
> static int has_loose_object_local(const unsigned char *sha1)
> {
> char *name = sha1_file_name(sha1);
> + apply_rtt();
> return !access(name, F_OK);
> }
>
> @@ -1303,6 +1315,7 @@ void prepare_packed_git(void)
>
> if (prepare_packed_git_run_once)
> return;
> +
> prepare_packed_git_one(get_object_directory(), 1);
> prepare_alt_odb();
> for (alt = alt_odb_list; alt; alt = alt->next) {
> @@ -1439,6 +1452,7 @@ static int open_sha1_file(const unsigned char *sha1)
> struct alternate_object_database *alt;
>
> fd = git_open_noatime(name);
> + apply_rtt();
> if (fd >= 0)
> return fd;
next prev parent reply other threads:[~2014-02-11 19:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-11 8:54 [PATCH] Introduce experimental remote object access mode Shawn Pearce
2014-02-11 19:29 ` Junio C Hamano [this message]
2014-02-12 20:55 ` Shawn Pearce
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqppmtphx0.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=spearce@spearce$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox