From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>, git@vger.kernel.org
Subject: Re: Pathological performance with git remote rename and many tracking refs
Date: Fri, 15 Apr 2022 10:25:26 -0700 [thread overview]
Message-ID: <xmqqfsmedzsp.fsf@gitster.g> (raw)
In-Reply-To: <220415.868rs6cyal.gmgdl@evledraar.gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Fri, 15 Apr 2022 14:26:16 +0200")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> I actually wonder if this wouldn't be that hard, because if we have any
> reflogs we could simply "replay" them by turning (again, I'm a bit rusty
> on the exact lock dance);
>
> lock(refs/remotes/origin/master);
> lock(refs/remotes/def/master);
> create(refs/remotes/def/master, refs/remotes/origin/master^{});
Why deref? Trying to be prepared for seeing a symbolic ref, or
something?
> delete(refs/remotes/origin/master);
> unlock(refs/remotes/origin/master);
> unlock(refs/remotes/def/master);
>
> Into instead doing:
>
> lock(refs/remotes/origin/master);
> lock(refs/remotes/def/master);
> for from, to, msg ref_update(refs/remotes/origin/master):
> update(refs/remotes/def/master, from, to, msg);
> delete(refs/remotes/origin/master);
> unlock(refs/remotes/origin/master);
> unlock(refs/remotes/def/master);
Would this (or the above, for that matter) work well when renaming 'foo'
to 'foo/bar' (or the other way around), I wonder?
Anyway.
Is the reasoning behind "replay each and every reflog entry" because
you are trying to avoid depending on the implementation detail (i.e.
"R=.git/logs/refs/remotes; mv $R/origin/master $R/def/master" works
only with the files backend)? Unless we are willing to add a new
ref backend method to help this natively, it would be a workable but
an ultra-slow way to do so, as it would involve open, write, fsync,
and close for each reflog entry.
... goes and looks ...
Hmph, I am utterly confused. refs/files-backend.c eventually
dispatches to files_copy_or_rename_ref() when rename_ref method in
ref_storage_be is used on the files backend, and the function
already renames the reflog file without having to copy entry by
entry. We cannot just open a transaction, run many rename_refs and
close it?
next prev parent reply other threads:[~2022-04-15 17:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-13 22:32 Pathological performance with git remote rename and many tracking refs brian m. carlson
2022-04-14 7:12 ` Ævar Arnfjörð Bjarmason
2022-04-15 1:08 ` brian m. carlson
2022-04-15 12:26 ` Ævar Arnfjörð Bjarmason
2022-04-15 17:25 ` Junio C Hamano [this message]
2022-04-16 11:23 ` Ævar Arnfjörð Bjarmason
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=xmqqfsmedzsp.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=sandals@crustytoothpaste.net \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.