We see a strange issue sometimes when we call boost::filesystem::copy()
to copy a file from a normal local partition to one hosted on Lustre. Normally if we do cp
of files we notice that the destination file exists correctly and is available immediately after cp
returns, however with the boost operation, when it returns, the file may be all there or not (at the destination.)
Looking through the boost code, I see:
if ( ::close( infile) < 0 ) sz_read = -1;
if ( ::close( outfile) < 0 ) sz_read = -1;
I'm wondering if this is correct, will this correctly flush the file to the destination, or should this call ::fclose()
to explicitly flush and then close the file? I don't see any explicit ::fflush()
calls preceding the close, so not sure if the file really is flushed to the destination correctly...