Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYwaT-00045H-Gj for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Feb 2017 15:12:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cYwaT-0001RW-3k for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Feb 2017 15:12:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cYvH1-0002mf-Ei for pgsql-hackers@postgresql.org; Wed, 01 Feb 2017 13:48:35 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYvGt-0004DU-VQ for pgsql-hackers@postgresql.org; Wed, 01 Feb 2017 13:48:34 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 082EC21C2A90; Wed, 1 Feb 2017 16:48:26 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Subject: Re: Deadlock in XLogInsert at AIX DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1485956905; bh=W5m5g5An5EYWRueVB1PXBZp5bjm4nE7kLA/94ffRjvc=; h=To:References:Cc:From:Date:In-Reply-To; b=NJMFIwIbgHJeoyDTzMHGobDXaus6YXg4HhbZBv77wYaXDbEh4JmzBYhYroHk7ImIi YRuJ+ioi3OMFOdqRtNtlBRVI1IPK2tP5hdU2apKXZr3WXaFcFVqe4T6NWScVZQSpFA XIghoDsAhvrZUuK7FPOLLoeBd/9F8imFkBnp4760= To: "REIX, Tony" , PostgreSQL Hackers References: <0184657d-cf64-10f6-9706-7329f23f5f89@iki.fi> <85a1966c-aeee-fb38-77bd-6cad9a90b35f@postgrespro.ru> <2c4037f1-b35d-4d71-0d32-40a97523b31c@postgrespro.ru> <5de6b64a-f842-9166-e41a-ed7b87a2729b@iki.fi> <7609057e-b021-56d8-afb6-27acc1dfdeea@postgrespro.ru> <2fc764c7-2222-83e3-45c2-33c17853e13f@atos.net> Cc: Heikki Linnakangas , Bernd Helmle From: Konstantin Knizhnik Message-ID: <3f5948ed-b2a9-0920-98ac-47b347ad03a3@postgrespro.ru> Date: Wed, 1 Feb 2017 16:48:34 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <2fc764c7-2222-83e3-45c2-33c17853e13f@atos.net> Content-Type: multipart/alternative; boundary="------------34C87ADED44465346D61B84B" X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------34C87ADED44465346D61B84B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi, We are using 13.1.3 version of XLC. All tests are passed. Please notice that is is synchronization bug which can be reproduced only under hard load. Our server has 64 cores and it is necessary to run pgbench with 100 connections during several minutes to reproduce the problem. So may be you just didn't notice it;) On 01.02.2017 16:29, REIX, Tony wrote: > > Hi, > > I'm now working on the port of PostgreSQL on AIX. > (RPMs can be found, as free OpenSource work, at > http://http://bullfreeware.com/ . > http://bullfreeware.com/search.php?package=postgresql) > > I was not aware of any issue with XLC v12 on AIX for atomic operations. > (XLC v13 generates at least 2 tests failures) > > For now, with version 9.6.1, all tests "check-world", plus > numeric_bigtest, are OK, in both 32 & 64bit versions. > > Am I missing something ? > > I configure the build of PostgreSQL with (in 64bits): > > ./configure > --prefix=/opt/freeware > --libdir=/opt/freeware/lib64 > --mandir=/opt/freeware/man > --with-perl > --with-tcl > --with-tclconfig=/opt/freeware/lib > --with-python > --with-ldap > --with-openssl > --with-libxml > --with-libxslt > --enable-nls > --enable-thread-safety > --sysconfdir=/etc/sysconfig/postgresql > > Am I missing some option for more optimization on AIX ? > > Thanks > > Regards, > > Tony > > > Le 01/02/2017 à 12:07, Konstantin Knizhnik a écrit : >> 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", >> thereby >> * providing sequential consistency. This is undocumented. >> >> But it is not true any more (I checked generated assembler code in >> debugger). >> This is why I have added __sync() to this function. Now pgbench working >> normally. >> >> 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: http://www.postgrespro.com >> The Russian Postgres Company >> >> >> ATOS WARNING ! >> This message contains attachments that could potentially harm your >> computer. >> Please make sure you open ONLY attachments from senders you know, >> trust and is in an e-mail that you are expecting. >> >> AVERTISSEMENT ATOS ! >> Ce message contient des pièces jointes qui peuvent potentiellement >> endommager votre ordinateur. >> Merci de vous assurer que vous ouvrez uniquement les pièces jointes >> provenant d’emails que vous attendez et dont vous connaissez les >> expéditeurs et leur faites confiance. >> >> AVISO DE ATOS ! >> Este mensaje contiene datos adjuntos que pudiera ser que dañaran su >> ordenador. >> Asegúrese de abrir SOLO datos adjuntos enviados desde remitentes de >> confianza y que procedan de un correo esperado. >> >> ATOS WARNUNG ! >> Diese E-Mail enthält Anlagen, welche möglicherweise ihren Computer >> beschädigen könnten. >> Bitte beachten Sie, daß Sie NUR Anlagen öffnen, von einem Absender >> den Sie kennen, vertrauen und vom dem Sie vor allem auch E-Mails mit >> Anlagen erwarten. >> >> > -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --------------34C87ADED44465346D61B84B Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Hi,

We are using 13.1.3 version of XLC. All tests are passed.
Please notice that is is synchronization bug which can be reproduced only under hard load.
Our server has 64 cores and it is necessary to run pgbench with 100 connections during several minutes to reproduce the problem.
So may be you just didn't notice it;)



On 01.02.2017 16:29, REIX, Tony wrote:

Hi,

I'm now working on the port of PostgreSQL on AIX.
(RPMs can be found, as free OpenSource work, at http://http://bullfreeware.com/ .
 
http://bullfreeware.com/search.php?package=postgresql )

I was not aware of any issue with XLC v12 on AIX for atomic operations.
(XLC v13 generates at least 2 tests failures)

For now, with version 9.6.1, all tests "check-world", plus numeric_big test, are OK, in both 32 & 64bit versions.

Am I missing something ?

I configure the build of PostgreSQL with (in 64bits):

 ./configure
        --prefix=/opt/freeware
        --libdir=/opt/freeware/lib64
        --mandir=/opt/freeware/man
        --with-perl
        --with-tcl
        --with-tclconfig=/opt/freeware/lib
        --with-python
        --with-ldap
        --with-openssl
        --with-libxml
        --with-libxslt
        --enable-nls
        --enable-thread-safety
        --sysconfdir=/etc/sysconfig/postgresql

Am I missing some option for more optimization on AIX ?

Thanks

Regards,

Tony


Le 01/02/2017 à 12:07, Konstantin Knizhnik a écrit :
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",
thereby
      * providing sequential consistency.  This is undocumented.

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

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: http://www.postgrespro.com
The Russian Postgres Company


ATOS WARNING !
This message contains attachments that could potentially harm your computer.
Please make sure you open ONLY attachments from senders you know, trust and is in an e-mail that you are expecting.

AVERTISSEMENT ATOS !
Ce message contient des pièces jointes qui peuvent potentiellement endommager votre ordinateur.
Merci de vous assurer que vous ouvrez uniquement les pièces jointes provenant d’emails que vous attendez et dont vous connaissez les expéditeurs et leur faites confiance.

AVISO DE ATOS !
Este mensaje contiene datos adjuntos que pudiera ser que dañaran su ordenador.
Asegúrese de abrir SOLO datos adjuntos enviados desde remitentes de confianza y que procedan de un correo esperado.

ATOS WARNUNG !
Diese E-Mail enthält Anlagen, welche möglicherweise ihren Computer beschädigen könnten.
Bitte beachten Sie, daß Sie NUR Anlagen öffnen, von einem Absender den Sie kennen, vertrauen und vom dem Sie vor allem auch E-Mails mit Anlagen erwarten.




-- 
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company 
--------------34C87ADED44465346D61B84B--