Re: Our "fallback" atomics implementation doesn't actually work

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Our "fallback" atomics implementation doesn't actually work
Date: 2016-10-06 04:06:33
Message-ID: 25314.1475726793@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> Hm. After a long battle of head vs. wall I think I see what the problem
> is. For the fallback atomics implementation I somehow had assumed that
> pg_atomic_write_u32() doesn't need to lock, as it's just an unlocked
> write. But that's not true, because it has to cause
> pg_atomic_compare_exchange_u32 to fail.

Hah ... obvious once you see it.

> For me the problem often takes a lot longer to reproduce (once only
> after 40min), could you run with the attached patch, and see whether
> that fixes things for you?

For me, with the described test case, HEAD fails within a minute,
two times out of three or so. I've not reproduced it after half an
hour of beating on this patch. Looks good.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2016-10-06 04:41:04 Re: Transactions involving multiple postgres foreign servers
Previous Message Serge Rielau 2016-10-06 03:43:39 Re: Fast AT ADD COLUMN with DEFAULTs