[tpm] more problems than solutions this week
Fulko Hew
fulko.hew at gmail.com
Fri May 4 12:36:35 PDT 2012
On Fri, May 4, 2012 at 3:14 PM, Indy Singh <indy at indigostar.com> wrote:
> While we are on this topic. One issue I have encountered is that of how
> to update a 'live' file on a webserver. Lets say that we have a large file
> on a webserver 'foo.tar' and I want to replace it with a new version. If I
> SFTP upload a replacement file then I am never sure if I am going to mess
> up someone that may be half way trough downloading the file.
>
> I just verified that the inode number does not change if I upload a
> replacement file with SFTP. Would I be correct in thinking that any file
> downloads that are occurring concurrently with the upload would be
> corrupted?
>
I'd say, potentially YES.
It now becomes a race condition as to whether the write pointer
ever passes the read pointer.
(Odds are that the local reading would complete before the remote rewrite
can.
But on NFS'ed or other remoted file systems... you mileage may vary.)
Would it be safe to upload the new file as 'new.tar' then use the commands
> 'rm foo.tar' followed by 'mv new.tar foo.tar'? On the assumption that the
> rm command would only unlink the directory entry but any current file
> handles being used to download the file would continue to work. Any new
> downloads would use the new file.
Yup.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20120504/1602fd96/attachment.html>
More information about the toronto-pm
mailing list