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 1qVMWo-00H7mk-EI for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Aug 2023 01:37: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 1qVMWl-00C8Dl-UI for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Aug 2023 01:37:52 +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 1qVMWk-00C8DX-3N for pgsql-hackers@lists.postgresql.org; Mon, 14 Aug 2023 01:37:51 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qVMWh-002G5o-8t for pgsql-hackers@postgresql.org; Mon, 14 Aug 2023 01:37:49 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 44C9932008C0; Sun, 13 Aug 2023 21:37:45 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 13 Aug 2023 21:37:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1691977064; x=1692063464; bh=9A f2C9Po+DXcp1GGQhyfODACCIJmYzQz9lCXoK3BnhI=; b=e7RCKkXIsL39fqYP5f VbzouURsyGNOb/HBEUGpDdF3oDwbpvi8OGRtRcFfhcSqPPhWpI5Goygq8GGq65oN aFHou9UOr9Gkqc0iEu9vDpT0jrAw49AKhV4jIO2aXZXzHeUk0tyCVe9H8Hu260rz kMsq0Ed3hSYFTfb3lg0wxNQHyBlp9d4niJY0WelPMe3wamR3FMHMft/kOu6kaMAN 4u8/2DTJMX6QZVmDoJtpi/ZAkrHtpZbekNCuUsEa2oCkfRP2EMJBhkrt4mevxmAU eIJwx2QnYe5XyBgIJqFXF09JZmBerdJIiQkiFg2LnBHrSCSULvfH5veTEKvCwfbY KYOw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1691977064; x=1692063464; bh=9Af2C9Po+DXcp 1GGQhyfODACCIJmYzQz9lCXoK3BnhI=; b=GN/2/ROBYVbFlIuYvf/6pm+1UKvc8 k+Mc+w3EO/Nz4I8gpl8AQlQd946f8MaaH4bUwlTk2eD88fj20DQLzbzWB+/roSre NP4QuoViNhMr5qd7PuABkmlXpFN7RK2ZoJQ8wZ+w8rkGXb6tJiGbKCmsOWtNZFhe zNpV9DqmsTUQFlkPigwodGgIns7aUafP9lZQ4dlY3TIX7e4ptpxj9FwKv1EZSrlC pnxRZQEgdnWCmWP6n4goppWqSDNbRLvpLYb34qT50Id1K+EIqMe7WXQxtIzYh2rU f4Hz1HOaPQ3OrbleY3VTDic8WyApFU9IUrl8ZYMoI7Qrv8mD/DkFr2whA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedruddtfedggeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 13 Aug 2023 21:37:43 -0400 (EDT) Date: Mon, 14 Aug 2023 10:37:37 +0900 From: Michael Paquier To: Noah Misch Cc: pgsql-hackers@postgresql.org Subject: Re: pg_waldump vs. all-zeros WAL files; server creation of such files Message-ID: References: <20230813031531.GC2326466@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="3oiRuYNSWyQkNnfb" Content-Disposition: inline In-Reply-To: <20230813031531.GC2326466@rfd.leadboat.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --3oiRuYNSWyQkNnfb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Aug 12, 2023 at 08:15:31PM -0700, Noah Misch wrote: > The attached 010_zero.pl, when run as part of the pg_waldump test suite, = fails > at today's master (c36b636) and v15 (1bc19df). It passes at v14 (5a32af3= ). > Command "pg_waldump --start 0/01000000 --end 0/01000100" fails as follows: >=20 > pg_waldump: error: WAL segment size must be a power of two between > 1 MB and 1 GB, but the WAL file "000000010000000000000002" header > specifies 0 bytes So this depends on the ordering of the entries retrieved by readdir() as much as the segments produced by the backend. > Where it fails, the server has created an all-zeros WAL file under that n= ame. > Where it succeeds, that file doesn't exist at all. Two decisions to make: >=20 > - Should a clean server shutdown ever leave an all-zeros WAL file? I thi= nk > yes, it's okay to let that happen. It doesn't hurt to leave that around. On the contrary, it makes any follow-up startup cheaper the bigger the segment size. > - Should "pg_waldump --start $X --end $Y" open files not needed for the > requested range? I think no. So this is a case where identify_target_directory() is called with a fname of NULL. Agreed that search_directory could be smarter with the files it should scan, especially if we have start and/or end LSNs at hand to filter out what we'd like to be in the data folder. -- Michael --3oiRuYNSWyQkNnfb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmTZhWEACgkQnvQgOdby QH3ipBAApaVgVd/Z2uISnUmXVBdMnxpXQh7DxRoCNtDKsFwMQA8RqhdTPKVZDAp6 b1o6q0xSCvKi9aJs6s9LbLb+Nok5v7ZiipA83LsYy5VzImHd757Ix+VPQN911r2P i/3rlT0WSDq9wCvGnob7YflCHgtZ7djWkwZbMox8txAO4bHe+0WusZCidp/8h99I fgpFoc23F8HDNxkeMPhZUOkS19wVBUdBguabcRaFqjxv9vB3TcXYr4GKLiPb4j1O ufGbBne01Ppo7+z9apeaJsSahGZfNlwLBYEXFk772MReMD2107Ue4yTFftsdlxWC 91OKrZuIBedQqQvMtbgFxQFEworQsyOHrs2TUgnMMDClBIWeuF2uIpkd4G5Xiu4o eY3OAhWgcfPR8gibsMrf5Okv730lncLnPzWcW9EHoWHqZ5Fsj3zhq0XyLxzSYBdY HtXyifVZjtOLxJT5iU7iM5X8GVYwp1fJu/5dOsuIZVXlRh2BvO2uhcBCl5olQ4vn Ke9PHOL6j3znUitgzdgjfOnRzp/rGfsDYJvJ2YXmnw/IoVWZM6tazVyDsElR4tzN ZJ7yoMdDwl3JJQoPUzkgEEHKdChkRu44M004a62qcB90haAFwHfyDG/TmFm5mWsj PMQEmo7be5kMaVsRa3C/j+9Ob66WVYcgXiYDY58YR1bIr400Wzg= =AEsq -----END PGP SIGNATURE----- --3oiRuYNSWyQkNnfb--