From: Junio C Hamano <gitster@pobox.com>
To: "Jens Lindström" <jl@opera.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] remote: defer repacking packed-refs when deleting refs
Date: Tue, 20 May 2014 12:30:12 -0700 [thread overview]
Message-ID: <xmqqtx8kxn7f.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <537B30E7.5020505@opera.com> ("Jens Lindström"'s message of "Tue, 20 May 2014 12:39:35 +0200")
Jens Lindström <jl@opera.com> writes:
> When 'git remote rm' or 'git remote prune' were used in a repository
> with many refs, and needed to delete many refs, a lot of time was spent
> deleting those refs since for each deleted ref, repack_without_refs()
> was called to rewrite packed-refs without just that deleted ref.
>
> To avoid this, defer the repacking until after all refs have been
> deleted (by delete_ref()), and then call repack_without_refs() once to
> repack without all the deleted refs.
>
> Signed-off-by: Jens Lindström <jl@opera.com>
> ---
> This patch changes behavior when the operation is aborted in the
> middle, so that loose refs and ref logs might have been deleted, but
> not the corresponding entries in packed-refs, since packed-refs is now
> only updated at the end.
Also this makes it a bit more dangerous for processes accessing the
repository while pruning is in progress by exposing stale refs that
may be pointing at objects that are no longer present in the object
store in the packed-refs file for a longer period ("git fsck" may
fail, for example).
As long as we accept that removing a remote or pruning one are kinds
of "maintenance" operations and nobody else should be peeking into
the repository during maintenance period, it may be alright, but
aborting the operation in the middle will essentially leave the
repository in a corrupted state---the "abort corrupts" is a downside
with or without this change and is not a new problem.
A bit safer way to organize might be to first create a list of the
refs to be removed in-core, update packed-refs without these refs to
be removed, and then finally remove the loose ones, but I haven't
thought things through.
next prev parent reply other threads:[~2014-05-20 19:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-20 10:34 [PATCH 0/2] remote: optimize rm/prune ref deletion Jens Lindström
2014-05-20 10:39 ` [PATCH 1/2] remote: defer repacking packed-refs when deleting refs Jens Lindström
2014-05-20 19:30 ` Junio C Hamano [this message]
2014-05-20 20:29 ` Junio C Hamano
2014-05-23 10:03 ` Jens Lindström
2014-05-23 17:09 ` Junio C Hamano
2014-05-24 7:54 ` Jens Lindström
2014-05-27 16:55 ` Junio C Hamano
2014-05-20 10:41 ` [PATCH 2/2] remote prune: optimize "dangling symref" check/warning Jens Lindström
2014-05-23 10:26 ` [PATCH v2 0/3] remote: optimize rm/prune ref deletion Jens Lindström
2014-05-23 10:28 ` [PATCH v2 1/3] remote rm: delete remote configuration as the last Jens Lindström
2014-05-23 18:55 ` Junio C Hamano
2014-05-23 10:29 ` [PATCH v2 2/3] remote: repack packed-refs once when deleting multiple refs Jens Lindström
2014-05-23 19:11 ` Junio C Hamano
2014-05-23 19:25 ` Junio C Hamano
2014-05-23 10:30 ` [PATCH v2 3/3] remote prune: optimize "dangling symref" check/warning Jens Lindström
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=xmqqtx8kxn7f.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jl@opera.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.
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.