[erlang-questions] Optimal way to restrict a ram_copies table to N entries

Thomas Lindgren thomasl_erlang@REDACTED
Fri Jun 29 10:17:55 CEST 2007


--- t ty <tty.erlang@REDACTED> wrote:

> The pid/ref becomes (hopefully) invalid. if you send
> message to it the
> behaviour is undefined, meaning it could refers to a
> valid live
> process and hopefully it doesn't react to the
> message.
> 
> Instead of storing a pid, store the process state.
> That way you can
> restart a process and bring it back to the 'current'
> state before the
> node went down.

As you say there are workarounds, and I don't
recommend doing it, but one can still ask what might
happen. As far as I know, Erlang the language doesn't
require or guarantee eternal uniqueness, even if it
might be intended. I haven't checked how Erlang/OTP
the implementation implements pids or refs.

A straightforward implementation, say, an internal
counter initialized at node startup, could generate
duplicates, either easily (start from zero) or
occasionally (start at random number).

(As an aside, I suppose essentially the same problem
could arise from sending data from node A to node B,
then rebooting A, then sending the data back to A
after a while. In both cases, the data escape the
system that created them. Can A then distinguish old
from new 'unique' data?)

And to conclude: this might already be handled in
Erlang/OTP, but there definitely are some concrete
pitfalls.

Best,
Thomas



       
____________________________________________________________________________________
Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.
http://autos.yahoo.com/carfinder/



More information about the erlang-questions mailing list