How does &synchronized work with records? E.g., in the below code, is the
effect of two cluster nodes simultaneously running ++foos[0]$foo similar to
simultaneously running ++bars[0]? Or would there be a conflict causing
foos[0]$foo to only be incremented once?
type Foo: record {
foo: count &default=0;
}
global foos: table[count] of Foo &default=[] &synchronized;
global bars: table[count] of count &default=0 &synchronized;
Also, does a "X += N" instruction propagate to all nodes as "increment by
N" or as "set to X+N?"
effect of two cluster nodes simultaneously running ++foos[0]$foo similar to
simultaneously running ++bars[0]?
Yes, it's similar. The operation is propated for the specific record
instance being modified, along with the record field where it applies
to.
Also, does a "X += N" instruction propagate to all nodes as "increment by
N" or as "set to X+N?"
The former, it's an actual increment operation. If multiple increments
are sent, nodes may diverge briefly while not everybody has seen all
updates yet, but eventually they'll all arrive at the same value.