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

Re: [PATCH v3 09/11] commit-graph: use generation v2 only if entire chain does

From
Jakub Narębski <jnareb@gmail.com>
Date
Aug 26, 2020, 10:38 UTC
Message-ID
<857dtld75f.fsf@gmail.com>
In-Reply-To
<20200826071519.GA6805@Abhishek-Arch>
Hi Abhishek,
Abhishek Kumar <abhishekkumar8222@gmail.com> writes:
Show 14 quoted lines
> On Sat, Aug 22, 2020 at 07:14:38PM +0200, Jakub Narębski wrote:
>> Hi Abhishek,
>>
>> ...
>>
>> However the commit message do not say anything about the *writing* side.
>>
>
> Revised the commit message to include the following at the end:
>
> When writing the new layer in split commit-graph, we write a GDAT chunk
> only if the topmost layer has a GDAT chunk. This guarantees that if a
> layer has GDAT chunk, all lower layers must have a GDAT chunk as well.
>
All right.
> Rewriting layers follows similar approach: if the topmost layer below
> set of layers being rewritten (in the split commit-graph chain) exists,
> and it does not contain GDAT chunk, then the result of rewrite does not
> have GDAT chunks either.
All right.
I see that you went with proposed more complex (but better) solution...
Show 13 quoted lines
>>
>> ...
>>
>> To be more detailed, without '--split=replace' we would want the following
>> layer merging behavior:
>>
>>    [layer with GDAT][with GDAT][without GDAT][without GDAT][without GDAT]
>>            1              2           3             4            5
>>
>> In the split commit-graph chain above, merging two topmost layers
>> (layers 4 and 5) should create a layer without GDAT; merging three
>> topmost layers (and any other layers, e.g. two middle ones, i.e. 3 and
>> 4) should create a new layer with GDAT.

A simpler solution would be to create a new merged layer without GDAT if any of the layers being merged do not have GDAT.

In this solution merging 3+4+5, 3+4, and even 2+3 would result with layer without GDAT, and only merging 1+2 would result in layer with GDAT.

Show 33 quoted lines
>>
>>    [layer with GDAT][with GDAT][without GDAT][-------without GDAT-------]
>>            1              2           3               merged
>>
>>    [layer with GDAT][with GDAT][-------------with GDAT------------------]
>>            1              2                    merged
>>
>> I hope those ASCII-art pictures help understanding it
>>
>
> Thanks! There were helpful.
>
> While we work as expected in the first scenario i.e merging 4 and 5, we
> would *still* write a layer without GDAT in the second scenario.
>
> I have tweaked split_graph_merge_strategy() to fix this:
>
> ----------------------------------------------
>
> diff --git a/commit-graph.c b/commit-graph.c
> index 6d54d9a286..246fad030d 100644
> --- a/commit-graph.c
> +++ b/commit-graph.c
> @@ -1973,6 +1973,9 @@ static void split_graph_merge_strategy(struct write_commit_graph_context *ctx)
>  		}
>  	}
>
> +	if (!ctx->write_generation_data && g->chunk_generation_data)
> +		ctx->write_generation_data = 1;
> +
>  	if (flags != COMMIT_GRAPH_SPLIT_REPLACE)
>  		ctx->new_base_graph = g;
>  	else if (ctx->num_commit_graphs_after != 1)
...which turned out to be not that complicated.  Nice work!

Though this needs tests that if fulfills the stated condition (because I am not sure if it is entirely correct: we are not checking the layer below current one, isn't it?... ah, you explain it below).

One possible solution would be to grep `test-tool read-graph` output for "^chunks: ", then pass it through `uniq` (without `sort`!), check that the number of lines is less or equal 2, and if there are two lines then check that we get the following contents:

  chunks: oid_fanout oid_lookup commit_metadata generation_data
  chunks: oid_fanout oid_lookup commit_metadata
(assuming that information about layers is added in top-down order).

This test must be run with GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0, which I think is the default.

Show 6 quoted lines
> ----------------------------------------------------
>
> That is, if we were not writing generation data (because of mixed
> generation concerns) but the new topmost layer has a generation data
> chunk, we have merged all layers without GDAT chunk and can now write a
> GDAT chunk safely.
All right.
[...]
Show 18 quoted lines
>>> diff --git a/commit-graph.h b/commit-graph.h
>>> index f78c892fc0..3cf89d895d 100644
>>> --- a/commit-graph.h
>>> +++ b/commit-graph.h
>>> @@ -63,6 +63,7 @@ struct commit_graph {
>>>  	struct object_directory *odb;
>>>
>>>  	uint32_t num_commits_in_base;
>>> +	uint32_t read_generation_data;
>>>  	struct commit_graph *base_graph;
>>>
>>
>> First, why `read_generation_data` is of uint32_t type, when it stores
>> (as far as I understand it), a "boolean" value of either 0 or 1?
>
> Yes, using unsigned int instead of uint32_t (although in most of cases
> it would be same).  If commit_graph had other flags as well, we could
> have used a bit field.
OK.
Show 6 quoted lines
>> Second, couldn't we simply set chunk_generation_data to NULL?  Or would
>> that interfere with the case of rewriting, where we want to use existing
>> GDAT data when writing new commit-graph with GDAT chunk?
>
> It interferes with rewriting the split commit-graph, as you might have
> guessed from the above code snippet.
All right.
[...]
Show 14 quoted lines
>>> @@ -885,6 +908,7 @@ void load_commit_graph_info(struct repository *r, struct commit *item)
>>>  	uint32_t pos;
>>>  	if (!prepare_commit_graph(r))
>>>  		return;
>>> +
>>>  	if (find_commit_in_graph(item, r->objects->commit_graph, &pos))
>>>  		fill_commit_graph_info(item, r->objects->commit_graph, pos);
>>>  }
>>
>> This is unrelated whitespace fix, a "while at it" in neighbourhood of
>> changes.  All right then.
>>
>
> Reverted this change, as it's unimportant.

Actually I am not against fixing the whitespace in the neighbourhood of changes, so you can keep it or revert it (discard).

Show 9 quoted lines
>>> @@ -2192,6 +2216,9 @@ int write_commit_graph(struct object_directory *odb,
>>
>> ...
>>
>> It would be nice to have an example with merging layers (whether we
>> would handle it in strict or relaxed way).
>>
>
> Sure, will add.
Thanks.

Best, -- Jakub Narębski

Previous: Abhishek KumarNext: Abhishek Kumar via GitGitGadget
Message 82 of 211 in “[GSoC] Implement Corrected Commit Date”
  1. 0/6 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Jul 28, 2020
  2. 1/6 commit-graph: fix regression when computing bloom filterAbhishek Kumar via GitGitGadget, Jul 28, 2020
  3. Taylor BlauJul 28, 2020
  4. Abhishek KumarJul 30, 2020
  5. Jakub NarębskiAug 4, 2020
  6. Taylor BlauAug 4, 2020
  7. Jakub NarębskiAug 4, 2020
  8. Jakub NarębskiAug 4, 2020
  9. 2/6 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Jul 28, 2020
  10. Derrick StoleeJul 28, 2020
  11. Taylor BlauJul 28, 2020
  12. Jakub NarębskiAug 5, 2020
  13. 3/6 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Jul 28, 2020
  14. Derrick StoleeJul 28, 2020
  15. René ScharfeJul 28, 2020
  16. Derrick StoleeJul 28, 2020
  17. Taylor BlauJul 28, 2020
  18. Abhishek KumarJul 30, 2020
  19. 4/6 commit-graph: consolidate compare_commits_by_genAbhishek Kumar via GitGitGadget, Jul 28, 2020
  20. Taylor BlauJul 28, 2020
  21. 5/6 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Jul 28, 2020
  22. Taylor BlauJul 28, 2020
  23. Abhishek KumarJul 30, 2020
  24. 6/6 commit-graph: implement corrected commit date offsetAbhishek Kumar via GitGitGadget, Jul 28, 2020
  25. Derrick StoleeJul 28, 2020
  26. Taylor BlauJul 28, 2020
  27. Abhishek KumarJul 30, 2020
  28. Taylor BlauJul 28, 2020
  29. Abhishek KumarJul 30, 2020
  30. Derrick StoleeJul 28, 2020
  31. 00/10 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Aug 9, 2020
  32. 01/10 commit-graph: fix regression when computing bloom filterAbhishek Kumar via GitGitGadget, Aug 9, 2020
  33. 03/10 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Aug 9, 2020
  34. 02/10 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Aug 9, 2020
  35. 08/10 commit-graph: handle mixed generation commit chainsAbhishek Kumar via GitGitGadget, Aug 9, 2020
  36. Derrick StoleeAug 10, 2020
  37. Abhishek KumarAug 11, 2020
  38. Derrick StoleeAug 11, 2020
  39. 09/10 commit-reach: use corrected commit dates in paint_down_to_common()Abhishek Kumar via GitGitGadget, Aug 9, 2020
  40. 07/10 commit-graph: implement corrected commit dateAbhishek Kumar via GitGitGadget, Aug 9, 2020
  41. Derrick StoleeAug 10, 2020
  42. Abhishek KumarAug 14, 2020
  43. Derrick StoleeAug 14, 2020
  44. 06/10 commit-graph: return 64-bit generation numberAbhishek Kumar via GitGitGadget, Aug 9, 2020
  45. 10/10 doc: add corrected commit date infoAbhishek Kumar via GitGitGadget, Aug 9, 2020
  46. 04/10 commit-graph: consolidate compare_commits_by_genAbhishek Kumar via GitGitGadget, Aug 9, 2020
  47. 05/10 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Aug 9, 2020
  48. Derrick StoleeAug 10, 2020
  49. Abhishek KumarAug 11, 2020
  50. Derrick StoleeAug 11, 2020
  51. Taylor BlauAug 11, 2020
  52. Derrick StoleeAug 10, 2020
  53. 00/11 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Aug 15, 2020
  54. 01/11 commit-graph: fix regression when computing bloom filterAbhishek Kumar via GitGitGadget, Aug 15, 2020
  55. Jakub NarębskiAug 17, 2020
  56. 04/11 commit-graph: consolidate compare_commits_by_genAbhishek Kumar via GitGitGadget, Aug 15, 2020
  57. Derrick StoleeAug 17, 2020
  58. Jakub NarębskiAug 21, 2020
  59. 11/11 doc: add corrected commit date infoAbhishek Kumar via GitGitGadget, Aug 15, 2020
  60. Jakub NarębskiAug 22, 2020
  61. Abhishek KumarAug 27, 2020
  62. Jakub NarębskiAug 27, 2020
  63. Derrick StoleeAug 27, 2020
  64. Abhishek KumarSep 1, 2020
  65. 05/11 commit-graph: return 64-bit generation numberAbhishek Kumar via GitGitGadget, Aug 15, 2020
  66. Jakub NarębskiAug 21, 2020
  67. Abhishek KumarAug 25, 2020
  68. Jakub NarębskiAug 25, 2020
  69. Abhishek KumarSep 1, 2020
  70. Jakub NarębskiSep 3, 2020
  71. Abhishek KumarSep 5, 2020
  72. Jakub NarębskiSep 13, 2020
  73. Jakub NarębskiSep 28, 2020
  74. Abhishek KumarOct 5, 2020
  75. 10/11 commit-reach: use corrected commit dates in paint_down_to_common()Abhishek Kumar via GitGitGadget, Aug 15, 2020
  76. Jakub NarębskiAug 22, 2020
  77. Abhishek KumarSep 1, 2020
  78. Jakub NarębskiSep 3, 2020
  79. 09/11 commit-graph: use generation v2 only if entire chain doesAbhishek Kumar via GitGitGadget, Aug 15, 2020
  80. Jakub NarębskiAug 22, 2020
  81. Abhishek KumarAug 26, 2020
  82. Jakub NarębskiAug 26, 2020
  83. 08/11 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Aug 15, 2020
  84. Jakub NarębskiAug 22, 2020
  85. 06/11 commit-graph: add a slab to store topological levelsAbhishek Kumar via GitGitGadget, Aug 15, 2020
  86. Jakub NarębskiAug 21, 2020
  87. Abhishek KumarAug 25, 2020
  88. Jakub NarębskiAug 25, 2020
  89. Jakub NarębskiAug 25, 2020
  90. Abhishek KumarSep 1, 2020
  91. Jakub NarębskiSep 3, 2020
  92. 03/11 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Aug 15, 2020
  93. Jakub NarębskiAug 19, 2020
  94. Abhishek KumarAug 21, 2020
  95. Jakub NarębskiAug 25, 2020
  96. Abhishek KumarSep 1, 2020
  97. 07/11 commit-graph: implement corrected commit dateAbhishek Kumar via GitGitGadget, Aug 15, 2020
  98. Jakub NarębskiAug 22, 2020
  99. Abhishek KumarAug 25, 2020
  100. Jakub NarębskiAug 25, 2020
  101. Abhishek KumarSep 1, 2020
  102. 02/11 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Aug 15, 2020
  103. Jakub NarębskiAug 18, 2020
  104. Jakub NarębskiAug 17, 2020
  105. Abhishek KumarAug 18, 2020
  106. Jakub NarębskiAug 23, 2020
  107. Abhishek KumarAug 24, 2020
  108. 00/10 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Oct 7, 2020
  109. 02/10 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Oct 7, 2020
  110. Jakub NarębskiOct 24, 2020
  111. 01/10 commit-graph: fix regression when computing Bloom filtersAbhishek Kumar via GitGitGadget, Oct 7, 2020
  112. Jakub NarębskiOct 24, 2020
  113. Taylor BlauOct 25, 2020
  114. Abhishek KumarNov 3, 2020
  115. 03/10 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Oct 7, 2020
  116. Jakub NarębskiOct 25, 2020
  117. Abhishek KumarOct 27, 2020
  118. 05/10 commit-graph: add a slab to store topological levelsAbhishek Kumar via GitGitGadget, Oct 7, 2020
  119. Jakub NarębskiOct 25, 2020
  120. 04/10 commit-graph: return 64-bit generation numberAbhishek Kumar via GitGitGadget, Oct 7, 2020
  121. Jakub NarębskiOct 25, 2020
  122. Abhishek KumarNov 3, 2020
  123. 10/10 doc: add corrected commit date infoAbhishek Kumar via GitGitGadget, Oct 7, 2020
  124. Jakub NarębskiNov 4, 2020
  125. Abhishek KumarNov 21, 2020
  126. 09/10 commit-reach: use corrected commit dates in paint_down_to_common()Abhishek Kumar via GitGitGadget, Oct 7, 2020
  127. Jakub NarębskiNov 3, 2020
  128. Junio C HamanoNov 3, 2020
  129. Abhishek KumarNov 20, 2020
  130. 07/10 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Oct 7, 2020
  131. Jakub NarębskiOct 30, 2020
  132. Abhishek KumarNov 6, 2020
  133. Jakub NarębskiNov 6, 2020
  134. 08/10 commit-graph: use generation v2 only if entire chain doesAbhishek Kumar via GitGitGadget, Oct 7, 2020
  135. Jakub NarębskiNov 1, 2020
  136. Abhishek KumarNov 12, 2020
  137. Jakub NarębskiNov 13, 2020
  138. 06/10 commit-graph: implement corrected commit dateAbhishek Kumar via GitGitGadget, Oct 7, 2020
  139. Jakub NarębskiOct 27, 2020
  140. Abhishek KumarNov 3, 2020
  141. Jakub NarębskiNov 4, 2020
  142. Philip OakleyNov 5, 2020
  143. Junio C HamanoNov 5, 2020
  144. Extending and updating gitglossary (was: Re: [PATCH v4 06/10] commit-graph: implement corrected commit date)Jakub Narębski, Nov 6, 2020
  145. Junio C HamanoNov 6, 2020
  146. Philip OakleyNov 8, 2020
  147. Jakub NarębskiNov 10, 2020
  148. Philip OakleyNov 10, 2020
  149. Jakub NarębskiNov 10, 2020
  150. Jakub NarębskiNov 4, 2020
  151. Abhishek KumarNov 22, 2020
  152. 00/11 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Dec 28, 2020
  153. 01/11 commit-graph: fix regression when computing Bloom filtersAbhishek Kumar via GitGitGadget, Dec 28, 2020
  154. Derrick StoleeDec 30, 2020
  155. Abhishek KumarJan 8, 2021
  156. SZEDER GáborJan 5, 2021
  157. SZEDER GáborJan 5, 2021
  158. Abhishek KumarJan 8, 2021
  159. 02/11 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Dec 28, 2020
  160. 03/11 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Dec 28, 2020
  161. 04/11 t6600-test-reach: generalize *_three_modesAbhishek Kumar via GitGitGadget, Dec 28, 2020
  162. 05/11 commit-graph: add a slab to store topological levelsAbhishek Kumar via GitGitGadget, Dec 28, 2020
  163. 06/11 commit-graph: return 64-bit generation numberAbhishek Kumar via GitGitGadget, Dec 28, 2020
  164. 10/11 commit-reach: use corrected commit dates in paint_down_to_common()Abhishek Kumar via GitGitGadget, Dec 28, 2020
  165. 07/11 commit-graph: implement corrected commit dateAbhishek Kumar via GitGitGadget, Dec 28, 2020
  166. Derrick StoleeDec 30, 2020
  167. Abhishek KumarJan 10, 2021
  168. 11/11 doc: add corrected commit date infoAbhishek Kumar via GitGitGadget, Dec 28, 2020
  169. 08/11 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Dec 28, 2020
  170. 09/11 commit-graph: use generation v2 only if entire chain doesAbhishek Kumar via GitGitGadget, Dec 28, 2020
  171. Derrick StoleeDec 30, 2020
  172. Abhishek KumarJan 10, 2021
  173. Derrick StoleeJan 11, 2021
  174. Derrick StoleeDec 30, 2020
  175. Abhishek KumarJan 10, 2021
  176. 00/11 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Jan 16, 2021
  177. 02/11 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Jan 16, 2021
  178. 01/11 commit-graph: fix regression when computing Bloom filtersAbhishek Kumar via GitGitGadget, Jan 16, 2021
  179. 03/11 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Jan 16, 2021
  180. 04/11 t6600-test-reach: generalize *_three_modesAbhishek Kumar via GitGitGadget, Jan 16, 2021
  181. 07/11 commit-graph: implement corrected commit dateAbhishek Kumar via GitGitGadget, Jan 16, 2021
  182. 06/11 commit-graph: return 64-bit generation numberAbhishek Kumar via GitGitGadget, Jan 16, 2021
  183. 11/11 doc: add corrected commit date infoAbhishek Kumar via GitGitGadget, Jan 16, 2021
  184. SZEDER GáborJan 27, 2021
  185. Abhishek KumarJan 30, 2021
  186. Taylor BlauJan 31, 2021
  187. 05/11 commit-graph: add a slab to store topological levelsAbhishek Kumar via GitGitGadget, Jan 16, 2021
  188. 08/11 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Jan 16, 2021
  189. 10/11 commit-reach: use corrected commit dates in paint_down_to_common()Abhishek Kumar via GitGitGadget, Jan 16, 2021
  190. 09/11 commit-graph: use generation v2 only if entire chain doesAbhishek Kumar via GitGitGadget, Jan 16, 2021
  191. Derrick StoleeJan 18, 2021
  192. Taylor BlauJan 18, 2021
  193. Abhishek KumarJan 23, 2021
  194. Junio C HamanoJan 19, 2021
  195. Abhishek KumarJan 23, 2021
  196. 00/11 [GSoC] Implement Corrected Commit DateAbhishek Kumar via GitGitGadget, Feb 1, 2021
  197. 01/11 commit-graph: fix regression when computing Bloom filtersAbhishek Kumar via GitGitGadget, Feb 1, 2021
  198. 02/11 revision: parse parent in indegree_walk_step()Abhishek Kumar via GitGitGadget, Feb 1, 2021
  199. 03/11 commit-graph: consolidate fill_commit_graph_infoAbhishek Kumar via GitGitGadget, Feb 1, 2021
  200. 04/11 t6600-test-reach: generalize *_three_modesAbhishek Kumar via GitGitGadget, Feb 1, 2021
  201. 05/11 commit-graph: add a slab to store topological levelsAbhishek Kumar via GitGitGadget, Feb 1, 2021
  202. 06/11 commit-graph: return 64-bit generation numberAbhishek Kumar via GitGitGadget, Feb 1, 2021
  203. 08/11 commit-graph: implement corrected commit dateAbhishek Kumar via GitGitGadget, Feb 1, 2021
  204. 10/11 commit-graph: use generation v2 only if entire chain doesAbhishek Kumar via GitGitGadget, Feb 1, 2021
  205. 09/11 commit-graph: implement generation data chunkAbhishek Kumar via GitGitGadget, Feb 1, 2021
  206. 07/11 commit-graph: document generation number v2Abhishek Kumar via GitGitGadget, Feb 1, 2021
  207. 11/11 commit-reach: use corrected commit dates in paint_down_to_common()Abhishek Kumar via GitGitGadget, Feb 1, 2021
  208. Derrick StoleeFeb 1, 2021
  209. Junio C HamanoFeb 1, 2021
  210. Taylor BlauAug 17, 2020
  211. Jakub NarębskiAug 17, 2020

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.