3 ms·
I can think of a cool case for this. What if you have an append-only system which is making remote backups. One service is writing the activity log append onl
by cjhanks 7y ago
I can think of a cool case for this.
What if you have an append-only system which is making remote backups. One service is writing the activity log append only, a second service is reading that, check-pointing, and then truncating the head of the file when the check-point has been committed. No need to do the tricky file-swap trickery.
- firethief 7y agoJournaling filesystems do that internally.
- dmitrygr 7y agoCuriously enough. PalmOS's file streams supported this very feature: delete as i read. As you read bytes from the start of the file, they'd be deleted. You were allowed to have a concurrent writer appending to the end.
- userbinator 7y agoAs you read bytes from the start of the file, they'd be deleted. You were allowed to have a concurrent writer appending to the end. Also known as a named pipe.
- minaguib 7y agoLinux and fallocate() allows precisely this - we use this to "log locally" for applications, and a "tail this asap and publish to kafka then delete locally" helper. See ( https://gist.github.com/minaguib/1cbe29922b06d50755a2f580b8c343fa https://gist.github.com/minaguib/1cbe29922b06d50755a2f580b8c... ) for some test notes I took a couple of years ago.
- gmueckl 7y agofallocate() is not supported on network file systems, is it?