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

Re: [PATCH v5 3/6] pack-bitmap-write: learn pack.writeBitmapLookupTable and add tests

From
Derrick Stolee <derrickstolee@github.com>
Date
Aug 12, 2022, 19:22 UTC
Message-ID
<179c0d30-ccb1-36cf-f783-814c9c8d84c2@github.com>
In-Reply-To
<CAPOJW5x0coFREUPjFbF_zzQYbfEjOrL-j-G4N7MBUN4N6uS2jw@mail.gmail.com>
On 8/12/2022 2:51 PM, Abhradeep Chakraborty wrote:
Show 8 quoted lines
> I think I have found the problem. Derrick was right that `mtime` part
> is not the culprit. I tried to understand the whole midx workflow and
> some questions were raised in my mind. I don't know whether those are
> features or bugs (because I do not have much experience in
> multi-pack-index code).
> 
> I am writing a brief description for the context of the issue and the
> questions I have.
Thanks for the detailed writeup.
Show 54 quoted lines
> Let us start from the `write_midx_internal()` function. As
> `packs_to_include` is null in our case, We can use the old midx to
> write a new midx file. The line `ctx.m =
> lookup_multi_pack_index(the_repository, object_dir)`[1]  does this. It
> also loads packs that do not belong to any multi-pack-indexes. It also
> sets `the_repository->objects->packed_git_intialized` to 1.  If we
> look at our test case (`setup partial bitmap`) the last `.pack` file
> (generated by `git repack &&` ) does not belong to any midx. So, that
> pack will be loaded in this step.
> 
> [1] https://github.com/git/git/blob/5502f77b6944eda8e26813d8f542cffe7d110aea/midx.c#L1169
> 
> Next let us move to the `if (ctx.m)`[2] block. As we will be writing a
> bitmap, `if (flags & MIDX_WRITE_REV_INDEX)` is true. Thus all packs
> related to the old midx are loaded and `ctx.info[ctx.nr].p` stores the
> pointers of these packs.
> 
> [2] https://github.com/git/git/blob/5502f77b6944eda8e26813d8f542cffe7d110aea/midx.c#L1182
> 
> After that we come to the `for_each_file_in_pack_dir(object_dir,
> add_pack_to_midx, &ctx);` line[3] . The `add_pack_to_midx`[4] function
> adds packs (that are not in the old midx) to `ctx.info`. Now I have a
> question here - Why are we using  the `add_packed_git()`[5] function
> provided we already loaded those packs in the
> `lookup_multi_pack_index` step (i.e. 1st step)? These packs are not
> added in `r->objects->packed_git`. This question is related to our
> current issue.
> 
> I.e. instead of this -
> 
>    ctx->info[ctx->nr].p = add_packed_git(full_path,
> 
> full_path_len, 0);
> 
> Why not this (or similar) -
> 
>     for (cp = the_repository->objects->packed_git; cp; cp = cp->next)
>         if (!cmp_idx_or_pack_name(cp->pack_name, full_path))
>             ctx->info[ctx->nr].p = cp;
> 
> [3] https://github.com/git/git/blob/5502f77b6944eda8e26813d8f542cffe7d110aea/midx.c#L1221
> [4] https://github.com/git/git/blob/5502f77b6944eda8e26813d8f542cffe7d110aea/midx.c#L462
> [5] https://github.com/git/git/blob/5502f77b6944eda8e26813d8f542cffe7d110aea/midx.c#L492
> 
>  `write_midx_bitmap()` function is where bitmap related code starts.
> let us directly jump into the `prepare_packed_git()` function (called
> by `get_all_packs()`[6]). As I said previously,
> `r->objects->packed_git_initialized` is already enabled so this
> function becomes a no-op function. Which means it does not load the
> newly written midx (by calling `prepare_multi_pack_index_one`
> function) and uses old midx to write the bitmap (though we still have
> new packs and they can be used with the old midx to generate the
> bitmap, maybe?) . Here comes my second question - Is this the desired
> case? or should we use the new midx to write the bitmaps?
The confusing part of all this is that the bitmaps are being written
while the "new" midx is written only to "multi-pack-index.lock" and
has not been renamed to "multi-pack-index". If we renamed first, then
the old .bitmap file would not match the new midx and all Git commands
would act as if there was no .bitmap file.
 
Show 18 quoted lines
> One important point to note is that `get_all_packs()` returns
> `r->objects->packed_git` which now stores pointers of all the packs
> and only these packfiles have their `->index` set.
> 
> [6] https://github.com/git/git/blob/5502f77b6944eda8e26813d8f542cffe7d110aea/packfile.c#L1043
> 
> Now let us move to the last function - `oe_set_in_pack()` (called by
> `prepare_midx_packing_data()`). Note that, we are passing
> `ctx->info[ctx->pack_perm[from->pack_int_id]].p` along with other
> parameters. As I have said in an earlier para (containing my first
> question), `ctx->info` has some packs (i.e. newer packs that are not
> related to the old midx) that are not installed in
> `r->objects->packed_git` . In other words, we have two instances of
> the same pack file - one in `r->objects->packed_git` list and another
> in `ctx->info[id].p`. As `prepare_in_pack_by_idx` function only sets
> `->index` for `r->objects->packed_git` packs, these packs (i.e.
> `ctx.info[id].p`) do not have their p->index set and thus end up
> calling the `oe_map_new_pack` function.

So really, the problem is that we are handling the r->objects->packed_git list instead of an array of packs that are under the control of the new midx. This assumption is baked deep in the pack-objects flow, so it would be hard to separate this idea.

Perhaps doing the reprepare_packed_git() to regenerate the list would be sufficient as a band-aid for now, but we would want to later do the big dig of focusing the pack_data struct to a specific list of pack-files (by default the set from get_all_packs(), but for midx bitmaps we can supply a specific set of packs).

Thanks, -Stolee

Previous: Abhradeep ChakrabortyNext: Abhradeep Chakraborty
Message 143 of 162 in “[GSoC] bitmap: integrate a lookup table extension to the bitmap format”
  1. 0/6 [GSoC] bitmap: integrate a lookup table extension to the bitmap formatAbhradeep Chakraborty via GitGitGadget, Jun 20, 2022
  2. 1/6 Documentation/technical: describe bitmap lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jun 20, 2022
  3. Derrick StoleeJun 20, 2022
  4. Taylor BlauJun 20, 2022
  5. Abhradeep ChakrabortyJun 21, 2022
  6. Taylor BlauJun 22, 2022
  7. Abhradeep ChakrabortyJun 21, 2022
  8. Taylor BlauJun 20, 2022
  9. Abhradeep ChakrabortyJun 21, 2022
  10. Taylor BlauJun 22, 2022
  11. Abhradeep ChakrabortyJun 22, 2022
  12. Derrick StoleeJun 20, 2022
  13. Abhradeep ChakrabortyJun 21, 2022
  14. Taylor BlauJun 22, 2022
  15. 2/6 pack-bitmap: prepare to read lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jun 20, 2022
  16. Derrick StoleeJun 20, 2022
  17. Abhradeep ChakrabortyJun 21, 2022
  18. Taylor BlauJun 20, 2022
  19. Abhradeep ChakrabortyJun 21, 2022
  20. Taylor BlauJun 22, 2022
  21. Abhradeep ChakrabortyJun 22, 2022
  22. Taylor BlauJun 22, 2022
  23. 3/6 pack-bitmap-write.c: write lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jun 20, 2022
  24. Taylor BlauJun 20, 2022
  25. Abhradeep ChakrabortyJun 21, 2022
  26. Taylor BlauJun 22, 2022
  27. 5/6 bitmap-commit-table: add tests for the bitmap lookup tableAbhradeep Chakraborty via GitGitGadget, Jun 20, 2022
  28. Taylor BlauJun 22, 2022
  29. 4/6 builtin/pack-objects.c: learn pack.writeBitmapLookupTableTaylor Blau via GitGitGadget, Jun 20, 2022
  30. Taylor BlauJun 20, 2022
  31. 6/6 bitmap-lookup-table: add performance testsAbhradeep Chakraborty via GitGitGadget, Jun 20, 2022
  32. Taylor BlauJun 22, 2022
  33. 0/6 [GSoC] bitmap: integrate a lookup table extension to the bitmap formatAbhradeep Chakraborty via GitGitGadget, Jun 26, 2022
  34. 1/6 Documentation/technical: describe bitmap lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jun 26, 2022
  35. Derrick StoleeJun 27, 2022
  36. Taylor BlauJun 27, 2022
  37. Abhradeep ChakrabortyJun 27, 2022
  38. 2/6 pack-bitmap-write.c: write lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jun 26, 2022
  39. Derrick StoleeJun 27, 2022
  40. Taylor BlauJun 27, 2022
  41. Abhradeep ChakrabortyJun 27, 2022
  42. Taylor BlauJun 27, 2022
  43. Abhradeep ChakrabortyJun 27, 2022
  44. 3/6 pack-bitmap-write: learn pack.writeBitmapLookupTable and add testsAbhradeep Chakraborty via GitGitGadget, Jun 26, 2022
  45. Derrick StoleeJun 27, 2022
  46. 3/6 pack-bitmap-write: learn pack.writeBitmapLookupTable and add testsAbhradeep Chakraborty, Jun 27, 2022
  47. Taylor BlauJun 27, 2022
  48. Taylor BlauJun 27, 2022
  49. Abhradeep ChakrabortyJun 27, 2022
  50. Taylor BlauJun 29, 2022
  51. 5/6 bitmap-lookup-table: add performance tests for lookup tableAbhradeep Chakraborty via GitGitGadget, Jun 26, 2022
  52. Taylor BlauJun 27, 2022
  53. Abhradeep ChakrabortyJun 28, 2022
  54. Taylor BlauJun 29, 2022
  55. 6/6 p5310-pack-bitmaps.sh: enable pack.writeReverseIndex for testingAbhradeep Chakraborty via GitGitGadget, Jun 26, 2022
  56. Taylor BlauJun 27, 2022
  57. Abhradeep ChakrabortyJun 28, 2022
  58. 4/6 pack-bitmap: prepare to read lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jun 26, 2022
  59. Derrick StoleeJun 27, 2022
  60. Abhradeep ChakrabortyJun 27, 2022
  61. Derrick StoleeJun 27, 2022
  62. Taylor BlauJun 27, 2022
  63. Abhradeep ChakrabortyJun 28, 2022
  64. Taylor BlauJun 29, 2022
  65. Abhradeep ChakrabortyJun 30, 2022
  66. Taylor BlauJun 27, 2022
  67. Abhradeep ChakrabortyJun 28, 2022
  68. Taylor BlauJun 29, 2022
  69. Taylor BlauJun 29, 2022
  70. Abhradeep ChakrabortyJun 30, 2022
  71. 0/6 [GSoC] bitmap: integrate a lookup table extension to the bitmap formatAbhradeep Chakraborty via GitGitGadget, Jul 4, 2022
  72. 2/6 pack-bitmap-write.c: write lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jul 4, 2022
  73. Taylor BlauJul 14, 2022
  74. Taylor BlauJul 15, 2022
  75. Abhradeep ChakrabortyJul 15, 2022
  76. Taylor BlauJul 15, 2022
  77. Abhradeep ChakrabortyJul 16, 2022
  78. Taylor BlauJul 26, 2022
  79. Martin ÅgrenJul 18, 2022
  80. 1/6 Documentation/technical: describe bitmap lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jul 4, 2022
  81. Philip OakleyJul 8, 2022
  82. Abhradeep ChakrabortyJul 9, 2022
  83. Philip OakleyJul 10, 2022
  84. Taylor BlauJul 14, 2022
  85. Philip OakleyJul 15, 2022
  86. Abhradeep ChakrabortyJul 15, 2022
  87. 3/6 pack-bitmap-write: learn pack.writeBitmapLookupTable and add testsAbhradeep Chakraborty via GitGitGadget, Jul 4, 2022
  88. 4/6 pack-bitmap: prepare to read lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jul 4, 2022
  89. Taylor BlauJul 15, 2022
  90. Abhradeep ChakrabortyJul 15, 2022
  91. Taylor BlauJul 15, 2022
  92. Martin ÅgrenJul 18, 2022
  93. Abhradeep ChakrabortyJul 18, 2022
  94. Martin ÅgrenJul 18, 2022
  95. Taylor BlauJul 26, 2022
  96. 5/6 bitmap-lookup-table: add performance tests for lookup tableAbhradeep Chakraborty via GitGitGadget, Jul 4, 2022
  97. Taylor BlauJul 15, 2022
  98. Abhradeep ChakrabortyJul 15, 2022
  99. 6/6 p5310-pack-bitmaps.sh: remove pack.writeReverseIndexAbhradeep Chakraborty via GitGitGadget, Jul 4, 2022
  100. Abhradeep ChakrabortyJul 4, 2022
  101. Junio C HamanoJul 6, 2022
  102. Abhradeep ChakrabortyJul 7, 2022
  103. Kaartic SivaraamJul 7, 2022
  104. Abhradeep ChakrabortyJul 7, 2022
  105. 0/6 [GSoC] bitmap: integrate a lookup table extension to the bitmap formatAbhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  106. 1/6 Documentation/technical: describe bitmap lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  107. 2/6 pack-bitmap-write.c: write lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  108. 4/6 pack-bitmap: prepare to read lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  109. 5/6 p5310-pack-bitmaps.sh: enable `pack.writeReverseIndex`Abhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  110. 3/6 pack-bitmap-write: learn pack.writeBitmapLookupTable and add testsAbhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  111. 6/6 bitmap-lookup-table: add performance tests for lookup tableAbhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  112. 0/6 [GSoC] bitmap: integrate a lookup table extension to the bitmap formatAbhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  113. 1/6 Documentation/technical: describe bitmap lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  114. 2/6 pack-bitmap-write.c: write lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  115. Taylor BlauJul 26, 2022
  116. Abhradeep ChakrabortyJul 26, 2022
  117. 4/6 pack-bitmap: prepare to read lookup table extensionAbhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  118. Taylor BlauJul 26, 2022
  119. Abhradeep ChakrabortyJul 26, 2022
  120. Eric SunshineJul 26, 2022
  121. 5/6 p5310-pack-bitmaps.sh: enable `pack.writeReverseIndex`Abhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  122. Taylor BlauJul 26, 2022
  123. Ævar Arnfjörð BjarmasonJul 26, 2022
  124. Derrick StoleeJul 26, 2022
  125. Ævar Arnfjörð BjarmasonJul 26, 2022
  126. Abhradeep ChakrabortyJul 26, 2022
  127. 6/6 bitmap-lookup-table: add performance tests for lookup tableAbhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  128. 3/6 pack-bitmap-write: learn pack.writeBitmapLookupTable and add testsAbhradeep Chakraborty via GitGitGadget, Jul 20, 2022
  129. Johannes SchindelinJul 28, 2022
  130. Abhradeep ChakrabortyAug 2, 2022
  131. Johannes SchindelinAug 2, 2022
  132. Abhradeep ChakrabortyAug 2, 2022
  133. Johannes SchindelinAug 8, 2022
  134. Abhradeep ChakrabortyAug 8, 2022
  135. Johannes SchindelinAug 9, 2022
  136. Abhradeep ChakrabortyAug 9, 2022
  137. Abhradeep ChakrabortyAug 9, 2022
  138. Johannes SchindelinAug 10, 2022
  139. Johannes SchindelinAug 10, 2022
  140. Abhradeep ChakrabortyAug 10, 2022
  141. Derrick StoleeAug 10, 2022
  142. Abhradeep ChakrabortyAug 12, 2022
  143. Derrick StoleeAug 12, 2022
  144. Abhradeep ChakrabortyAug 13, 2022
  145. Taylor BlauAug 16, 2022
  146. Abhradeep ChakrabortyAug 17, 2022
  147. Taylor BlauAug 17, 2022
  148. Taylor BlauAug 19, 2022
  149. Abhradeep ChakrabortyAug 13, 2022
  150. Taylor BlauAug 16, 2022
  151. 0/6 [GSoC] bitmap: integrate a lookup table extension to the bitmap formatAbhradeep Chakraborty via GitGitGadget, Aug 14, 2022
  152. 2/6 bitmap: move `get commit positions` code to `bitmap_writer_finish`Abhradeep Chakraborty via GitGitGadget, Aug 14, 2022
  153. 1/6 Documentation/technical: describe bitmap lookup table extensionAbhradeep Chakraborty via GitGitGadget, Aug 14, 2022
  154. 3/6 pack-bitmap-write.c: write lookup table extensionAbhradeep Chakraborty via GitGitGadget, Aug 14, 2022
  155. 5/6 pack-bitmap: prepare to read lookup table extensionAbhradeep Chakraborty via GitGitGadget, Aug 14, 2022
  156. 4/6 pack-bitmap-write: learn pack.writeBitmapLookupTable and add testsAbhradeep Chakraborty via GitGitGadget, Aug 14, 2022
  157. 6/6 bitmap-lookup-table: add performance tests for lookup tableAbhradeep Chakraborty via GitGitGadget, Aug 14, 2022
  158. Junio C HamanoAug 19, 2022
  159. Johannes SchindelinAug 22, 2022
  160. Taylor BlauAug 22, 2022
  161. Taylor BlauAug 25, 2022
  162. Junio C HamanoAug 26, 2022

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.