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

Re: [PATCH 1/3] Lazily open pack index files on demand

From
Shawn O. Pearce <spearce@spearce.org>
Date
May 27, 2007, 03:34 UTC
Message-ID
<20070527033429.GY28023@spearce.org>
In-Reply-To
<56b7f5510705261031o311b89bapd730374cbc063931@mail.gmail.com>
Dana How <danahow@gmail.com> wrote:
> Shawn:  When I first saw the index-loading code,  my first
> thought was that all the index tables should be
> merged (easy since sorted) so callers only need to do one search.

Yes; in fact this has been raised on the list before. The general idea was to create some sort of "super index" that had a list of all objects and which packfile they could be found in. This way the running process doesn't have to search multiple indexes, and the process doesn't have to be responsible for the merging itself.

See the thing is, if you read all of every .idx file on a simple `git-log` operation you've already lost. The number of trees and blobs tends to far outweigh the number of commits and they really outweigh the number of commits the average user looks at in a `git-log` session before they abort their pager. So sorting all of the available .idx files before we produce even the first commit is a horrible thing to do.

But the problem with a super index is repacking. Every time the user repacks their recent loose objects (or recently fetched packs) we are folding some packfiles together, but may be leaving others alone. The super index would need to account for the packfiles we aren't looking at or repacking. It gets complicated fast.

There's also the problem of alternate ODBs; do we fold the indexes of our alternates into our own super index? Or does each ODB get its own super index and we still have to load multiple super index files?

In pack v4 we're likely to move the SHA-1 table from the .idx file into the front of the .pack file. This makes the .idx file hold only the offsets and the CRC checkums of each object. If we start making a super index, we have to duplicate the SHA-1 table twice (once in the .pack, again in the super index).

-- 
Shawn.
Previous: Nicolas PitreNext: Dana How
Message 8 of 22 in “Lazily open pack index files on demand”
  1. 1/3 Lazily open pack index files on demandShawn O. Pearce, May 26, 2007
  2. Junio C HamanoMay 26, 2007
  3. Shawn O. PearceMay 26, 2007
  4. Dana HowMay 26, 2007
  5. Nicolas PitreMay 27, 2007
  6. Dana HowMay 27, 2007
  7. Nicolas PitreMay 27, 2007
  8. Shawn O. PearceMay 27, 2007
  9. Dana HowMay 27, 2007
  10. Nicolas PitreMay 27, 2007
  11. Shawn O. PearceMay 27, 2007
  12. Dana HowMay 28, 2007
  13. A Large Angry SCMMay 28, 2007
  14. Nicolas PitreMay 28, 2007
  15. Nicolas PitreMay 28, 2007
  16. Nicolas PitreMay 27, 2007
  17. Dana HowMay 27, 2007
  18. Shawn O. PearceMay 27, 2007
  19. Nicolas PitreMay 27, 2007
  20. Linus TorvaldsMay 28, 2007
  21. Nicolas PitreMay 28, 2007
  22. Karl HasselströmMay 28, 2007

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.