Solved

Race conditions on event updates

  • 19 May 2021
  • 3 replies
  • 121 views

Userlevel 2
Badge

Hey,

 

To what extent does CDF handle possible race-condition triggering situations like the update of an object from two different systems?

The example we are currently considering is whether a disjoint set of metadata on objects (events) can be updated without regard to timing.

 

/Robert

icon

Best answer by Andreas Korneliussen 20 May 2021, 14:02

We handle race conditions by applying concurrent updates sequentially. For two concurrent updates A and B, the result would be the same as applying A and then B, or B and then A. You can safely push simultaneous updates, without regards to race conditions.

View original

3 replies

Userlevel 4

Hi Robert! Thanks for your question. We would need some more details on the race-condition concerns, like an example of sequence of operations with ambiguous/erroneous/tricky behavior. Would you be able to provide it? 

Userlevel 2
Badge

Hi Anita, sure let’s see about an example. To be clear, we’re in the design phase of this service. So our question is mostly “does this raise any red flags” from your engineers. 

 

We have two services, one which produces and updates events on conditions in data. And another which consumes and updates events for communication to another system. In sum, a somewhat complex data-monitoring tool.

The type of sequence of operations we’re concerned about (we’re still drawing architecture for “who” owns  what part of the monitoring process) is: 

Let the event in question, E, have the following two metadata fields:

{"communicated": "foo", "status": "bar"}

 

Let A be the monitor which produces events, and updates the field “status” in the event. 

Let B be the consumer who listens for events, and updates the field “communicated” in the event.

Can we push updates to E from both A and B simultaneously - without regard to potential race-condition problems, or the like? 

 

Thanks, 

Robert

We handle race conditions by applying concurrent updates sequentially. For two concurrent updates A and B, the result would be the same as applying A and then B, or B and then A. You can safely push simultaneous updates, without regards to race conditions.

Reply