HomePhabricator

[Fix] stream_copy_to_stream

Description

[Fix] stream_copy_to_stream

Summary:
f_stream_copy_to_stream uses f_stream_get_contents to read the entire source
file into a String and then write to the destination file. When the file is
large (> 512MB), this will not work because String length limit is about
512MB. I made a change so that for regular files, we do chunk-based copy
so the limit can be up to 2GB-1.

Task ID: # 499946

Blame Rev:

Reviewers:
qixin, hzhao
CC:
hphp-diffs@lists.facebook.com
Test Plan:
make fast_tests
test/test TestCodeRun TestFile
[myang@dev1560] ls -ltr /tmp/readfrom
-rwxr-xr-x 1 myang users 1390253384 Feb 24 16:01 /tmp/readfrom
[myang@dev1560] php test.php
res is 1390253384
[myang@dev1560] ../hphpi/hphpi test.php
res is 1390253384
[myang@dev1560] diff -q /tmp/readfrom /tmp/writeto
[myang@dev1560]

Revert Plan:

Tags:

  • begin *PUBLIC* platform impact section -

Bugzilla: #

  • end platform impact -

DiffCamp Revision: 216603

Details

Provenance
myangAuthored on
macvicarCommitted on Feb 28 2011, 7:07 PM
Parents
rOSHDf646ec44e51a: Run user defined function to print results in hphpd
Branches
Unknown
Tags
Unknown
ChangeId
None

Event Timeline

macvicar <scott@fb.com> committed rOSHDfd2d49bc79da: [Fix] stream_copy_to_stream (authored by myang <myang@fb.com>).Feb 28 2011, 7:07 PM