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.96) (envelope-from ) id 1vlSn4-00CaNC-36 for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Jan 2026 14:14:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vlSn3-009Tbw-0U for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Jan 2026 14:14:33 +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.96) (envelope-from ) id 1vlSQt-009IhP-1E for pgsql-hackers@lists.postgresql.org; Thu, 29 Jan 2026 13:51:39 +0000 Received: from mail-qk1-x730.google.com ([2607:f8b0:4864:20::730]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vlSQr-000000000cP-0qNn for pgsql-hackers@lists.postgresql.org; Thu, 29 Jan 2026 13:51:39 +0000 Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-8c6d76b9145so107273285a.2 for ; Thu, 29 Jan 2026 05:51:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769694695; cv=none; d=google.com; s=arc-20240605; b=f0h9C1zyz3tYpZh3QggIzrM3TPMScUhw7+fqiSNNhCpATONr1qB0WH2VNLGL0geuX6 8seZ68Tpi7zHjVt8axPxO19KouXstf7MnAK4/rov+tJvvYg2utPZa7Ol4pF9/CahQXwn dQNTK19prg3HqxrpkxgwVxdL8B9QyHMXjc+6N0IOvBOV6f8hHylGdmjZsNspwGMNj9Kr w6G+CHouWlY1+1auWymYK2Ep7/I9P+sONmcTeUVbvoWwTaRfdjxz90vU7fsq4l73nkGm 49Stnv+UTJ1bjb9cGBWrFZcoB6yVPG+cYvPL9FgpaDJyEKsyRVJlVwcMZXxaba24UEtw ltHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=JuOoXWIDDBbk63MIHKhr74bSManGU9U8i+Idlnn/9gM=; fh=uh8aOSb5vzfQJySF6swavNaQXl09vHAjgTbyREKO/A4=; b=JYrR1+ujMYKCnjrbmr+9jVhlL7fjmhFLjVQDqVnEgtU1SKNcPsgmO+0HJ9l9nVJ2Uy M2P1Jx3P254vsY7ZwOh/OnpqSlet3DE7PysxWBRSMZN/KtMWhbGPqrKrijvYq0/Izr9F ohxETJi3OOk/56R5cZnNfOoMaAjbw83ICOb9iSvsS9RKL44OxMMOMOxyKQ0dqfPSrrza k8ZhdVzpMEo/9YG4FYUjm7Nk+KeIMT0jGqvzg2ckKGFeecjFK7U8Sx1CRBXuXyXGIoDt WjcCTY0X4CC+y0hY1nnHZsbQ5r52Q3qCSu/iXD3JxhAjNQ8RDLHcddd6pJ5rLhzY2hSH OS+w==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769694695; x=1770299495; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JuOoXWIDDBbk63MIHKhr74bSManGU9U8i+Idlnn/9gM=; b=YXbU5emlZcWThbm8Z8Q2cBezZ2F6jYVPQ7SeBeNh7EN8RWeMOtlfuKqvPTZnPOXEIu R10QhE+AbYuL69J/bLOey39XVibfeyUp/kflJ+P/Vlw+PbngaGpEauRF/j4hGJc0VMP3 TAH5nn8X1zNAa+U+ErIWww+INT49enJLs1dYxyBScRvrxlK0DdsOiQ731W9a/QVfXFfG P4T2hfu/hq+Kvvjpy/OZ/x3HsTtMaHsRWt7vrWvR0TSbSo5p7jpkKOsIL0PqCDa4ubeb kcVgT6DbSiCUf/J3b5kalEZAn+rfenY5cSmLzoHDxhxJh8xzbsK1VpjVTgIy2BQvYxEW 1uxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769694695; x=1770299495; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JuOoXWIDDBbk63MIHKhr74bSManGU9U8i+Idlnn/9gM=; b=JfxihDbJXl6PpDVWjHNwIXzJ+alvjkBH0jc63x5d/OMKkRkYDL6+mn3UWcVmYsI4Je Jxvsy+ovr/GGw5ezfn8WueF158eY54PQb+I6MKgwQhdtejfB13ENSXegp81cLSuqlqRo +hkPqe0TlwbEW3xFcXbclYddUWqjyV6bbTkycR8QzQM/Uhp275TXKCJJhjOwa1+Lc+tk FYDDWYeQn0cG2Vbs4wX9GtlO7sYQbXLU+T3NKY26OFdQXwYVZYiW/e79pBv5ZK8jMnAx ZlItr+2rxcIJsuDUWTgucs0Hc0XY+djE5s/Tn3li2IVNPXaA3rD+3TJvoVbQMJosgsLD qfIw== X-Forwarded-Encrypted: i=1; AJvYcCX4Gl2a09cyvNCGCds4BadKZvu53Nl92BQXSNG7kGFbgtFsIV51HiUQhmC+YeTDdv5HCGLsYTokBs9zJYoj@lists.postgresql.org X-Gm-Message-State: AOJu0Ywyrm3Oiv5jMbVznSJd3nvdyMRh1u+qcjzCLqYhza9zBSs8Ay30 1+unwBgusG89dOB/dxKKKpHDlZLsFxhUNwadwGsF9SqAahVTun5/aaM3GryF6tMA1vn6tssOo4H my+IRoFBeMz4g0F39MbUQt2bwYu6UN6Q= X-Gm-Gg: AZuq6aKtob3H8eaccO5cPnnBEPgfd+iU3stoblpPV3kmoScP6BXBIL5s+Tq6NFdncQ6 cMDyjwgg26AP0AaiuK28vdpV5bdO4iakTnTfIexgK84MPWmrBDyCtH2k4+aqv8bgQmAuRBs8Bq5 PbdMdrfBOul75U9H2OikFPI/LcGTwzprzG6Q1TuXybpdCl3/TAXj2N+CZsdn2y3Q9iLem6/m0q0 5+gohEvi1icVE3ZK+d5tmkcgUNnr2onHZgYa85yOucyaKIYfaBLtanokzhWBnkQ5t06dHCXd3zw gyi+HQjQRYeUah+jRY6E4hcPF/IGvhEaMLxNY3osUXbld1/na/SLrt1doQ== X-Received: by 2002:a05:622a:104:b0:501:145f:dbf4 with SMTP id d75a77b69052e-5032fb1d3acmr121217261cf.64.1769694695333; Thu, 29 Jan 2026 05:51:35 -0800 (PST) MIME-Version: 1.0 References: <6BC5DBAB-6084-4BB8-8450-52E9648AB021@gmail.com> <7F5BCD7A-764D-4D8D-8E27-6F2CAAEA1CEE@gmail.com> <4379FDA3-9446-4E2C-9C15-32EFE8D4F31B@yandex-team.ru> <7ib3sa55sapwjlaz4sijbiq7iezna27kjvvvar4dpgkmadml6t@gfpkkwmdnepx> <2b09fba6-6b71-497a-96ef-a6947fcc39f6@gmail.com> In-Reply-To: From: Kirill Reshke Date: Thu, 29 Jan 2026 18:51:23 +0500 X-Gm-Features: AZwV_QjlvLyBAqZvv3P5wBa9Yi7dNsMkNXvPKQ3_jiTmJZekVurhime2jnxFF2A Message-ID: Subject: Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access) To: Alexander Lakhin Cc: Melanie Plageman , Andres Freund , Andrey Borodin , Chao Li , Xuneng Zhou , Robert Haas , PostgreSQL Hackers , Heikki Linnakangas Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 29 Jan 2026 at 18:39, Kirill Reshke wrote: > > On Thu, 29 Jan 2026 at 10:00, Alexander Lakhin wrote: > > > > Hello Melanie, > > > > 29.01.2026 01:16, Melanie Plageman wrote: > > > > Thanks for the review! > > I pushed v33 0001-0003 after incorporating your feedback. > > > > > > The buildfarm animal scorpion has detected an instability of the addition > > to pg_visibility from 21796c267 [1]: > > > > 80/82 postgresql:pg_visibility-running / pg_visibility-running/regress ERROR 7.23s exit status 1 > > > > diff -U3 /home/bf/bf-build/scorpion/HEAD/pgsql/contrib/pg_visibility/expected/pg_visibility.out /home/bf/bf-build/scorpion/HEAD/pgsql.build/testrun/pg_visibility-running/regress/results/pg_visibility.out > > --- /home/bf/bf-build/scorpion/HEAD/pgsql/contrib/pg_visibility/expected/pg_visibility.out 2026-01-26 22:07:12.923378464 +0100 > > +++ /home/bf/bf-build/scorpion/HEAD/pgsql.build/testrun/pg_visibility-running/regress/results/pg_visibility.out 2026-01-28 20:15:13.802517085 +0100 > > @@ -213,7 +213,7 @@ > > select pg_visibility_map_summary('test_vac_unmodified_heap'); > > pg_visibility_map_summary > > --------------------------- > > - (1,1) > > + (0,0) > > (1 row) > > > > -- the checkpoint cleans the buffer dirtied by freezing the sole tuple > > @@ -237,7 +237,7 @@ > > FROM page_header(get_raw_page('test_vac_unmodified_heap', 0)); > > ?column? > > ---------- > > - t > > + f > > (1 row) > > > > -- vacuum sets the VM > > > > I've managed to reproduce it locally with the attached and: > > echo "autovacuum_naptime = 1" > /tmp/temp.config > > TEMP_CONFIG=/tmp/temp.config make -s check -C contrib/pg_visibility/ > > ... > > ok 85 - pg_visibility 30 ms > > not ok 86 - pg_visibility 165 ms > > ok 87 - pg_visibility 36 ms > > ... > > # 1 of 100 tests failed. > > > > Could you please look at this? > > > > Probably you'll find [2] helpful. > > > > [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=scorpion&dt=2026-01-28%2019%3A07%3A32 > > [2] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=1c64d2fcb > > > > Best regards, > > Alexander > > > Thanks Alexander! > This is a good and detailed report, I was able to reproduce this. > > I have added some logs to my copy of postgres with your patch and I > think problem causing this test to fail is this sequence: > > 1) Autovacuum starts, does its deeds, and acquiring xid = 118518 > 2) insert into test_vac_unmodified_heap values (1); executes and > commits with xid = 118519 (from my log) > 3) vacuum freeze starts and computes cutoff xid = 118518, because > oldest xmin is 118518 from (1) > > *and we cannot freeze tuple* > > > ``` > > 2026-01-29 13:27:44.559 UTC [133670] DEBUG: CommitTransaction(1) > name: unnamed; blockState: STARTED; state: INPROGRESS, xid/subid/cid: > 118519/1/0 (used) > ... > 2026-01-29 13:27:44.559 UTC [133672] DEBUG: CommitTransaction(1) > name: unnamed; blockState: STARTED; state: INPROGRESS, xid/subid/cid: > 118518/1/2 > ... > 2026-01-29 13:27:44.560 UTC [133670] INFO: finished vacuuming > "contrib_regression.public.test_vac_unmodified_heap": index scans: 0 > pages: 0 removed, 1 remain, 1 scanned (100.00% of total), 0 > eagerly scanned > tuples: 0 removed, 1 remain, 0 are dead but not yet removable > removable cutoff: 118518, which was 2 XIDs old when operation ended > new relfrozenxid: 118518, which is 1 XIDs ahead of previous value > frozen: 0 pages from table (0.00% of total) had 0 tuples frozen > visibility map: 0 pages set all-visible, 0 pages set > all-frozen (0 were all-visible) > index scan not needed: 0 pages from table (0.00% of total) had > 0 dead item identifiers removed > avg read rate: 0.000 MB/s, avg write rate: 54.253 MB/s > buffer usage: 22 hits, 0 reads, 3 dirtied > > > ``` > > I did not come up with a fix yet though. > > -- > Best regards, > Kirill Reshke One possible way here is to remove regression test changes made in 21796c267, and rewrite this ad TAP test. In TAP test, we can do akin to 006_singla_autovacuum.pl: ``` # From this point, autovacuum worker will wait at startup. $node->safe_psql('postgres', "SELECT injection_points_attach('autovacuum-worker-start', 'wait');"); ``` So, we can remove autovacuum xid acquirition from the test. Thoughts? -- Best regards, Kirill Reshke