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 1soK55-00AHZu-VJ for pgsql-general@arkaria.postgresql.org; Wed, 11 Sep 2024 09:56:13 +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 1soK55-00DpT2-LE for pgsql-general@arkaria.postgresql.org; Wed, 11 Sep 2024 09:56:11 +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 1soK54-00DpP3-Ub for pgsql-general@lists.postgresql.org; Wed, 11 Sep 2024 09:56:11 +0000 Received: from fhigh6-smtp.messagingengine.com ([103.168.172.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1soK4w-000cWQ-Ut for pgsql-general@lists.postgresql.org; Wed, 11 Sep 2024 09:56:10 +0000 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 64BC9114029C; Wed, 11 Sep 2024 05:56:02 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 11 Sep 2024 05:56:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1726048562; x= 1726134962; bh=szbHFbW0X/5e/PmX/Mdt5vXGFeB6tyU7HlkiRATSvec=; b=j SQX9aVBw6jaVrMtmeXLwXYkDbWPiam0RHJ7qoGPCsq3pjQPMF2/vtc+t7rAk5OFs q36+XPFLxEXKopFF0MFHZsfE2u6ZRLEd2F6+HVtPdlmUHVYkJWrsPONagmG0jDKp HsnVVd89nR1gljE4TijUbdXn8DJsE9+a1dxjAZ5rONMQB0wYnel42YVzhPGdyZkM iVLusn/FolR80bvay8Vw6Jw/88foYDdUj2jPyhWVR6rOz3q7WT8JvOiuZ/uEo2dP mnOuhk7Scvz3TVMniHwzRCywijXnyMSPAZTWErnI77R4CfnIQzYxwy1eo2oh1BFF ZToypCzrSE6mm9jHA/flg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudejuddgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkgggtugfgjgesmhekreertddtjeen ucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhh drnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepudelkeekgfdttdettdekgfdu vdeiffelteegjeeihfetheekveeftedtuddvhfeunecuffhomhgrihhnpegvnhhtvghrph hrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgpdhnsggprh gtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegrnhgurhgvshes rghnrghrrgiivghlrdguvgdprhgtphhtthhopehthhhomhgrshdrmhhunhhrohesghhmrg hilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhp ohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehjrghnrdhpvggtshhokhesphhroh hfihhnihhtrdgvuh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 Sep 2024 05:56:01 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1726048559; bh=rkUxMbhJzlGPkKRQohjg67tBoVtE/PbUqglvwh0C6jM=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=jIkN+znj6+XCAxvPSZwa52cEiiinkxfuf4c4gkEphW4ydFpCiIT+INl8uLVJEUZ8G zpidnG/I8mi2jxeJHM9VZbzQRmFLyCTYELcO6JXzR8E1OYFgwXfTPRmxNubUJ5ETfy vd3Foc1Im2HA/dW9B56MCJGNx+jDEnkXhnkSVJgu2lONuP18dqwkQsyQx1GsUyQI33 mCiZ5DNm6KUAXZxh1wf0ltLUugDBi9H7XR0K1SN2S6P1cPUyx9pcgSPIJSvIU4JNwa cDqDAj0BnjC3DlnyPUlKwXnKYXyGnGi8kONDNcfyEwU7J8ws8HYPZe1NttIzAN0jZ0 mmWpYz4Yi0HbQ== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 7E758D35; Wed, 11 Sep 2024 06:55:59 -0300 (-03) Date: Wed, 11 Sep 2024 11:55:59 +0200 From: Alvaro Herrera To: =?utf-8?B?UGVjc8O2ayBKw6Fu?= Cc: "pgsql-general@lists.postgresql.org" , Thomas Munro , Andres Freund Subject: Re: Error:could not extend file " with FileFallocate(): No space left on device Message-ID: <202409110955.6njbwzm4ocus@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="rjbc3qehavvp44am" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --rjbc3qehavvp44am Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hello Ján, On 2024-Sep-10, Pecsök Ján wrote: > After upgrade of Posgres from version 13.5 to 16.2 we experience following error: > could not extend file "pg_tblspc/16401/PG_16_202307071/17820/3968302971" with FileFallocate(): No space left on device > > We cannot easily replicate problem. It happens at randomly every 1-2 weeks of intensive query computation. > Was there some changes in space allocation from Posgres 13.5 to Posgres 16.2? > > Database has size 91TB and has 27TB more space available. Yes, there were some changes in that area. I have a report from somebody running EPAS 16 which has a problem that looks pretty much the same as yours -- and the code is essentially identical. I gave them the attached patch, hoping that it would shed some light ... but so far, we've been unable to capture any useful intel. I'm going to propose this patch for the next set of minors, but that's in November, so if you're in a hurry and want to risk rebuilding Postgres and see if you get any better error messages with it than with the original, here it is. (Note that the patch doesn't change any behavior, it just report more things when a problem occurs.) I'm CCing Thomas Munro and Andres Freund, who authored the new code. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "El sudor es la mejor cura para un pensamiento enfermo" (Bardia) --rjbc3qehavvp44am Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0001-Add-some-debugging-around-mdzeroextend.patch" From bf5b7b137687a90cb3523f815c015eb5d95fd85c Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Fri, 5 Jul 2024 12:51:42 +0200 Subject: [PATCH] Add some debugging around mdzeroextend This is all new code, so it could have bugs. --- src/backend/storage/file/fd.c | 7 +++++++ src/backend/storage/smgr/md.c | 12 ++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 16b3e8f9058..a5db22b9b37 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -2347,6 +2347,13 @@ retry: */ if (returnCode != EINVAL && returnCode != EOPNOTSUPP) return -1; + + if (returnCode != EOPNOTSUPP) + ereport(WARNING, + errcode(ERRCODE_WARNING), + errmsg("could not allocate additional %lld bytes from position %lld in file \"%s\", retrying by zeroing: %m", + (long long) amount, (long long) offset, + VfdCache[file].fileName)); #endif return FileZero(file, offset, amount, wait_event_info); diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index fdecbad1709..ac5e325f8ec 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -580,15 +580,17 @@ mdzeroextend(SMgrRelation reln, ForkNumber forknum, if (numblocks > 8) { int ret; + off_t addbytes = (off_t) BLCKSZ * numblocks; ret = FileFallocate(v->mdfd_vfd, - seekpos, (off_t) BLCKSZ * numblocks, + seekpos, addbytes, WAIT_EVENT_DATA_FILE_EXTEND); if (ret != 0) { ereport(ERROR, errcode_for_file_access(), - errmsg("could not extend file \"%s\" with FileFallocate(): %m", + errmsg("could not allocate additional %lld bytes from position %lld in file \"%s\": %m", + (long long) addbytes, (long long) seekpos, FilePathName(v->mdfd_vfd)), errhint("Check free disk space.")); } @@ -596,6 +598,7 @@ mdzeroextend(SMgrRelation reln, ForkNumber forknum, else { int ret; + off_t addbytes = (off_t) BLCKSZ * numblocks; /* * Even if we don't want to use fallocate, we can still extend a @@ -605,12 +608,13 @@ mdzeroextend(SMgrRelation reln, ForkNumber forknum, * whole length of the extension. */ ret = FileZero(v->mdfd_vfd, - seekpos, (off_t) BLCKSZ * numblocks, + seekpos, addbytes, WAIT_EVENT_DATA_FILE_EXTEND); if (ret < 0) ereport(ERROR, errcode_for_file_access(), - errmsg("could not extend file \"%s\": %m", + errmsg("could not zero additional %lld bytes from position %lld file \"%s\": %m", + (long long) addbytes, (long long) seekpos, FilePathName(v->mdfd_vfd)), errhint("Check free disk space.")); } -- 2.39.2 --rjbc3qehavvp44am--