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.98.2) (envelope-from ) id 1xKeUU-00000000yOd-2g3I for pgsql-bugs@arkaria.postgresql.org; Sat, 24 Oct 2026 16:21:07 +0000 Received: from localhost ([127.0.0.1]:36568 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xKeUU-000000016lx-0Vja for pgsql-bugs@arkaria.postgresql.org; Sat, 24 Oct 2026 16:21:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]:47628) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xKbM1-00000000ieB-2iiT for pgsql-bugs@lists.postgresql.org; Sat, 24 Oct 2026 13:00:09 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xKbLz-00000000jvL-1u3b for pgsql-bugs@lists.postgresql.org; Sat, 24 Oct 2026 13:00:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=4z8LZ+GenEpeUu3YAVxcJBv+wsB/xd/4vjZXkrgCJPw=; b=yfmBqW13Ms1THUhw6pxpVov4sW ZjiIgVIvTxlY3QMyGmpBwZkWalMvh/U0yQgWhXm3/mv59V7KeteToQYObUrwTouIdrHMIzSWSxXnI Pk6JU+jDHJMvlmMvxpqn0JLP9ZkwPKHOd5JUNl5ImS5MaMMZ93R99BbhLzKDYpNvJDvEQdZ5Vxe37 kogkG+lSgvDTWWFYz/2g2tt51cxVaY1+072jzuUOvcA/P1qjq0NFhvT3g3fsiL6bBj1BCvge8hYwV LxaK8KSW2jXbC+vQjKxbuaEWbz7AKo16B94amSjZERaM9P/duPBflbwn/M/aD/FSCdOT1UjxkpNH9 4dWo85cg==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xKbLy-000000021OE-0ZFo for pgsql-bugs@lists.postgresql.org; Sat, 24 Oct 2026 13:00:06 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xKbLw-00000006A0g-0ARN for pgsql-bugs@lists.postgresql.org; Sat, 24 Oct 2026 13:00:04 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19794: Assert in btvacuumcleanup() fails when page counted in pages_free twice To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: exclusion@gmail.com Reply-To: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Date: Sat, 24 Oct 2026 13:00:01 +0000 Message-ID: <19794-b44efb1b558039cd@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19794 Logged by: Alexander Lakhin Email address: exclusion@gmail.com PostgreSQL version: 19rc1 Operating system: Ubuntu 24.04 Description: =20 The following script: echo " CREATE TABLE t (id int); CREATE INDEX t_i1 ON t (id); CREATE INDEX t_i2 ON t (id); INSERT INTO t SELECT g FROM generate_series(2000000, 1, -1) g; DELETE FROM t WHERE id > 999000 AND id < 1000000; VACUUM (INDEX_CLEANUP ON); DELETE FROM t WHERE id > 1000000; " | psql echo " SELECT 'SELECT txid_current();' FROM generate_series(1, 10000) \gexec " | psql >/dev/null & psql -c 'VACUUM t' wait triggers: TRAP: failed Assert("stats->pages_deleted >=3D stats->pages_free"), File: "nbtree.c", Line: 1208, PID: 3843334 ExceptionalCondition at assert.c:51:13 btvacuumcleanup at nbtree.c:1209:22 index_vacuum_cleanup at indexam.c:698:1 vac_cleanup_one_index at vacuum.c:2743:10 parallel_vacuum_process_one_index at vacuumparallel.c:1171:16 parallel_vacuum_process_unsafe_indexes at vacuumparallel.c:1100:3 parallel_vacuum_process_all_indexes at vacuumparallel.c:981:2 parallel_vacuum_cleanup_all_indexes at vacuumparallel.c:636:1 lazy_cleanup_all_indexes at vacuumlazy.c:3019:2 lazy_scan_heap at vacuumlazy.c:1634:1 heap_vacuum_rel at vacuumlazy.c:878:31 table_relation_vacuum at tableam.h:1803:1 vacuum_rel at vacuum.c:2360:2 vacuum at vacuum.c:635:10 ExecVacuum at vacuum.c:470:2 standard_ProcessUtility at utility.c:861:4 ProcessUtility at utility.c:525:3 PortalRunUtility at pquery.c:1153:2 PortalRunMulti at pquery.c:1311:5 PortalRun at pquery.c:792:5 exec_simple_query at postgres.c:1304:11 PostgresMain at postgres.c:4950:27 BackendInitialize at backend_startup.c:142:1 postmaster_child_launch at launch_backend.c:269:3 BackendStartup at postmaster.c:3650:8 ServerLoop at postmaster.c:1730:10 PostmasterMain at postmaster.c:1414:11 main at main.c:232:2 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b)[0x7a3a2f82a28b] postgres: postgres regression [local] VACUUM(_start+0x25)[0x5a37f1dd61b5] 2026-10-24 14:40:20.803 EEST [3843333:4] psql LOG: disconnection: session time: 0:00:00.517 user=3Dpostgres database=3Dregression host=3D[local] 2026-10-24 14:40:20.898 EEST [3843260:6] LOG: client backend (PID 3843334) was terminated by signal 6: Aborted With diagnostic log added in btvacuumcleanup(), I can see: 2026-10-24 14:33:48.916 EEST [3829584:7] psql LOG: !!!btvacuumcleanup| stats->pages_deleted: 4927, stats->pages_free: 4928 2026-10-24 14:33:48.916 EEST [3829584:8] psql CONTEXT: while scanning relation "public.t" 2026-10-24 14:33:48.916 EEST [3829584:9] psql STATEMENT: VACUUM t TRAP: failed Assert("stats->pages_deleted >=3D stats->pages_free"), File: "nbtree.c", Line: 1209, PID: 3829584 Reproduced starting from 0f0cfb494.