Comment 1 for bug 1389784

Revision history for this message
Prashanth Vasudev (vasudev-prashanth) wrote :

After the temp file is created, its initial size is zero bytes. This temp file needs to be fully allocated before it is mmap’ed.

We resize the file by doing a lseek to the end of file followed by a write of one character to file. However write() does not flush this write to disk and also does not force allocation of all the blocks.

1. So instead of lseek and write, we now use posix_fallocate() . Performance is not a concern here since we are in overflow mode, also this happens only once for every new file. Any disk space issues is detected and would return ENOSPC (linux 28) error.

2. Added a try catch block around memcpy, incase of any other errors.