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 1x1gGc-005MEp-2j for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Sep 2026 08:24:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x1gGb-00BXZ7-0P for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Sep 2026 08:24:21 +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 1x1gGa-00BXYz-2Z for pgsql-hackers@lists.postgresql.org; Wed, 02 Sep 2026 08:24:20 +0000 Received: from mail1.dalibo.net ([51.159.93.128] helo=mail.dalibo.com) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x1gGY-00000003bgy-4Au8 for pgsql-hackers@lists.postgresql.org; Wed, 02 Sep 2026 08:24:19 +0000 Received: from karst (82-65-23-130.subs.proxad.net [82.65.23.130]) by mail.dalibo.com (Postfix) with ESMTPSA id 5C88926DA4 for ; Wed, 2 Sep 2026 10:24:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dalibo.com; s=a; t=1788337456; bh=rd+MQMkLhBK5uhLY0inloxtX+o4zDFtfDhByLovz96o=; h=Date:From:To:Subject:In-Reply-To:References:From; b=ZhlpA7orUmNSfYjtV65T0NUdFSY2j8j0wGXb7baCV09rdFsBrWgES3q+VGMa8MlAz 5M648cZoJzXXbGQHGJJ3zWu1U00nK48YQv0X+9cDMWiv6KFEEzKfgbV9Ji5zvG4t5j np3eqq03DV2w3hkOo8KWfCuLy9GR+sCgH3RKRSjY= Date: Wed, 2 Sep 2026 10:24:15 +0200 From: Jehan-Guillaume de Rorthais To: PostgreSQL Hackers Subject: Re: Possible Visibility Map corruption in supported branches? Message-ID: <20260902102415.44b691ed@karst> In-Reply-To: <20260626121955.1431eaca@karst> References: <20260626121955.1431eaca@karst> Organization: Dalibo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Andres, Hi all, We found an event in the cluster I somehow missed. The 6th of May, a sysad= min operation moved the VM's storage to another datastore using svmotion. The storages were moved without shutting down the VMs nor PostgreSQL themselves= . In this three node Patroni cluster, instances were all moved as standbys. Whi= ch means a swichover occured. Let's call the nodes: n21, n22, n23. Here is a sum up of the events: 0. Node n23 is the current primary (since March) 1. 2026-05-06 11h30: n21 storage moved using svmotion without shutting it d= own 2. 2026-05-06 22h30: switchover. n21 becomes primary, n23 a standby 3. 2026-05-07 11h30: n22 storage moved using svmotion without shutting it d= own 4. 2026-05-11 11h30: n23 storage moved using svmotion without shutting it d= own 5. 2026-05-13 19h00: a daily batch issues a lot of INSERT+INIT continuous blocks, including the 2547 affected ones. Each block is filled with abo= ut 27 xacts inserting only one row and being **all** immediately aborted. The= re's at least 500 blocks before and after the affected zone having the same e= xact workload. Only inserted data differ. Xact id increase monotonically. 6. 2026-05-14 02h00: daily vacuum starts on the affected table. Among usual other tasks, all blocks filled with only dead rows are "CLEAN remxid 0" = and set "VISIBLE cutoff xid 0". All? no. Not the 2547 affected ones. For s= ome reason, VACUUM ignored them. 7. between 2026-06-02 21h00 and 2026-06-03 21h00: an old row has been clean= ed somewhere, moving the xid horizon from 3,498,165,236 to 3,596,946,949 and removing all pg_xact segments from 0D08 to 0D65 8. 2026-06-04 02h20: daily vacuum analyze raise the first error about missi= ng file "pg_xact/0D44". The xact status of the 2547 affected blocks were a= ll in this file. 9. 2026-06-12: the customer contact us about this issue 10. 2026-06-15: pg_check_frozen() exposed all the affected blocks Note that step 8 was repeating every day until we fixed the production (see first email of the thread). The error was always raised during the ANALYZE phase. So it _seems_ (but I can't prove it) VACUUM never cleaned these page= s at all between May 13th and June 12th. I can accept the n21 datastore hot move hadn't been really atomic, seeding some incoherence here and there. We already discover a corruption after a vmotion (not svmotion) with another customer. In short, standby n21 might = been promoted with a silent logical corruption. However, I can not be 100% sure it would be the root cause of the problem here. Especially since I fail to find what would be the corruption. Indeed, the affected data have been written **after** this switchover. What kind of corruption would have trigger this behavior? The Visibility Map sho= uld have been updated during the writes=E2=80=A6 shouldn't they? But according = to pg_check_frozen(), it wasn't! What could forbid the vacuum to clean this specific region for such a long = time if it's not the visibility map? Looking at the affected data we collected in june, they all have flags: HEAP_HASNULL, HEAP_HASVARWIDTH, HEAP_XMAX_INVALID Some have an additional HEAP_XMIN_INVALID that could have been set when some readings or a vacuum analyze land here. But nothing would keep vacuum away from them... Does this story ring any bell to someone? I build some graphical map of the relation to visualize various actions on = each blocks, but "decent" png are about 5MB and I don't want to spam everyone on= this list with them. If you're interested, I can share them offlist. Regards,