Re: [PATCH 6/6] commit-graph: implement corrected commit date offset
- From
Abhishek Kumar <abhishekkumar8222@gmail.com>
- Date
- Jul 30, 2020, 07:27 UTC
- Message-ID
- <20200730072714.GA964@Abhishek-Arch>
- In-Reply-To
- <e8646aaa-667f-b7d8-f8f2-efbaaeb8877d@gmail.com>
On Tue, Jul 28, 2020 at 11:55:12AM -0400, Derrick Stolee wrote:
Show 10 quoted lines
> On 7/28/2020 5:13 AM, Abhishek Kumar via GitGitGadget wrote: > > From: Abhishek Kumar <abhishekkumar8222@gmail.com> > > > > With preparations done,... > > I feel like this commit could have been made smaller by doing the > uint32_t -> timestamp_t conversion in a separate patch. That would > make it easier to focus on the changes to the generation number v2 > logic. >
Sure, would seperate into two patches.
Show 7 quoted lines
> > let's implement corrected commit date offset. > > We add a new commit-slab to store topological levels while writing > > It's important to add: we store topological levels to ensure that older > versions of Git will still have the performance benefits from generation > number v1. >
Will do.
Show 6 quoted lines
> > commit graph and upgrade number of struct commit_graph_data to 64-bits. > > Do you mean "update the generation member in struct commit_graph_data > to a 64-bit timestamp"? The struct itself also has the 32-bit graph_pos > member. >
Yes, "update the generation number".
Show 15 quoted lines
> > We have to touch many files, upgrading generation number from uint32_t > > to timestamp_t. > > Yes, that's why I recommend doing that in a different step. > > > We drop 'detect incorrect generation number' from t5318-commit-graph.sh, > > which tests if verify can detect if a commit graph have > > GENERATION_NUMBER_ZERO for a commit, followed by a non-zero generation. > > With corrected commit dates, GENERATION_NUMBER_ZERO is possible only if > > one of dates is Unix epoch zero. > > What about the topological levels? Are we caring about verifying the data > that we start to ignore in this new version? I'm hesitant to drop this > right now, but I'm open to it if we really don't see it as a valuable test. >
We haven't tested the scenario "New Git reads a commit graph without GDAT chunk" yet. Verifying topological levels (along with many of the changed offsets) would be a part of the scenario.
Now that I think about it, those tests should have been included with this patch.
Show 8 quoted lines
> > Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com> > > [...] > > Later you assign data->generation to be "max_corrected_commit_date + 1", > which made me think this should be "current->date - 1". Is that so? Or, > do we want most offsets to be one instead of zero? Is there value there? >
Does it?
I had hoped most of the offsets could have been zero, as we could take advantage of the fact that commit-slab zero initializes values and avoid a commit-slab access.
Right, What I meant to do was:
/*
* max_parent_corrected_commit_date is initialized with zero and
* takes the maximum of
* (parent->item->date + commit_graph_data_at(parent->item)->generation)
*/ if (max_parent_corrected_commit_date >= current->date)
{
struct commit_graph_data *data = commit_graph_data_at(current);
data->generation = max_parent_corrected_commit_date + 1;
}Thanks for pointing this out!
> [...]
- Abhishek