3 ms·
Thanks for providing some insight in how WhatsApp did this with Erlang! Is all of the logic to support runtime upgrading inside Erlang/OTP, or does the softwar
by roeles 4y ago
Thanks for providing some insight in how WhatsApp did this with Erlang!
Is all of the logic to support runtime upgrading inside Erlang/OTP, or does the software you write have to be written (partly) in mind with runtime upgrades as well?
Also, thanks for the hint regarding cp/install. I figured that the kernel would recognize an open descriptor to the old file and keep that old copy until all references are gone.
- toast0 4y agoOTP has some structures to help with upgrading that we didn't use. Mostly, you have to keep upgrading in mind when you make changes. Easy ones are things like if you add another field into a record (like a struct) that you're using for process state, you need to still handle the old version of the record, since it will be loaded into processes with old state. This is similar to what you need to do with APIs (local library or remote calls to other computers), but it's a little unusual to consider it in a running process. For cp/install; cp will generally write over the existing file, but install unlinks and then writes a new file. If you've mmaped the file, you get changes in your process from cp (copy on write doesn't apply to mmap), but not with install (the old file is kept around until it's no longer referenced).