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 1tKZvn-009Vg8-OX for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Dec 2024 09:19:55 +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 1tKZvk-0063M6-Pb for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Dec 2024 09:19:54 +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.94.2) (envelope-from ) id 1tKZvk-0063Ly-Ft for pgsql-hackers@lists.postgresql.org; Mon, 09 Dec 2024 09:19:53 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tKZvf-001pvK-AR for pgsql-hackers@postgresql.org; Mon, 09 Dec 2024 09:19:52 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-aa67f31a858so155727966b.2 for ; Mon, 09 Dec 2024 01:19:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733735986; x=1734340786; darn=postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=qs0tuaBR1LZn4Tivt/qSil2WOtfaaAJgBLjyaQnCXNk=; b=VZUVjr8r1C5LejWzYWh+TEoMgcHdNDiFn6cSEOwU3J6PECWG8HCVkAlfq6u9DROcU+ ztaV1eUmKiTTtdKMUgAZHiB5vkkleo4Bpq+D6veMX0U9ZzzsHRi3FMyn+kPfScqkjBVA LPUgPHL9jKOcjmBGDekA0L4dfsb+wwaSdM3DfphEQNEPC+OuyRhn9w9VQSFSbSzx0pAN Ie5jPOWzSZrSG8sdxgHHaJzDSo432VlzKowLn5EEGzJY2wSE6pte4nf21dXdTUMZ1i6i iWsYz4R+ZvGN038rpdd5H8Rg8TP5RyM60p4Y9qJB4hgzOVXDAe9Wl91MyJExmvl22aUQ 8Z7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733735986; x=1734340786; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qs0tuaBR1LZn4Tivt/qSil2WOtfaaAJgBLjyaQnCXNk=; b=N/TA/ABKP3HPMSIiIrSlFOwKhMiV9lNgh4UmRiklpLNcn3j1OmU0YzcnXkWIhdenxW 8Gy1GwC4xRo+X6JfcZrKW6Ayp8Lkkb6Zc4u5uwMlHCks4FRszZ0kzMGiJe8PFcnjrGM8 cPALu5tcXz8Tsnj1YFqMkfiInQHqkFe9p+XwlUAAE9Nq7jYwmB5n9qSinnGdj1r3S9C3 fOIil7UlwxH8J0CoHO44ZN8XwYhWfATePi1XgEBH0ajL6PYAfdsfxil9jS7l0u4qSKkj F3ARs18pta3uJvtVJFOutYexM0RqXwrQ22VJrEfA0pJ+Uu2MZC5rVoMC8wTodH6Zv664 fhLg== X-Gm-Message-State: AOJu0Yy+nn0UfPMuLTmH3fWXFoQ/hfjedP6RPUziammbWxiDKHtuloG3 9FU6gK+DlxD4XB9Pl5mFZMMQ6U4I5nxi/6RTBNANE/YA0XLMRYuEOa0nPVO0XkHEyIg/WVxcnlB pMySsFKDvtPHNUdFrUAZcB7ZtasXpg4uM X-Gm-Gg: ASbGncsRpgsL7PcwVVXZCXgrhxSV06eorDu4WLlyY92mCOJxlraE+BtZcw6dZtFCQVL BK6YQrW5e3iZ2WZyLE1KHWvKVIH5gAhMrtQ== X-Google-Smtp-Source: AGHT+IHsmW+r81lyhJrUmYD+eEf9QTbKhX6bDJmlZD7Ey7p34YvqfVC6xVCyKPLnRwtR3pMeihRcREPCM7mHx5wRqyw= X-Received: by 2002:a05:6000:1565:b0:385:f195:26f with SMTP id ffacd0b85a97d-3862b350c2fmr7915981f8f.19.1733729672926; Sun, 08 Dec 2024 23:34:32 -0800 (PST) MIME-Version: 1.0 From: Michael Harris Date: Mon, 9 Dec 2024 18:34:22 +1100 Message-ID: Subject: FileFallocate misbehaving on XFS To: PostgreSQL-development Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello PG Hackers Our application has recently migrated to PG16, and we have experienced some failed upgrades. The upgrades are performed using pg_upgrade and have failed during the phase where the schema is restored into the new cluster, with the following error: pg_restore: error: could not execute query: ERROR: could not extend file "pg_tblspc/16401/PG_16_202307071/17643/1249.1" with FileFallocate(): No space left on device HINT: Check free disk space. This has happened multiple times on different servers, and in each case there was plenty of free space available. We found this thread describing similar issues: https://www.postgresql.org/message-id/flat/AS1PR05MB91059AC8B525910A5FCD6E699F9A2%40AS1PR05MB9105.eurprd05.prod.outlook.com As is the case in that thread, all of the affected databases are using XFS. One of my colleagues built postgres from source with HAVE_POSIX_FALLOCATE not defined, and using that build he was able to complete the pg_upgrade, and then switched to a stock postgres build after the upgrade. However, as you might expect, after the upgrade we have experienced similar errors during regular operation. We make heavy use of COPY, which is mentioned in the above discussion as pre-allocating files. We have seen this on both Rocky Linux 8 (kernel 4.18.0) and Rocky Linux 9 (Kernel 5.14.0). I am wondering if this bug might be related: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1791323 > When given an offset of 0 and a length, fallocate (man 2 fallocate) reports ENOSPC if the size of the file + the length to be allocated is greater than the available space. There is a reproduction procedure at the bottom of the above ubuntu thread, and using that procedure I get the same results on both kernel 4.18.0 and 5.14.0. When calling fallocate with offset zero on an existing file, I get enospc even if I am only requesting the same amount of space as the file already has. If I repeat the experiment with ext4 I don't get that behaviour. On a surface examination of the code paths leading to the FileFallocate call, it does not look like it should be trying to allocate already allocated space, but I might have missed something there. Is this already being looked into? Thanks in advance, Cheers Mike