global lock

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

global lock

Roberto Ostinelli-5
All,
In my cluster some nodes can generate events when a consistency issue is detected. When this happens, I'd like one node (and only one) to resolve this conflict.

global:trans/4 allows to set the number of retries, so one approach could be to set retries to 0 so *if* my understanding is correct, only 1 node would do the conflict resolution (the one that grabs the lock). If some kind soul can confirm that this is correct, thank you in advance. :)

Otherwise, what other options do I have? For example, can I set a flag somehow so that the nodes that run the code in the global:trans know that this has already been done by another node?

Thank you,
r.
Reply | Threaded
Open this post in threaded view
|

Re: global lock

Paul Peregud-2
> global:trans/4 allows to set the number of retries, so one approach could be to set retries to 0 so *if* my understanding is correct, only 1 node would do the conflict resolution (the one that grabs the lock). If some kind soul can confirm that this is correct, thank you in advance. :)

That's not enough. Alice may detect the issue, grab the lock, resolve
the issue and release the lock before Bob receives the signal and
attempts to grab the lock. You need some kind of ConflictId ->
resolved :: boolean() mapping.
Reply | Threaded
Open this post in threaded view
|

Re: global lock

Roberto Ostinelli-5
Ok, so indeed the flag I was referring to seems to be a necessity.
Thank you,
r.

On Mon, Nov 25, 2019 at 5:21 PM Paul Peregud <[hidden email]> wrote:
> global:trans/4 allows to set the number of retries, so one approach could be to set retries to 0 so *if* my understanding is correct, only 1 node would do the conflict resolution (the one that grabs the lock). If some kind soul can confirm that this is correct, thank you in advance. :)

That's not enough. Alice may detect the issue, grab the lock, resolve
the issue and release the lock before Bob receives the signal and
attempts to grab the lock. You need some kind of ConflictId ->
resolved :: boolean() mapping.