git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC] Generation Number v2

From
Jakub Narebski <jnareb@gmail.com>
Date
Nov 1, 2018, 20:06 UTC
Message-ID
<86tvl0zhos.fsf@gmail.com>
In-Reply-To
<CAGZ79ka-FTqaXdrMixjUp2THJ3L0YvEnkKxs3XFgB3WEEy2-Tg@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
Show 18 quoted lines
>> Based on the performance results alone, we should remove minimum
>> generation numbers, (epoch, date) pairs, and FELINE index from
>> consideration. There are enough examples of these indexes performing
>> poorly.
>>
>> In contrast, maximum generation numbers and corrected commit
>> dates both performed quite well. They are frequently the top
>> two performing indexes, and rarely significantly different.
>>
>> The trade-off here now seems to be: which _property_ is more important,
>> locally-computable or backwards-compatible?
>>
>> * Maximum generation number is backwards-compatible but not
>>    locally-computable or immutable.
>
> These maximum generation numbers sound like the reverse of
> the generation numbers as they are currently implemented, i.e.
> we count all commits between the commit A and all heads.
Actually
  maximum generation number =
  number of commits  -  reverse generation number
Show 10 quoted lines
> How would this impact creation of a commit?
>
> The current generation numbers can be lazily updated or not
> updated at all. In my understanding of the maximum generation
> numbers, a new commit would make these maximum generation
> numbers invalid (i.e. they have to be recomputed).
>
> Are there ways out by deferring the computation of maximum
> generation numbers while still being able to work with some
> commits that are un-accounted for?

As I understand it, new commits added since commit-graph file was created would get simply INFINITY maximum/maximal generation numbers (if we were using reverse generation numbers, new commits would get ZERO for generation number).

Show 6 quoted lines
> When recomputing these numbers, the current generation number
> (V0) has the property that already existing numbers can be re-used
> as-is. We only need to compute the numbers for new commits,
> and then insert this to the appropriate data structures (which is
> a separate problem, one could imagine a split generation
> numbers file like the split index)
Sidenote: I wonder if there is some on-disk data structure with
similarly fast read, but easier update.
Show 5 quoted lines
> For the V2 maximum generation numbers, would we need to
> rewrite the numbers for all commits once we recompute them?
> Assuming that is true, it sounds like the benchmark doesn't
> cover the whole costs associated with V2, which is why the
> exceptional performance can be explained.
Let's check it using a simple example

First, (minimum) parent-based generation numbers before and after extending the commit graph:

  1   2     3   4     5   6   7    new
  1   2     3   4     5   -   -    old
  .---.-----.---.-----.---*---*
       \
        \   3   4     5   6        new
         \  3   4     5   6        old
          \-.---.-----.---.
                 \
                  \   5            new
                   \  -            old
                    \-*

Next, maximum generation numbers. We start with 9 commits, and we end up with 12 commits after the change

  6   7     8   9     10  11  12   new
  4   5     7   8     9   -   -    old
  .---.-----.---.-----.---*---*
       \
        \   9   10    11  12       new
         \  6   7     8   9        old
          \-.---.-----.---.
                 \
                  \   12           new
                   \  -            old
                    \-*
As you can see all maximum generation numbers got rewritten.

Though if instead using the number of commits, we use the maximum generation number, or in other words the length of the longest path, we get the following:

  1   2     3   4     5   6   7    new
  1   2     4   5     6   -   -    old
  .---.-----.---.-----.---*---*
       \
        \   4   5     6   7        new
         \  3   4     5   6        old
          \-.---.-----.---.
                 \
                  \   7            new
                   \  -            old
                    \-*
A bit better, but still much change in numbers.
[...]
Show 24 quoted lines
>>
>> * Corrected commit-date is locally-computable and immutable,
>>    but not backwards-compatible.
>
> How are these dates not backwards incompatible?
> We don't have to expose these dates to the user, but
> - just like generation numbers - could store them and use them
> but not tell the user about it.
>
> We would need to be really careful to not expose them at all
> as they look like the real dates, so that could make for an
> awkward bug report.
>
> The approach of "corrected commit date" sounds like we could
> have a very lazy approach, i.e. no extra data structures needed
> for many commits (as the corrected date equals the real date)
> and only need to store the corrections for some commits.
> Such an approach however would not make it easy to know
> if we operate on corrected dates, or if we even checked them
> for correctness before.
>
> So if we'd have an additional row in the generation numbers file
> telling the corrected date, then we should be able to be backwards
> compatible?

Here, from what I understand, being "backwards compatibile" means being able to use commit-graph file using the new format by old client, trating the data as if they were generation numbers and not data offsets.

Best, -- Jakub Narębski

Previous: Derrick StoleeNext: Jakub Narebski
Message 4 of 17 in “[RFC] Generation Number v2”
  1. Derrick StoleeOct 29, 2018
  2. Stefan BellerOct 29, 2018
  3. Derrick StoleeOct 29, 2018
  4. Jakub NarebskiNov 1, 2018
  5. Jakub NarebskiNov 2, 2018
  6. Jakub NarebskiNov 3, 2018
  7. Derrick StoleeOct 29, 2018
  8. Jakub NarebskiNov 1, 2018
  9. Junio C HamanoOct 30, 2018
  10. Derrick StoleeOct 31, 2018
  11. Jakub NarebskiNov 2, 2018
  12. Ævar Arnfjörð BjarmasonOct 31, 2018
  13. Derrick StoleeOct 31, 2018
  14. Jakub NarebskiNov 2, 2018
  15. Jakub NarebskiNov 1, 2018
  16. Derrick StoleeNov 1, 2018
  17. Jakub NarebskiNov 3, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.