Lets say these are two nodes in the real time database:
node_1
|
|-------id_1
-name:....
|-------id_2
-name:....
|-------id_3
-name:....
node_2
|
|-------id_1
-name:....
|-------id_2
-name:....
|-------id_3
-name:....
If multiple users at the same time did an updateChildren()
atomic write at node_1
and node_2
, then how are these calls handled:
In parallel (all at the same time are handled)?
Or like a queue (One after the other)?
ex) user 1 write is handled, then user 2, then user 3 , ...............
I want to understand this to know how to secure nodes.
Thanks.
CodePudding user response:
Non-transactional writes are processed in the order they are received. The last one to execute will overwrite anything else that might have happened before it at the same location. The fact that you're doing a multi-location update does not change this behavior.
If you are concerned about clients overwriting each other, then you will either need to use a transaction at a single location at a time so that each client can see the current state of the data being written, or you can ensure that they are each writing to different locations (e.g. with a "push" operation that generates an new location).