fast-import: Stream very large blobs directly to pack
PATCH v3 1/1 fast-import: Stream very large blobs directly to pack
If a blob is larger than the configured big-file-threshold, instead of reading it into a single buffer obtained from malloc, stream it onto the end of the current pack file. Streaming the larger objects into the pack avoids the 4+ GiB memory footprint that occurs when fast-import is processing 2+ GiB blobs.
Signed-off-by Shawn O. Pearce <[email protected]>
Signed-off-by Junio C Hamano <[email protected]>
---
Changed --big-file-threshold option to be in bytes. Squashed the documentation patch from earlier today.
Documentation/config.txt | 14 +++ Documentation/git-fast-import.txt | 6 ++ fast-import.c | 179 +++++++++++++++++++++++++++++++++---- t/t5705-clone-2gb.sh | 2 +- t/t9300-fast-import.sh | 46 ++++++++++ 5 files changed, 227 insertions(+), 20 deletions(-)
Documentation/config.txt +14 -0
@@ -409,6 +409,20 @@ You probably do not need to adjust this value. + Common unit suffixes of 'k', 'm', or 'g' are supported. +core.bigFileThreshold:: + Files larger than this size are stored deflated, without + attempting delta compression. Storing large files without + delta compression avoids excessive memory usage, at the + slight expense of increased disk usage. ++ +Default is 512 MiB on all platforms. This should be reasonable +for most projects as source code and other text files can still +be delta compressed, but larger binary media files won't be. ++ +Common unit suffixes of 'k', 'm', or 'g' are supported. ++ +Currently only linkgit:git-fast-import[1] honors this setting. + core.excludesfile:: In addition to '.gitignore' (per-directory) and '.git/info/exclude', git looks into this file for patterns
Documentation/git-fast-import.txt +6 -0
@@ -50,6 +50,12 @@ OPTIONS importers may wish to lower this, such as to ensure the resulting packfiles fit on CDs. +--big-file-threshold=<n>:: + Maximum size of a blob that fast-import will attempt to + create a delta for, expressed in bytes. The default is 512m + (512 MiB). Some importers may wish to lower this on systems + with constrained memory. + --depth=<n>:: Maximum delta depth, for blob and tree deltification. Default is 10.
fast-import.c +160 -19
277 lines not on this page · raw message
t/t5705-clone-2gb.sh +1 -1
@@ -31,7 +31,7 @@ test_expect_success 'setup' ' echo "data 5" && echo ">2gb" && cat commit) | - git fast-import && + git fast-import --big-file-threshold=2 && test ! -f exit-status '
t/t9300-fast-import.sh +46 -0
50 lines not on this page · raw message
Signature · 4 lines
1.7.0.rc0.170.g7207c -- Shawn.