News for hackers. Stuff that matters.
Re:Appending to a file from multiple processes by kbenson on Wednesday August 03, 2016 @05:15PM (#12221591)
Presumably you would have some protocol to passing the messages that handles this, such as at the simplest level wrapping the the message with a preceding length and following end of record identifier, which in conjunction should work.

But that's the (implicit) point of all this, now you've added a bunch of logic for an accumulating writer, a protocol to pass messages between the processes, and state so that partially received messages can be continued when you get back to that process. Now the application has a non-trivial amount of logic and code to deal with logging which might be a source of problems itself. As another commenter noted, individual files per process with an aggregation step (or specialized reader) is much simpler and easier to reason about and mirrors actual case in the article where it was eventually inserted into SQLite, which essentially enforces this read ordering as needed (if there is an ordering field).

There are no comments on this comment yet.