Re: Bring atomic flag fallback up to snuff

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Re: Bring atomic flag fallback up to snuff
Date: 2018-04-07 12:57:53
Message-ID: CABUevEyW_=vbBS3gZ6F09Tj=sNoqkibH-kNyjd8zPZLHEsCimQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This is the same one you already committed right? Not a further one on top
of that?

That said,+1 for not bothering to back patch it.

/Magnus

On Sat, Apr 7, 2018, 00:39 Andres Freund <andres(at)anarazel(dot)de> wrote:

> Hi,
>
> As Daniel pointed out in:
> https://postgr.es/m/FB948276-7B32-4B77-83E6-D00167F8EEB4@yesql.se the
> pg_atomic_flag fallback implementation is broken. That has gone
> unnoticed because the fallback implementation wasn't testable until now:
> - /* ---
> - * Can't run the test under the semaphore emulation, it doesn't handle
> - * checking two edge cases well:
> - * - pg_atomic_unlocked_test_flag() always returns true
> - * - locking a already locked flag blocks
> - * it seems better to not test the semaphore fallback here, than weaken
> - * the checks for the other cases. The semaphore code will be the same
> - * everywhere, whereas the efficient implementations wont.
> - * ---
> - */
> and flags weren't used until recently.
>
> The attached fixes the bug and removes the edge-cases by storing a value
> separate from the semaphore. I should have done that from the start.
> This is an ABI break, but given the fallback didn't work at all, I don't
> think that's a problem for backporting.
>
> Fix attached. Comments?
>
> Greetings,
>
> Andres Freund
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-04-07 13:18:03 Re: [HACKERS] Runtime Partition Pruning
Previous Message Erik Rijkers 2018-04-07 12:56:13 Re: WIP: Covering + unique indexes. (the good and the bad)