Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tmgJZ-008qh2-CZ for pgsql-pkg-debian@arkaria.postgresql.org; Mon, 24 Feb 2025 21:48:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tmgJY-009XKi-Gp for pgsql-pkg-debian@arkaria.postgresql.org; Mon, 24 Feb 2025 21:48:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tmgJY-009XKa-5f for pgsql-pkg-debian@lists.postgresql.org; Mon, 24 Feb 2025 21:48:36 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tmgJV-000cAn-0I for pgsql-pkg-debian@lists.postgresql.org; Mon, 24 Feb 2025 21:48:35 +0000 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-220ecbdb4c2so20925225ad.3 for ; Mon, 24 Feb 2025 13:48:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ardentperf-com.20230601.gappssmtp.com; s=20230601; t=1740433711; x=1741038511; darn=lists.postgresql.org; h=mime-version:message-id:subject:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=79nd5jaGogvekAl1Q5+cy0ncnDjzlNXI7d2x6pO7m5M=; b=jlFQTDP7EyXQE/cLqs+Pz4CvqxJ6QH7ybtglH36LuL97Rxmbm9MN4G/kP5OAM9i4so a+hJ42EroeqejIurhmXSqnS7H4p3s8EBMN1tnDXpBQrqJmjcG7N58fVAM7NemtIyAfrx 5paNQP+Wu3vUip5gxnIUqQ960JBWfJUhge5vLcpkl5va7ixVpM9fKGgi7ZjLYhdUCseu +tPK9+78Vbh3UhXo8n71iZeEjBIEelD8KNiZPJOuyZMfIUCOsyx6ruiMXJANTCm6ZXlG 3lCPgYsx9cZqKpfu0gbe+xF9hAg0WeTvR5MnrIt+Mo5MiF/Obpb8CDQqArsxiTwrU9C7 Xc1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740433711; x=1741038511; h=mime-version:message-id:subject:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=79nd5jaGogvekAl1Q5+cy0ncnDjzlNXI7d2x6pO7m5M=; b=Rr+o5iuIO9MVzy0US2Vv5qsUwHYL1ToE456JDw3mxYwqmTIp7Zlg+VUNt+LZce5WDG KGnPlGBFy5wpC7lGUIrTSF7p/835+/w6MhG60/HMkb8f/ygJJfDwjKB7r0pr95+XpExd 0MgqYxKGiip7OY7owK6Y63RAalOz780z83zJqltATGjQtJINxx058qd7RhNUGtIR9Ikj weNxPBcHqM2VsCsSkGTp1/5Xf4r25YjJQCliK3DpiL59YjOn+goj6LD7RTCFp/kdostM FbbJ6UJqCJwLmdvsQneB4FxUiq1IQ11/kHNQ4FQ9Osk5GGHA/rJPsvQ38mKVpUPdvXTc gdGQ== X-Gm-Message-State: AOJu0Yxawo1jnMdCJdez5R4FgRBLrbzm8h6PWilTpA6mOxUcHMWvjIKv 2R7ITekdNWozXGE84X1w+nGUSWmVdwxfAE7aXrYBkLKJZcKWOBZUeBrVuopG16q/5lIvVjbfdmE = X-Gm-Gg: ASbGncsHSbloxw8eJhHlMZEX+wS5LsVJ+KMNyGDONldAqjpCGBfqgX2Dwc7I+4oF1a9 BsCHaExPSX/NFEjSDwbTo562nUmOTPifLvhFqeEp+BFjgRVYYicGZ5rMEKiTQZTZPPvBNjGW+WB 8w+FUX7EAhGgC46Eb4TVmOy3D1bpbmmoVI7XEJK+gr/Of8zsf8RoqaKUpRZvFLlfOsGg0U7cqad ouFvt6L7nwOxuIvlZCXUnkRupK/cXyOTg9kqBy3VIcmFXfN14kdkdfasZR120+QOXUp9TOUfuEK i2x3ZqebTsNfdey4DVIyryTeqL8PAEOsIh9kb1WIzks3jBPDd13Y4LgAqrf7okmq X-Google-Smtp-Source: AGHT+IF3rucSL4KDFhQ2FHZYgWQ2BReZ6yVuqwLPfmSdIAUTnbvEfkg3GtO0AqGjgiUSBzof4movNA== X-Received: by 2002:a17:903:228d:b0:21f:1bd:efd4 with SMTP id d9443c01a7336-221a0ed7e4cmr241622485ad.19.1740433711259; Mon, 24 Feb 2025 13:48:31 -0800 (PST) Received: from ardentperf.com (97-113-65-241.tukw.qwest.net. [97.113.65.241]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aedaa642989sm109845a12.55.2025.02.24.13.48.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2025 13:48:30 -0800 (PST) Date: Mon, 24 Feb 2025 13:48:29 -0800 From: Jeremy Schneider To: pgsql-pkg-debian@lists.postgresql.org Subject: pg18 patch: separate package for llvm/jit Message-ID: <20250224134829.286cc256@ardentperf.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/SUaW=o+c87H7Dkz3kUfcp.r" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --MP_/SUaW=o+c87H7Dkz3kUfcp.r Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 --MP_/SUaW=o+c87H7Dkz3kUfcp.r Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=postgresql-01-jit-llvm.patch diff --git a/debian/control b/debian/control index 66e3184..96d3fcc 100644 --- a/debian/control +++ b/debian/control @@ -298,3 +298,20 @@ Description: PL/Tcl procedural language for PostgreSQL 17 PostgreSQL 17 functions that use the languages pltcl or pltclu. . PostgreSQL is an object-relational SQL database management system. + +Package: postgresql-17-jit-llvm +Architecture: any +Depends: + postgresql-17 (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Provides: + postgresql-jit-llvm, +Description: JIT/LLVM support for PostgreSQL 17 + Just-in-Time (JIT) compilation is the process of turning some + form of interpreted program evaluation into a native program, + and doing so at run time. In some cases this can provide + performance benefits. + . + PostgreSQL is an object-relational SQL database management system. + diff --git a/debian/postgresql-17-jit-llvm.install b/debian/postgresql-17-jit-llvm.install new file mode 100755 index 0000000..2c9d974 --- /dev/null +++ b/debian/postgresql-17-jit-llvm.install @@ -0,0 +1,5 @@ +#!/usr/bin/dh-exec + +usr/lib/postgresql/*/lib/llvmjit.so +[!alpha !hppa !hurd-amd64 !hurd-i386 !ia64 !kfreebsd-amd64 !kfreebsd-i386 !loong64 !m68k !powerpc !riscv64 !sh4 !sparc64 !x32] usr/lib/postgresql/*/lib/bitcode +[!alpha !hppa !hurd-amd64 !hurd-i386 !ia64 !kfreebsd-amd64 !kfreebsd-i386 !loong64 !m68k !powerpc !riscv64 !sh4 !sparc64 !x32] usr/lib/postgresql/*/lib/llvmjit_types.bc diff --git a/debian/postgresql-17-jit-llvm.lintian-overrides b/debian/postgresql-17-jit-llvm.lintian-overrides new file mode 100644 index 0000000..db59083 --- /dev/null +++ b/debian/postgresql-17-jit-llvm.lintian-overrides @@ -0,0 +1,20 @@ +# We test for /usr/bin/pg_dropcluster, but run it without path +command-with-path-in-maintainer-script + +# The World's Most Advanced Open Source Relational Database +description-synopsis-starts-with-article + +# We ship binaries and libs in subdirs of /usr/lib/postgresql +executable-in-usr-lib +repeated-path-segment lib * + +# These are PostgreSQL server plugins; some need no external libraries +hardening-no-fortify-functions [usr/lib/postgresql/*/lib/*] +library-not-linked-against-libc [usr/lib/postgresql/*/lib/*] +shared-library-lacks-prerequisites [usr/lib/postgresql/*/lib/*] + +# We use debconf in postrm only +no-debconf-config + +# We store the PostgreSQL catalog version in a custom control field +unknown-field *Postgresql-Catversion --MP_/SUaW=o+c87H7Dkz3kUfcp.r Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=postgresql-common-01-jit-llvm.patch diff --git a/server/postgresql.mk b/server/postgresql.mk index 91dc8b2..4883c82 100644 --- a/server/postgresql.mk +++ b/server/postgresql.mk @@ -242,6 +242,11 @@ override_dh_install-arch: bash -c "rm -v debian/postgresql-$(MAJOR_PKG)/usr/lib/postgresql/$(MAJOR_VER)/lib/{plperl,plpython,pltcl,*_pl}*" bash -c "rm -rfv debian/postgresql-$(MAJOR_PKG)/usr/lib/postgresql/$(MAJOR_VER)/lib/bitcode/*{plperl,plpython,pltcl}*" + # these are shipped in the jit/llvm package + bash -c "rm -v debian/postgresql-$(MAJOR_PKG)/usr/lib/postgresql/$(MAJOR_VER)/lib/llvmjit.so" + bash -c "rm -v debian/postgresql-$(MAJOR_PKG)/usr/lib/postgresql/$(MAJOR_VER)/lib/llvmjit_types.bc" + bash -c "rm -rfv debian/postgresql-$(MAJOR_PKG)/usr/lib/postgresql/$(MAJOR_VER)/lib/bitcode" + # record catversion in a file echo $(CATVERSION) > debian/postgresql-$(MAJOR_PKG)/usr/share/postgresql/$(MAJOR_VER)/catalog_version --MP_/SUaW=o+c87H7Dkz3kUfcp.r--