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

Re: [GSoC][RFC] Proposal: Make pack access code thread-safe

From
Matheus Tavares Bernardino <matheus.bernardino@usp.br>
Date
Apr 8, 2019, 15:58 UTC
Message-ID
<CAHd-oW6Cmn4TsR9GfwD0H8niwh-cyaXU-V8GK70j6bLT94_VkQ@mail.gmail.com>
In-Reply-To
<CACsJy8AWHfcx=aLChWB_pN9dsVEj0Kq31zHmVnN1iVjXxyZVLg@mail.gmail.com>
On Mon, Apr 8, 2019 at 12:32 AM Duy Nguyen <pclouds@gmail.com> wrote:
Show 41 quoted lines
>
> On Mon, Apr 8, 2019 at 8:23 AM Duy Nguyen <pclouds@gmail.com> wrote:
> >
> > On Mon, Apr 8, 2019 at 5:52 AM Christian Couder
> > <christian.couder@gmail.com> wrote:
> > > > Git has a very optimized mechanism to compactly store
> > > > objects (blobs, trees, commits, etc.) in packfiles[2]. These files are
> > > > created by[3]:
> > > >
> > > > 1. listing objects;
> > > > 2. sorting the list with some good heuristics;
> > > > 3. traversing the list with a sliding window to find similar objects in
> > > > the window, in order to do delta decomposing;
> > > > 4. compress the objects with zlib and write them to the packfile.
> > > >
> > > > What we are calling pack access code in this document, is the set of
> > > > functions responsible for retrieving the objects stored at the
> > > > packfiles. This process consists, roughly speaking, in three parts:
> > > >
> > > > 1. Locate and read the blob from packfile, using the index file;
> > > > 2. If the blob is a delta, locate and read the base object to apply the
> > > > delta on top of it;
> > > > 3. Once the full content is read, decompress it (using zlib inflate).
> > > >
> > > > Note: There is a delta cache for the second step so that if another
> > > > delta depends on the same base object, it is already in memory. This
> > > > cache is global; also, the sliding windows, are global per packfile.
> > >
> > > Yeah, but the sliding windows are used only when creating pack files,
> > > not when reading them, right?
> >
> > These windows are actually for reading. We used to just mmap the whole
> > pack file in the early days but that was impossible for 4+ GB packs on
> > 32-bit platforms, which was one of the reasons, I think, that sliding
> > windows were added, to map just the parts we want to read.
>
> To clarify (I think I see why you mentioned pack creation now), there
> are actually two window concepts. core.packedGitWindowSize is about
> reading pack files. pack.window is for generating pack files. The
> second window should already be thread-safe since we do all the
> heuristics to find best base object candidates in threads.

I was indeed confusing this two concepts, thanks for clarifying it! I took a quick look around the usage of core.packedGitWindowSize arround the code (at packfile.c) and it seems to be already thread-safe (I may be wrong thought).

> --
> Duy
Previous: Matheus Tavares BernardinoNext: Philip Oakley
Message 7 of 13 in “[GSoC][RFC] Proposal: Make pack access code thread-safe”
  1. Matheus Tavares BernardinoApr 7, 2019
  2. Christian CouderApr 7, 2019
  3. Duy NguyenApr 8, 2019
  4. Duy NguyenApr 8, 2019
  5. Christian CouderApr 8, 2019
  6. Matheus Tavares BernardinoApr 8, 2019
  7. Matheus Tavares BernardinoApr 8, 2019
  8. Philip OakleyApr 8, 2019
  9. Matheus Tavares BernardinoApr 8, 2019
  10. Philip OakleyApr 8, 2019
  11. Matheus Tavares BernardinoApr 8, 2019
  12. Torsten BögershausenApr 9, 2019
  13. Matheus Tavares BernardinoApr 8, 2019

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.