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

Re: Problem with large files on different OSes

From
Nicolas Pitre <nico@cam.org>
Date
May 27, 2009, 17:37 UTC
Message-ID
<alpine.LFD.2.00.0905271312220.3906@xanadu.home>
In-Reply-To
<alpine.LFD.2.01.0905270942580.3435@localhost.localdomain>
On Wed, 27 May 2009, Linus Torvalds wrote:
Show 32 quoted lines
> Hmm. No. Looking at it some more, we could add some nasty code to do 
> _some_ things chunked (like adding a new file as a single object), but it 
> doesn't really help. For any kind of useful thing, we'd need to handle the 
> "read from pack" case in multiple chunks too, and that gets really nasty 
> really quickly.
> 
> The whole "each object as one allocation" design is pretty core, and it 
> looks pointless to have a few special cases, when any actual relevant use 
> would need a whole lot more than the few simple ones.
> 
> Git really doesn't like big individual objects.
> 
> I've occasionally thought about handling big files as multiple big 
> objects: we'd split them into a "pseudo-directory" (it would have some new 
> object ID), and then treat them as a magical special kind of directory 
> that just happens to be represented as one large file on the filesystem.
> 
> That would mean that if you have a huge file, git internally would never 
> think of it as one big file, but as a collection of many smaller objects. 
> By just making the point where you break up files be a consistent rule 
> ("always break into 256MB pieces"), it would be a well-behaved design (ie 
> things like behaviour convergence wrt the same big file being created 
> different ways).
> 
> HOWEVER.
> 
> While that would fit in the git design (ie it would be just a fairly 
> straightforward extension - another level of indirection, kind of the way 
> we added subprojects), it would still be a rewrite of some core stuff. The 
> actual number of lines might not be too horrid, but quite frankly, I 
> wouldn't want to do it personally. It would be a lot of work with lots of 
> careful special case handling - and no real upside for normal use.
My idea for handling big files is simply to:
 1) Define a new parameter to determine what is considered a big file.
 2) Store any file larger than the treshold defined in (1) directly into 
    a pack of their own at "git add" time.
 3) Never attempt to diff nor delta large objects, again according to 
    (1) above.  It is typical for large files not to be deltifiable, and 
    a diff for files in the thousands of megabytes cannot possibly be 
    sane.

The idea is to avoid ever needing to load such object's content entirely in memory. So with the data already in a pack, the pack data reuse logic (which already does its copy in chunks) could be triggered during a repack/fetch/push.

This is also quite trivial to implement with very few special cases, and then git would handle huge repositories with lots of huge files just as well as any other SCMs. The usual git repository compactness won't be there of course, but I doubt people dealing with repositories in the hundreds of gigabytes really care.

Nicolas
Previous: Jakub NarebskiNext: Jeff King
Message 15 of 31 in “Problem with large files on different OSes”
  1. Christopher JeffersonMay 27, 2009
  2. Andreas EricssonMay 27, 2009
  3. Christopher JeffersonMay 27, 2009
  4. John TapsellMay 27, 2009
  5. Christopher JeffersonMay 27, 2009
  6. John TapsellMay 27, 2009
  7. Tomas CarneckyMay 27, 2009
  8. Christopher JeffersonMay 27, 2009
  9. Andreas EricssonMay 27, 2009
  10. Jakub NarebskiMay 27, 2009
  11. Linus TorvaldsMay 27, 2009
  12. Linus TorvaldsMay 27, 2009
  13. Christopher JeffersonMay 27, 2009
  14. Jakub NarebskiMay 27, 2009
  15. Nicolas PitreMay 27, 2009
  16. Jeff KingMay 27, 2009
  17. Linus TorvaldsMay 27, 2009
  18. Alan Manuel GloriaMay 27, 2009
  19. Linus TorvaldsMay 28, 2009
  20. Nicolas PitreMay 28, 2009
  21. Eric RaibleMay 28, 2009
  22. Shawn O. PearceMay 28, 2009
  23. Eric RaibleMay 28, 2009
  24. Andreas EricssonMay 28, 2009
  25. Nicolas PitreMay 28, 2009
  26. Jeff KingMay 28, 2009
  27. Linus TorvaldsMay 28, 2009
  28. Nicolas PitreMay 27, 2009
  29. Jeff KingMay 28, 2009
  30. Nicolas PitreMay 28, 2009
  31. Jeff KingMay 28, 2009

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.