RE: AIX support

From: Srirama Kucherlapati <sriram(dot)rk(at)in(dot)ibm(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "postgres-ibm-aix(at)wwpdl(dot)vnet(dot)ibm(dot)com" <postgres-ibm-aix(at)wwpdl(dot)vnet(dot)ibm(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Noah Misch <noah(at)leadboat(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Andres Freund <andres(at)anarazel(dot)de>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, "tvk1271(at)gmail(dot)com" <tvk1271(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: RE: AIX support
Date: 2024-12-23 15:55:27
Message-ID: CY8PR15MB56026092DF51E9D300557B5ADB022@CY8PR15MB5602.namprd15.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Team,
In response to our previous discussions, we have refined the code to address
only the necessary adjustments focusing solely on the essential modifications
for AIX compatibility. The codebase was pulled from the GitHub repository
(https://github.com/postgres/postgres.git) and we resolved all issues
encountered during the configure and build processes. The following are the
minimal alterations needed to ensure AIX is supported.

Overview of Changes
We consulted with internal teams (GCC/Linker and Open Source) for each
modification. Details of the changes for the relevant files are as follows:

- configure:
- Addressed AIX-specific alignment issues to support MAXALIGN_ALIGNOF.
- Added comments regarding AIX alignment rules in the file.
- doc/src/sgml/dfunc.sgml:
- Updated related documentation.
- Shared Libraries Build Process:
- Files Affected:
src/Makefile.shlib
src/backend/Makefile
- src/backend/port/aix/mkldexport.sh
- Implemented AIX-specific changes for shared library creation using export
files.
- As per discussions with the linker team, the current design mandates using
the script method to extract symbols and build shared libraries.
- This approach aligns with practices in other open-source projects like
Python, OpenBLAS and other gnu tools(references, link).

https://github.com/python/cpython/blob/main/Modules/ld_so_aix.in

https://github.com/OpenMathLib/OpenBLAS/commit/892f8ff3e55e24fda9af3f6364319cce3f60116b#diff-4011a114c75fe804332139868806cbe23f275963e4e6afa9b57e51b2b9817293R261

- Platform-Specific Updates:
- src/backend/utils/error/elog.c & src/port/strerror.c: Resolved macro
conflict where ENOTEMPTY and EEXIST have the same value.
- src/include/port/aix.h: Added platform-specific header to address
compilation errors.
- src/makefiles/Makefile.aix: Introduced AIX-specific makefile for building.
- src/template/aix: Defined memset flags for AIX.
- Lock Implementation:
- src/include/storage/s_lock.h:
Retained the tas() definition in assembly for now. Testing is ongoing to
replace it with __sync_lock_test_and_set() for benchmarking on both AIX and
PPCle platforms. A separate patch will address this in the future.

- IGNORE: known issue resolved in af21152268317323480
- src/test/regress/expected/jsonb_jsonpath.out
- src/test/regress/sql/jsonb_jsonpath.sql

Testing and Results
We built the code using GCC 12.0, which includes fixes for the memory alignment
issue in AIX. Testing was conducted on the following hardware:
- Hardware: POWER9 machine with 8 CPUs (64-bit registers).
- OS: AIX 7.3 TL3 (7300-03) Latest GA 2024.

Buildfarm Tests: All tests passed.
Performance Benchmark (pgbench):

>> ./bin/pgbench -c 100 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20

scaling factor: 50
query mode: simple
number of clients: 100
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 69978
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 69977/69978 (99.999%)
latency average = 257.223 ms
latency stddev = 3000.532 ms
initial connection time = 366.422 ms
tps = 387.366846 (without initial connection time)
statement latencies in milliseconds and failures:
0.003 0 \set aid random(1, 100000 * :scale)
0.002 0 \set bid random(1, 1 * :scale)
0.002 0 \set tid random(1, 10 * :scale)
0.002 0 \set delta random(-5000, 5000)
1.016 0 BEGIN;
121.947 0 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
18.406 0 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
9.764 0 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
50.664 0 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
1.044 0 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
54.844 0 END;

The changes have been carefully reviewed, tested, and aligned with the
requirements for AIX. If you have any additional feedback or concerns,
please let us know.

Warm regards,
Sriram.

Attachment Content-Type Size
0001-AIX-support-v6.patch application/octet-stream 15.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2024-12-23 16:15:28 Re: Use "protocol options" name instead of "protocol extensions" everywhere
Previous Message Jelte Fennema-Nio 2024-12-23 15:39:13 Re: Use "protocol options" name instead of "protocol extensions" everywhere