Re: Deadlock in XLogInsert at AIX

From: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Bernd Helmle <mailings(at)oopsware(dot)de>
Subject: Re: Deadlock in XLogInsert at AIX
Date: 2017-02-01 11:07:56
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Attached please find my patch for XLC/AIX.
The most critical fix is adding __sync to pg_atomic_fetch_add_u32_impl.
The comment in this file says that:

* __fetch_and_add() emits a leading "sync" and trailing "isync",
* providing sequential consistency. This is undocumented.

But it is not true any more (I checked generated assembler code in
This is why I have added __sync() to this function. Now pgbench working

Also there is mysterious disappearance of assembler section function
with sync instruction from pg_atomic_compare_exchange_u32_impl.
I have fixed it by using __sync() built-in function instead.

Thanks to everybody who helped me to locate and fix this problem.


Konstantin Knizhnik
Postgres Professional:
The Russian Postgres Company

Attachment Content-Type Size
xlc.patch text/x-patch 3.1 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2017-02-01 11:13:38 Re: pg_authid.rolpassword format (was Re: Password identifiers, protocol aging and SCRAM protocol)
Previous Message David Rowley 2017-02-01 11:05:33 Re: Performance improvement for joins where outer side is unique