From: Junio C Hamano <gitster@pobox.com>
To: Kirill Smelkov <kirr@nexedi.com>
Cc: "Jeff King" <peff@peff.net>, "Jérome Perrin" <jerome@nexedi.com>,
"Isabelle Vallet" <isabelle.vallet@nexedi.com>,
"Kazuhiko Shiozaki" <kazuhiko@nexedi.com>,
"Julien Muchembled" <jm@nexedi.com>,
git@vger.kernel.org, "Vicent Marti" <tanoku@gmail.com>
Subject: Re: [PATCH] pack-objects: Use reachability bitmap index when generating non-stdout pack too
Date: Wed, 27 Jul 2016 13:40:36 -0700 [thread overview]
Message-ID: <xmqqlh0mvmpn.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160727201506.GA15204@teco.navytux.spb.ru> (Kirill Smelkov's message of "Wed, 27 Jul 2016 23:15:06 +0300")
Kirill Smelkov <kirr@nexedi.com> writes:
> > From: Kirill Smelkov <kirr@nexedi.com>
> Subject: [PATCH 1/2] pack-objects: Make sure use_bitmap_index is not active under
> --local or --honor-pack-keep
>
> Since 6b8fda2d (pack-objects: use bitmaps when packing objects) there
> are two codepaths in pack-objects: with & without using bitmap
> reachability index.
>
> However add_object_entry_from_bitmap(), despite its non-bitmapped
> counterpart add_object_entry(), in no way does check for whether --local
> or --honor-pack-keep should be respected. In non-bitmapped codepath this
> is handled in want_object_in_pack(), but bitmapped codepath has simply
> no such checking at all.
>
> The bitmapped codepath however was allowing to pass --local and
> --honor-pack-keep and bitmap indices were still used under such
> conditions - potentially giving wrong output (including objects from
> non-local or .keep'ed pack).
>
> Instead of fixing bitmapped codepath to respect those options, since
> currently no one actually need or use them in combination with bitmaps,
> let's just force use_bitmap_index=0 when any of --local or
> --honor-pack-keep are used and add appropriate comment about
> not-checking for those in add_object_entry_from_bitmap()
>
> Suggested-by: Jeff King <peff@peff.net>
> ---
> builtin/pack-objects.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> index 15866d7..d7cf782 100644
> --- a/builtin/pack-objects.c
> +++ b/builtin/pack-objects.c
> @@ -1055,6 +1055,12 @@ static int add_object_entry_from_bitmap(const unsigned char *sha1,
> if (have_duplicate_entry(sha1, 0, &index_pos))
> return 0;
>
> + /*
> + * for simplicity we always want object to be in pack, as
> + * use_bitmap_index codepath assumes neither --local nor --honor-pack-keep
> + * is active.
> + */
I am not sure this comment is useful to readers.
Unless the readers are comparing add_object_entry() and this
function and wondering why this side lacks a check here, iow, when
they are merely following from a caller of this function through
this function down to its callee to understand what goes on, this
comment would not help them and only confuse them.
If we were to say something to help those who are comparing these
two functions, I think we should be more explicit, i.e.
The caller disables use-bitmap-index when --local or
--honor-pack-keep options are in effect because bitmap code is
not prepared to handle them. Because the control does not reach
here if these options are in effect, the check with
want_object_in_pack() to skip objects is not done.
or something like that.
Or is the rest of the bitmap codepath prepared to handle these
options and it is just the matter of adding the missing check with
want_object_in_pack() here to make it work correctly?
> create_object_entry(sha1, type, name_hash, 0, 0, index_pos, pack, offset);
>
> display_progress(progress_state, nr_result);
> @@ -2776,6 +2782,15 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
> if (!use_internal_rev_list || !pack_to_stdout || is_repository_shallow())
> use_bitmap_index = 0;
>
> + /*
> + * "lazy" reasons not to use bitmaps; it is easier to reason about when
> + * neither --local nor --honor-pack-keep is in action, and so far no one
> + * needed nor implemented such support yet.
> + */
Justifying comment like this is a good idea, but the comment above
does not make it very clear that this is a correctness fix, i.e. if
we do not disable, the code will do a wrong thing.
The other logic to disable use of bitmap we can see in the
pre-context would also benefit from some description as to why;
6b8fda2d (pack-objects: use bitmaps when packing objects,
2013-12-21) didn't do a very good job in that---the reason is not
clear in its log message, either.
> + if (local || ignore_packed_keep)
> + use_bitmap_index = 0;
> +
> +
I see one extra blank line here ;-)
> if (pack_to_stdout || !rev_list_all)
> write_bitmap_index = 0;
Thanks.
next prev parent reply other threads:[~2016-07-27 20:40 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-07 19:09 [PATCH] pack-objects: Use reachability bitmap index when generating non-stdout pack too Kirill Smelkov
2016-07-07 20:52 ` Jeff King
2016-07-08 10:38 ` Kirill Smelkov
2016-07-12 19:08 ` Kirill Smelkov
2016-07-13 8:30 ` Jeff King
2016-07-13 8:26 ` Jeff King
2016-07-13 10:52 ` Kirill Smelkov
2016-07-17 17:06 ` Kirill Smelkov
2016-07-19 11:29 ` Jeff King
2016-07-19 12:14 ` Kirill Smelkov
2016-07-25 18:40 ` Jeff King
2016-07-25 18:53 ` Jeff King
2016-07-27 20:15 ` Kirill Smelkov
2016-07-27 20:40 ` Junio C Hamano [this message]
2016-07-28 20:22 ` Kirill Smelkov
2016-07-28 21:18 ` Junio C Hamano
2016-07-29 7:40 ` Kirill Smelkov
2016-07-29 7:46 ` [PATCH 1/2] pack-objects: Teach --use-bitmap-index codepath to respect --local, --honor-pack-keep and --incremental Kirill Smelkov
2016-08-01 18:17 ` Junio C Hamano
2016-08-08 12:37 ` Kirill Smelkov
2016-08-08 13:50 ` Jeff King
2016-08-08 13:51 ` Jeff King
2016-08-08 16:08 ` Junio C Hamano
2016-08-08 19:06 ` Junio C Hamano
2016-08-08 19:09 ` Jeff King
2016-08-08 16:11 ` Junio C Hamano
2016-08-08 18:19 ` Kirill Smelkov
2016-08-08 18:57 ` [PATCH v3] " Kirill Smelkov
2016-08-08 19:26 ` [PATCH 1/2] " Junio C Hamano
2016-08-09 11:21 ` Kirill Smelkov
2016-08-09 11:25 ` [PATCH 1/2 v4] pack-objects: respect --local/--honor-pack-keep/--incremental when bitmap is in use Kirill Smelkov
2016-08-09 16:52 ` [PATCH 1/2] pack-objects: Teach --use-bitmap-index codepath to respect --local, --honor-pack-keep and --incremental Junio C Hamano
2016-08-09 19:29 ` Kirill Smelkov
2016-08-09 19:31 ` [PATCH 1/2 v5] pack-objects: respect --local/--honor-pack-keep/--incremental when bitmap is in use Kirill Smelkov
2016-08-18 17:52 ` Jeff King
2016-09-10 14:57 ` Kirill Smelkov
2016-09-10 15:01 ` [PATCH 1/2 v8] " Kirill Smelkov
2016-09-13 6:23 ` Junio C Hamano
2016-09-13 7:50 ` Kirill Smelkov
2016-09-10 15:05 ` [PATCH] t/perf/run: Don't forget to copy config.mak.autogen & friends to build area Kirill Smelkov
2016-09-12 19:12 ` Junio C Hamano
2016-09-12 19:17 ` Junio C Hamano
2016-09-12 23:10 ` Junio C Hamano
2016-09-13 6:58 ` Kirill Smelkov
2016-09-12 17:33 ` [PATCH 1/2 v5] pack-objects: respect --local/--honor-pack-keep/--incremental when bitmap is in use Junio C Hamano
2016-08-09 19:32 ` [PATCH 2/2 v7] pack-objects: use reachability bitmap index when generating non-stdout pack Kirill Smelkov
2016-08-18 18:06 ` Jeff King
2016-09-10 14:59 ` Kirill Smelkov
2016-09-10 15:01 ` [PATCH 2/2 v8] " Kirill Smelkov
2016-09-12 19:21 ` [PATCH 2/2 v7] " Junio C Hamano
2016-08-09 19:49 ` [PATCH 1/2] pack-objects: Teach --use-bitmap-index codepath to respect --local, --honor-pack-keep and --incremental Junio C Hamano
2016-07-29 7:47 ` [PATCH v4 2/2] pack-objects: Teach it to use reachability bitmap index when generating non-stdout pack too Kirill Smelkov
2016-08-08 13:56 ` Jeff King
2016-08-08 15:40 ` Kirill Smelkov
2016-08-08 18:08 ` Junio C Hamano
2016-08-08 18:13 ` Kirill Smelkov
2016-08-08 18:28 ` Junio C Hamano
2016-08-08 18:58 ` Kirill Smelkov
2016-08-08 18:55 ` [PATCH v5] pack-objects: teach " Kirill Smelkov
2016-08-08 20:53 ` Junio C Hamano
2016-08-09 11:21 ` Kirill Smelkov
2016-08-09 11:26 ` [PATCH 2/2 v6] pack-objects: use reachability bitmap index when generating non-stdout pack Kirill Smelkov
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=xmqqlh0mvmpn.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=isabelle.vallet@nexedi.com \
--cc=jerome@nexedi.com \
--cc=jm@nexedi.com \
--cc=kazuhiko@nexedi.com \
--cc=kirr@nexedi.com \
--cc=peff@peff.net \
--cc=tanoku@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.
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.