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 1rNfvU-00EUu5-5d for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jan 2024 21:15:52 +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 1rNfvT-007gXn-Ag for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jan 2024 21:15:51 +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 1rNfvT-007gXf-20 for pgsql-bugs@lists.postgresql.org; Wed, 10 Jan 2024 21:15:51 +0000 Received: from mail-yw1-x1136.google.com ([2607:f8b0:4864:20::1136]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rNfvQ-000tZ3-Tr for pgsql-bugs@lists.postgresql.org; Wed, 10 Jan 2024 21:15:50 +0000 Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-5f15a1052b3so42235667b3.1 for ; Wed, 10 Jan 2024 13:15:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1704921347; x=1705526147; darn=lists.postgresql.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=6KrvGmDFBIKMmUgY4PLMjYdYkmfQxue8B7fV1st0ZO4=; b=FvfZWXQTfUmoFb3LRGb2mdl8VFSFrsLRglIrGgnly+FBJyl3rBem/cK2BUJHSvEMUl WwUCKAsOzYAGDKp05j+XYYHO6sD9c6egxGRtcnBOKUCrHVOWQ2GlXmftIcazs4B+QIbz iTW/xXLHtaKl0mICsMlBmY1vsDaV8rOpA4OFY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704921347; x=1705526147; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6KrvGmDFBIKMmUgY4PLMjYdYkmfQxue8B7fV1st0ZO4=; b=peG9IpabppY3LdYceWhBRFbsRq2g7gFSjyEWocmv0NZoGjJs7SkwwuHHYI++nN+JmM 7g8pIoqoqAk5G1oNXLgnxAwkWl4VEGjgQzOOahk9D26SlKPTcE1YQH6I/JES1S/L3Y4L pMjgi6fwmChRKznRfdUhjmCKo2q3chMpi78sqs3vBwlREx8yIZCtcRp67Jy2AjMhRWYc A6DmUYOcHzzSC1ud52JGAOI4ISyt1nkWgPU3T0pexg3w4oOJ6ExcbslRnbkoug6AjZCf kCgLXX3kCIlxIUkSqhruqS8py+XT3U+xy4PJ5GKvcRqWebOv3c4JqS5Nz8BnNLC19KMc q/Ew== X-Gm-Message-State: AOJu0YwCsP/d/ArAjTFbNtpjFlonk0dnQFZRhtYPIX1gwvQ9TmWXlDh/ GJeBsaCqvdRd6+OKInZUYcpLGwxyWUZo X-Google-Smtp-Source: AGHT+IFpDS2JfqT2BBZHPtzqdslZDPa6fuCXnhlwOS0T+7WuoAllri6dC74ryPrHAS/XLAfZwB5Ekw== X-Received: by 2002:a0d:df45:0:b0:5d7:1940:7d6b with SMTP id i66-20020a0ddf45000000b005d719407d6bmr258123ywe.66.1704921347380; Wed, 10 Jan 2024 13:15:47 -0800 (PST) Received: from google.com ([2600:1702:a20:5750::48]) by smtp.gmail.com with ESMTPSA id v63-20020a0dd342000000b005f14c87b271sm1897688ywd.53.2024.01.10.13.15.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2024 13:15:46 -0800 (PST) Date: Wed, 10 Jan 2024 13:15:44 -0800 From: Noah Misch To: Peter Geoghegan Cc: Matthias van de Meent , robertmhaas@gmail.com, Alexander Lakhin , PostgreSQL mailing lists , Andres Freund Subject: Re: BUG #17257: (auto)vacuum hangs within lazy_scan_prune() Message-ID: <20240110211544.0b.nmisch@google.com> References: <20231225024402.77@rfd.leadboat.com> <20240106202413.e5@rfd.leadboat.com> <20240109214447.88@rfd.leadboat.com> <20240110193851.f0.nmisch@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jan 10, 2024 at 02:57:34PM -0500, Peter Geoghegan wrote: > On Wed, Jan 10, 2024 at 2:38 PM Noah Misch wrote: > > > I'm referring to calls such as the > > > "GetOldestNonRemovableTransactionId(NULL)" and > > > "GlobalVisCheckRemovableFullXid()" calls that take place inside > > > _bt_pendingfsm_finalize(). It's not like we do stuff like that in very > > > many other places. > > > > I see what you mean about the rarity and potential importance of > > "GetOldestNonRemovableTransactionId(NULL)". There's just one other caller, > > vac_update_datfrozenxid(), which calls it for an unrelated cause. > > I just noticed another detail that adds significant weight to this > theory: it looks like the problem is hit on the first tuple located on > the first heap page that VACUUM scans *after* it completes its first > round of index vacuuming (I'm inferring this from vacrel state, > particular its lpdead_items instrumentation counter). The dead_items > array is as large as possible here (just under 1 GiB), and > lpdead_items is 178956692 (which uses up all of our dead_items space). > VACUUM scans tens of gigabytes of heap pages before it begins this > initial round of index vacuuming (according to vacrel->scanned_pages). > > What are the chances that all of this is just a coincidence? Low, I'd say. Agreed. I bet you've made an important finding, there.