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

Re: [PATCH] fast-import: Stream very large blobs directly to pack

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 29, 2010, 15:22 UTC
Message-ID
<20100129152254.GC21821@spearce.org>
In-Reply-To
<7vockdjx6w.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
Show 8 quoted lines
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> 
> > +static void stream_blob(
> > +	uintmax_t len,
> > +	unsigned char *sha1out,
> > +	uintmax_t mark)
> 
> A funny way to indent and line wrap...
Consistent with something else in the same file that has a similar
task... store_object().  I literally just copied the lines from
there and pasted here.
 
Show 6 quoted lines
> > +	/* Determine if we should auto-checkpoint. */
> > +	if ((pack_size + 60 + len) > max_packsize
> > +		|| (pack_size + 60 + len) < pack_size)
> > +		cycle_packfile();
> 
> What's "60" in this math?

IIRC 60 is 20 bytes for the SHA-1 footer, and another 40 padding for the object header, and the deflate() wrapping.

Again, the 60 was stolen from the existing store_object(), which
already has the same assumption.  Only there I think we have len as
the fully compressed version, so the deflate() wrapping is already
being accounted for.
 
> If the data is not compressible, we could even grow and the end result
> might be more than (pack_size + len), busting max_packsize.

Yea, that's a good point. I probably should run the length through deflateBound() and use that here in the test. But I didn't think it would make a huge difference. If the file isn't compressible what is the real increment over the uncompressed size? There's a header and footer, and instructions in the stream to indicate literal data, but its not like its doubling in size.

Show 5 quoted lines
> As we are
> streaming out, we cannot say "oops, let me try again after truncating and
> closing the current file and then opening a new file", and instead may
> have to copy the data from the current one to a new one, and truncate the
> current one.  Is this something worth worrying about?

Hmm. I'm not that worried about it, but then there's the case of a blob that is larger than the max pack size. We can't store that, period. Should we try to exceed max pack size for that one object? Or should we refuse?

The major reason for this test is to ensure an object offset starts before the 4 GiB boundary so idx v1 can hold the offset. A much less important reason is to try to support older 32 bit filesystems which can't do more than 2 GiB per file.

-- 
Shawn.
Previous: Junio C HamanoNext: Shawn O. Pearce
Message 5 of 27 in “fast-import: Stream very large blobs directly to pack”
  1. fast-import: Stream very large blobs directly to packShawn O. Pearce, Jan 29, 2010
  2. Nicolas PitreJan 29, 2010
  3. Shawn O. PearceJan 29, 2010
  4. Junio C HamanoJan 29, 2010
  5. Shawn O. PearceJan 29, 2010
  6. fast-import: Stream very large blobs directly to packShawn O. Pearce, Jan 29, 2010
  7. Jakub NarebskiJan 29, 2010
  8. Shawn O. PearceJan 29, 2010
  9. A Large Angry SCMJan 29, 2010
  10. Junio C HamanoJan 30, 2010
  11. Sverre RabbelierJan 29, 2010
  12. Shawn O. PearceJan 29, 2010
  13. Sverre RabbelierJan 29, 2010
  14. Shawn O. PearceJan 29, 2010
  15. Junio C HamanoJan 30, 2010
  16. Junio C HamanoJan 30, 2010
  17. Junio C HamanoJan 30, 2010
  18. Shawn O. PearceFeb 1, 2010
  19. Junio C HamanoFeb 1, 2010
  20. Junio C HamanoFeb 4, 2010
  21. Shawn O. PearceFeb 4, 2010
  22. Junio C HamanoFeb 4, 2010
  23. Junio C HamanoFeb 4, 2010
  24. Shawn O. PearceFeb 4, 2010
  25. Nicolas PitreFeb 4, 2010
  26. fast-import: Document the core.bigFileThreshold configuration settingShawn O. Pearce, Feb 1, 2010
  27. Shawn O. PearceFeb 1, 2010

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.