Re: Online enabling of checksums - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Online enabling of checksums
Date
Msg-id 20180406213348.dirx6h2inm3u7e3b@alap3.anarazel.de
Whole thread Raw
In response to Re: Online enabling of checksums  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: Online enabling of checksums
List pgsql-hackers
On 2018-04-06 02:28:17 +0200, Daniel Gustafsson wrote:
> Looking into the isolationtester failure on piculet, which builds using
> --disable-atomics, and locust which doesn’t have atomics, the code for
> pg_atomic_test_set_flag seems a bit odd.
> 
> TAS() is defined to return zero if successful, and pg_atomic_test_set_flag()
> defined to return True if it could set.  When running without atomics, don’t we
> need to do something like the below diff to make these APIs match?  :
> 
> --- a/src/backend/port/atomics.c
> +++ b/src/backend/port/atomics.c
> @@ -73,7 +73,7 @@ pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr)
>  bool
>  pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr)
>  {
> -       return TAS((slock_t *) &ptr->sema);
> +       return TAS((slock_t *) &ptr->sema) == 0;
>  }

Yes, this looks wrong.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: The buildfarm is in a pretty bad way, folks
Next
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] logical decoding of two-phase transactions