in reply to Re^2: Trying to optimize reading/writing of large text files.
in thread Trying to optimize reading/writing of large text files.
The basic issue here is: how make updates to this shared file "atomic" - meaning works or doesn't work and no partial updates allowed.
Instead of "locking" the LOG file, if you want to essentially delete that file and replace it with another file. You need a lock on something else for coordination because the lock on the LOG file will disappear when you delete it (and I think you need to do that in order to replace it with the TEMP file via rename). No lock on the TEMP file is needed because there will only be one temp file at a time. And a "read lock" on the LOG file does no good. We need to gain exclusive access to this critter and then update it.
I've tried hard to explain this. Let me know what isn't clear. And of course, its always possible that I've made some error. So please let us know how this works out!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Trying to optimize reading/writing of large text files.
by Anonymous Monk on Jan 23, 2012 at 03:27 UTC | |
by nikkimouse (Initiate) on Jan 23, 2012 at 03:45 UTC | |
by Marshall (Canon) on Jan 23, 2012 at 06:48 UTC | |
by nikkimouse (Initiate) on Jan 25, 2012 at 05:38 UTC | |
by Marshall (Canon) on Jan 25, 2012 at 07:04 UTC |