pg18 patch: separate package for llvm/jit
pg18 patch: separate package for llvm/jit
Hello Debian hackers,
Last month I asked if we could make LLVM/JIT a choice for installation,
similar to procedural languages like perl, python and tcl. [1] Today it
is part of the main postgresql package.
I would like to propose this change for Postgres 18.
Our motivation is that LLVM/JIT alone increases the total size of the
docker image by 67% (not that far from doubling it), and with many
installations and frequent deployments and updates across a large
fleet, this space savings will be worthwhile when LLVM/JIT is not
needed.
After last month's discussion, in a short thread on the hackers list, I
learned that Postgres explicitly supports building with LLVM/JIT
support and running without the library files, which enables separating
LLVM/JIT into a separate package. [2]
I also learned that the PGDG rpm packagers have already been using this
approach for some time. [3]
Attached are a few patches for debian packaging which I used to
initially test the same pattern as rpm packaging. There are a few small
outstanding items before they are commit-ready, but this enabled me to
confirm that the approach works with debian's build system. Not only
did it successfully remove the LLVM/JIT dependency from the main
package and attach it to the separate package, but it even reduced the
Installed-Size from 57726kb down to 34335kb (which I did not expect).
Those bitcode files are a lot bigger than I realized.
I named the new package postgresql-17-jit-llvm to align with the
current "provides" naming
A few outstanding items to make these commit-ready:
1. Update the provides/requires for postgresql and jit-llvm (postgresql
should still recommend LLVM/JIT)
2. Figure out what happens with this new package on architectures that
don't support LLVM/JIT (empty package? README explanation?)
3. Make sure the bitcode directory itself is created by the main
package so that extensions can use the directory
4. Remove the perl, python and tcl bitcode files from the llvm package
(they are included in the PL packages)
Note that patches are needed against both postgresql-common and
postgresql repositories on salsa (hence two attachments)
Thanks
-Jeremy
1: https://postgr.es/m/20250109005301.3b145092%40jeremy-ThinkPad-T430s
2: https://postgr.es/m/20250111183709.4691fd17%40ardentperf.com
3:
https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob;f=rpm/redhat/main/non-common/postgresql-17/main/postgresql-17.spec;h=30ab4b0496a7c7165318dc7da05f76dc8b437a97;hb=HEAD#l1190
===== without patches:
dpkg -I ../pg17/postgresql-17_17.4-1_amd64.deb
new Debian package, version 2.0.
size 17867268 bytes: control archive=41861 bytes.
1524 bytes, 23 lines control
146703 bytes, 1571 lines md5sums
190 bytes, 13 lines * postinst #!/bin/sh
2642 bytes, 86 lines * postrm #!/bin/sh
349 bytes, 18 lines * preinst #!/bin/sh
199 bytes, 16 lines * prerm #!/bin/sh
4554 bytes, 29 lines templates
Package: postgresql-17
Version: 17.4-1
Architecture: amd64
Maintainer: Debian PostgreSQL Maintainers
Installed-Size: 57726
Depends: locales | locales-all, postgresql-client-17,
postgresql-common (>= 252~), ssl-cert, tzdata, debconf (>= 0.5) |
debconf-2.0, libc6 (>= 2.38), libgcc-s1 (>= 3.3.1), libgssapi-krb5-2
(>= 1.14+dfsg), libicu74 (>= 74.1-1~), libldap2 (>= 2.6.2), libllvm19,
liblz4-1 (>= 0.0~r130), libpam0g (>= 0.99.7.1), libpq5 (>= 17~~),
libselinux1 (>= 3.1~), libssl3t64 (>= 3.0.0), libstdc++6 (>= 5.2),
libsystemd0, libuuid1 (>= 2.16), libxml2 (>= 2.7.4), libxslt1.1 (>=
1.1.25), libzstd1 (>= 1.5.5), zlib1g (>= 1:1.1.4) Recommends: sysstat
Breaks: dbconfig-common (<< 2.0.22~) Provides: postgresql-17-jit-llvm
(= 19), postgresql-contrib-17 Section: database Priority: optional
Homepage: http://www.postgresql.org/ Description: The World's Most
Advanced Open Source Relational Database PostgreSQL, also known as
Postgres, is a free and open-source relational database management
system (RDBMS) emphasizing extensibility and SQL compliance. It
features transactions with Atomicity, Consistency, Isolation,
Durability (ACID) properties, automatically updatable views,
materialized views, triggers, foreign keys, and stored procedures. It
is designed to handle a range of workloads, from single machines to
data warehouses or Web services with many concurrent users. . This
package provides the database server for PostgreSQL 17.
Postgresql-Catversion: 202406281-1700
===== with patches:
dpkg -I postgresql-17_17.4-1_amd64.deb
new Debian package, version 2.0.
size 7875442 bytes: control archive=18570 bytes.
1470 bytes, 23 lines control
50801 bytes, 602 lines md5sums
190 bytes, 13 lines * postinst #!/bin/sh
2642 bytes, 86 lines * postrm #!/bin/sh
349 bytes, 18 lines * preinst #!/bin/sh
199 bytes, 16 lines * prerm #!/bin/sh
4554 bytes, 29 lines templates
Package: postgresql-17
Version: 17.4-1
Architecture: amd64
Maintainer: Debian PostgreSQL Maintainers
Installed-Size: 34335
Depends: locales | locales-all, postgresql-client-17,
postgresql-common (>= 252~), ssl-cert, tzdata, debconf (>= 0.5) |
debconf-2.0, libc6 (>= 2.38), libgssapi-krb5-2 (>= 1.14+dfsg), libicu74
(>= 74.1-1~), libldap2 (>= 2.6.2), liblz4-1 (>= 0.0~r130), libpam0g (>=
0.99.7.1), libpq5 (>= 17~~), libselinux1 (>= 3.1~), libssl3t64 (>=
3.0.0), libsystemd0, libuuid1 (>= 2.16), libxml2 (>= 2.7.4), libxslt1.1
(>= 1.1.25), libzstd1 (>= 1.5.5), zlib1g (>= 1:1.1.4) Recommends:
sysstat Breaks: dbconfig-common (<< 2.0.22~) Provides:
postgresql-17-jit-llvm (= 19), postgresql-contrib-17 Section: database
Priority: optional Homepage: http://www.postgresql.org/ Description:
The World's Most Advanced Open Source Relational Database PostgreSQL,
also known as Postgres, is a free and open-source relational database
management system (RDBMS) emphasizing extensibility and SQL compliance.
It features transactions with Atomicity, Consistency, Isolation,
Durability (ACID) properties, automatically updatable views,
materialized views, triggers, foreign keys, and stored procedures. It
is designed to handle a range of workloads, from single machines to
data warehouses or Web services with many concurrent users. . This
package provides the database server for PostgreSQL 17.
Postgresql-Catversion: 202406281-1700
Re: pg18 patch: separate package for llvm/jit
От:
Christoph Berg <myon@debian.org>
Дата:
Re: Jeremy Schneider > I would like to propose this change for Postgres 18. Hi, I committed a change to the PG18 packaging that implements that split. The new package is called postgresql-18-jit. There is more work to do on each of the extension packages currently depending on "postgresql-18-jit-llvm (= llvmversion)", that needs to be converted to "Breaks: postgresql-18-jit-llvm (<< llvmversion)". (This is also the reason the jit package is not called like that because the version number there is not the PG version number.) This will likely happen when extensions are moved to PG18 in September. I'm unsure if the split should be backported to PG 17 and earlier since it will affect production systems in some way. Christoph
Re: pg18 patch: separate package for llvm/jit
От:
Jeremy Schneider <schneider@ardentperf.com>
Дата:
On Fri, 28 Feb 2025 16:02:42 +0100 Christoph Berg wrote: > Re: Jeremy Schneider > > I would like to propose this change for Postgres 18. > > Hi, > > I committed a change to the PG18 packaging that implements that split. > The new package is called postgresql-18-jit. wow!! i did not expect this 🙂 > There is more work to do on each of the extension packages currently > depending on "postgresql-18-jit-llvm (= llvmversion)", that needs to > be converted to "Breaks: postgresql-18-jit-llvm (<< llvmversion)". > (This is also the reason the jit package is not called like that > because the version number there is not the PG version number.) > > This will likely happen when extensions are moved to PG18 in > September. i'll take a look and learn a bit more about it. one question - the commit message says "Closes: #927182" and i'm curious what that number is a reference to? It doesn't seem to be an issue or PR that I found on salsa.debian.org but maybe I haven't looked in the right place yet. > I'm unsure if the split should be backported to PG 17 and earlier > since it will affect production systems in some way. FWIW, i'm not a debian packaging expert but i was assuming this would not be backported. i don't think we'd want existing installation scripts to change behavior on a postgres minor update (eg. newly provisioned servers no longer getting JIT installed by default, when previously provisioned servers of the same major version have it) -Jeremy
Re: pg18 patch: separate package for llvm/jit
От:
Jeremy Schneider <schneider@ardentperf.com>
Дата:
On Sat, 1 Mar 2025 16:51:49 -0800 Jeremy Schneider wrote: > one question - the commit message says "Closes: #927182" and i'm > curious what that number is a reference to? It doesn't seem to be an > issue or PR that I found on salsa.debian.org but maybe I haven't > looked in the right place yet. nevermind, that was obvious https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=927182 also cf https://www.debian.org/doc/manuals/debmake-doc/ch06.en.html#changelog Crazy that bug has been open since 2019. I'll go learn a bit more about the debian bug tracking system. I've now bookmarked https://bugs.debian.org/cgi-bin/pkgreport.cgi?package=postgresql-17 This raises a higher level question... is this mailing list the right place for this kind of discussion? In my first pass through, I didn't see anything at https://wiki.postgresql.org/wiki/Apt or https://wiki.postgresql.org/wiki/Apt/FAQ about "where is the best place to ask questions" or "how to check if a bug/issue was already reported" or "how to raise a question about new feature or change discussions" -Jeremy