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 1vlSF1-00CSDh-2F for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Jan 2026 13:39:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vlSF0-009AGs-2Z for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Jan 2026 13:39:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vlSF0-009AGU-18 for pgsql-hackers@lists.postgresql.org; Thu, 29 Jan 2026 13:39:22 +0000 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vlSEy-002vLR-0V for pgsql-hackers@lists.postgresql.org; Thu, 29 Jan 2026 13:39:21 +0000 Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-8c710439535so77942885a.1 for ; Thu, 29 Jan 2026 05:39:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769693960; cv=none; d=google.com; s=arc-20240605; b=lLUde+yta9oL/sRlaVSHR++Pb1gKortvdldnd/QG/kqCeiSwLPLMYoEQ+shCw4PHn0 f48lv2y8nzONlbqhZcnQh5N0GHzOI64kP8ZEOZy6gv/V26fA1cHgogSfrYPLeKWpvVxV UhECT2XWZZvEtET+BqRWxqowK2+qW+JDhomj5vHyTv6O6XMH2698UZDFGIvu5Y3GQbpU Oewv64CNHrl9/jWuKtYnTuy5G1O0BHhp/+lf56IeiCDlSNL+m9+R+l8wcPR/iAyitDTR /sQNoJXM+e+KDmDTMCXwz0PZDqY8qTWBXgTMcTwxe34sahX5ToNoc2ZhHbu1rhwWjXRV Zjcw== 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=ALD4n221W4GO7irkwx1jdnPLpz3Q9ybT++hI5/RYuyA=; fh=ZqR6FGaXBkM2xwAzoJOBgN/O/I0QsKlxWBaXDRTbLS0=; b=eBeGvu/g9VVzlhNwoPjc6kk8l702gbQJeMJ2LROSR5mcZlhNnFYcj6Jww5NE9G6o1J WczY/+YH61mqezAZ3MG6Jx0gjrkhfzqDMmfoW5QEmQL6oqffEdgIqwPhF1SlbVLChVx7 1gIsuKEUv7mkp2nldspP5fJpLez5zVPGLSaSAfk1oHzOClt4DUYtwCgy5C5nAK9L35tr SaG1CWc2JWAIRVzj//HP7q5dwMM76l02BkbWM403dwb8UuyBAwlHdGowbqY44UTvtjRy wLDVas5tYVck6+qQpt6idteVJ8o9cDS2x+Uzl6w/5wkydxpHSgkOmismkCTqkZFC2Hfo meZg==; 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=1769693960; x=1770298760; 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=ALD4n221W4GO7irkwx1jdnPLpz3Q9ybT++hI5/RYuyA=; b=kROEYqAIz8FHK8F6NoECTYSEUfxY7Kb1zkUtnt8NINetVkMXK7qe6gI+lzZzn8uTwL SZe0ByN2hRGCh0T6plSphqjTdKrXWfksPQ2mD3EJz90MTbtaiB1yG14j2wfqADz2GI/L fRJfKnemvYR8faUaNPkg3VM2jCu9L9wqTgDD42iHsj1tNx94oxLm3f7rT9gtXyMJCF0v Lv/QKbP+H5bq4IMTA0bgD3nNeav6iDnihZlD8irwoRu2K9CRMNN70Tkll/K+o5fCnJTt k+ceRiu3M1hcG41jPuU16y8VYlaISamvj/Zx2QYlg5mxeD5cOx64epqtKNo1cgBhxkTW pWZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769693960; x=1770298760; 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=ALD4n221W4GO7irkwx1jdnPLpz3Q9ybT++hI5/RYuyA=; b=W6Jqm+Hddcr4BOSnj7iG2e4i6HTorcR5NLIfJ7dlXqjdQWxnEfUoTVpHaO4o4obGcD pVkTi2BhzT+gfnvomdOLHJ7EaPmRRjhXsoZ0kLqI7gAoEIXDe7dsFAagrhRIzAzkuzWD kEqemN6UNEjC4/XCz+KxZOFGmJ2H0lXR78rAIDN2KD/zyH5AWyTpmADykLxlFnFW0+ht k7nNbmGIKGcNJ1ttQilL2Z5+5/gEIxWpRMmXVCSXGyxcTnAYA8aIanGPqcj7cZPLyjNf Ylt/rrFddUwu22OtNfR28rnIANFnXrgz1EM+FcP/OLk1oyuIIep3wgHz1miU6JvxmK4o 0WgA== X-Forwarded-Encrypted: i=1; AJvYcCVm71nYQne3PEW0WIF9m0veZiGmb5ZfM9REnyCMn4/fmUrIZJPDxfl1fRUsXIToJo5QD87HYPCVDqkHft96@lists.postgresql.org X-Gm-Message-State: AOJu0YyYV5hkjG1U/jEXOprODUF0FKRLdNQbHqkZZF0tYJCNd0kp87cf eWF/H/A+0cgJ5Q56+gXIVbrLFzo0REOWJm2BSdPn3w0nd+li/0OfiHEy+oxkgZg3HZ/V3jlUD/V 9ov7gwD+dEjJ5aw2L/sQ0sXnHmQ1MsEA= X-Gm-Gg: AZuq6aKJmCcW0Si/T/Gr3vIBP0K74hY9Ju3gChB6eKf/BQ28GKbyWxiPeRI7/KtVY1Q 1PllKEyvG6qQDS2qRuC/B2kK3UDjMp4XKRZZI/KSD63egh2wW646dFMQVLq93Hc77DQaJwNILAe Fwp2sKIltsc5f8ot6sVRwkiffsQcPBHZTrkQxFFQGvim1NA0Hybn8sC6v2dz7+WItCnP+nEmxyw NBk59daATGsSfxEsxXMmqQ1TtQoUjg240SiiDbsMd6ucTkmM67m5mKAVkRWq18YyuOnMCb7AHfE jdgSbXHULvIU85cTuYLHZl6+UJbBDYojW2B70h16iia6fvlPs/nAeuhGIw== X-Received: by 2002:ac8:5a47:0:b0:501:f700:1792 with SMTP id d75a77b69052e-5032fb1ab91mr122941891cf.79.1769693959768; Thu, 29 Jan 2026 05:39:19 -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: <2b09fba6-6b71-497a-96ef-a6947fcc39f6@gmail.com> From: Kirill Reshke Date: Thu, 29 Jan 2026 18:39:07 +0500 X-Gm-Features: AZwV_QhkYSkiNEWVd3Dngqt8FI495VqlOxGePrza7I4kmvK1HD7do8I7QVHW698 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 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