TJ O'Donnell wrote:

> > If I have two threads modifying the same "bit" field:
> >     thread1=> update table set bf=bf | '01000'
> >     thread2=> update table set bf=bf | '10000'
> > Will this operation always be safe (e.g. result in bf='11000')?  Or
> 
> Won't this always result in bf='11xxx', depending on the
> original values of bf?

Not even.  Consider:

thread1=> update table set bf=bf | '01000'
thread3=> update table set bf=bf & '10111'
thread2=> update table set bf=bf | '10000'

Now you get bf=10xxx.

They're thread safe in that all transformations will be applied as-if serially, 
so no bit sets or unsets will be lost, but you can't guarantee that another 
client won't interfere with the results.

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to