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.96) (envelope-from ) id 1vLdQY-005ghu-0C for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Nov 2025 08:20:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vLdQW-00BSU3-1g for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Nov 2025 08:20:32 +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.96) (envelope-from ) id 1vLdQW-00BSTv-0e for pgsql-hackers@lists.postgresql.org; Wed, 19 Nov 2025 08:20:32 +0000 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vLdQS-000KFt-0P for pgsql-hackers@lists.postgresql.org; Wed, 19 Nov 2025 08:20:30 +0000 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-37b935df7bfso53200971fa.2 for ; Wed, 19 Nov 2025 00:20:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1763540426; x=1764145226; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=i6vLFqeE37PsxHGxQvXXvE5R+fS7vKhwChZZv7RH4kw=; b=JWxEscp1s6vdWF3AvT2C57UxvPMe0mEol+adq3tv0Znnw5liXcB+Bq2mFtU57BIWjr 4AbjAI4lHU4+UbPxiTvULbfj3imfa6NOy8LCY78GrexEq71UQM0HFkoj6DXc6JxqNG9e GFxOjAa2t1sJjwuGaN2nfVzP5SE++gzHW/5lvNouziYIMzAut1NNB1f8IoxFki8udCzJ dPVbbWkPDcyFr4URJ6WtDESdWdVkkyleZ2oYoiENe6oVkssktKyjFsElIHkIJpVMhr+u KsIj1W/WEPhD5EYBxxhhLoSHE5+l6lUq2eba971dyhEPm09WUMfZ+7Xukxv/O/I6nia0 u0lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763540426; x=1764145226; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=i6vLFqeE37PsxHGxQvXXvE5R+fS7vKhwChZZv7RH4kw=; b=jB0OCRCqvc6flhrZ47YGlZ4fUwBtbummGMPgWuyCAfQ0ULly5zof3beO0vi3D9xHII F1z4MkXmER+QF/C+JTBI9ofeZkje4qyaX2hzmM49Aw9iux6AUVk06KA06MQFPtDxpHx6 3OSoQ7Y33OEJM7IN2XwjZpbwZk/NtFDSksQE1dORpBMViSa5InNSkk8iXfmYXtqzNq3/ 59NAGdKaVvURzcbIIAY1uoBCv+HWS2aicxfbBxqDUae49UkVosbZvdBwunk+SeKIAnXW rJHUPUosNbSG4gsHVBGWDmGs9eB1tm0lw85QDsWV20us7joYRPKX5j1Q6wIRZvajXOsc ofwg== X-Forwarded-Encrypted: i=1; AJvYcCVJLXWSSMNbVFC0xUS1PmTxSAx7FnnrKd73Fi0BbHekUhzPJu4Ad2FU8Tx8CClHJYsQP5jhtMX/nrABenS7@lists.postgresql.org X-Gm-Message-State: AOJu0Yyj7UYGs5dAnnpoQk0gYQ1v18WLOGh3v2ayL8QjVJD32lvi6Grl 63rOuwyrNcHEkLH28F9ZbD2wXIZTVKDeGlg6FmwXjX3sk8fxCj7L2xXT6Ja4NW/1a0q+bPl91S6 qNLv0Pg2SwFWrpOfckceIxffh8GiNy1VWPbREJxDT X-Gm-Gg: ASbGncvAhVtRjPGzBn6zBuKiMlYk0V8hGK9kCZOHZ+B+28Pv1GG4jcl2Mlkqe87Jtp1 c+XJwsxnkDieVUiatbZeVxsPjrKmPd6QL9mfb1NI4oz5VkOU3iH5FAMU+wt1I7Qebgn/vnHFaPB 8/XqphWp4U/ipOTyLH4R4i3PAG4QW8CB2GaYTh2XMJqsPVUbIvmn5N2HxLyW1KkDwLWTZbaqJO6 z5rchLEK0LvIm0k8F+KnTXYai8hju2qneHZCYixYA5JhNFOQMcZYtELXfjlWAuiWBapWnAYDm7T 7oc8 X-Google-Smtp-Source: AGHT+IG2xFGikB3Xj3TFanY4dIiRbUrY81qw+hDoEZdFGuDYuxDX4SvnSrNJ3NsQF+wOI/8jkf9oAh+s7fXYX1l7rlw= X-Received: by 2002:a05:6512:12c7:b0:594:5000:4554 with SMTP id 2adb3069b0e04-59604e3fdecmr498652e87.28.1763540426055; Wed, 19 Nov 2025 00:20:26 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jakub Wartak Date: Wed, 19 Nov 2025 09:20:14 +0100 X-Gm-Features: AWmQ_bn0Wc2K8G1x85-3gzdO7BzrGHYKOmo1gvJk4Xm6xFsmOxIrCYn6pjSTOcM Message-ID: Subject: Re: pg_waldump: support decoding of WAL inside tarfile To: Amul Sul Cc: Robert Haas , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Nov 17, 2025 at 5:51=E2=80=AFAM Amul Sul wrote: > > On Thu, Nov 6, 2025 at 2:33=E2=80=AFPM Amul Sul wrote= : > > > > On Mon, Oct 20, 2025 at 8:05=E2=80=AFPM Robert Haas wrote: > > > > > > On Thu, Oct 16, 2025 at 7:49=E2=80=AFAM Amul Sul = wrote: > > > [....] > > Kindly have a look at the attached version. Thank you ! > > > > Attached is the rebased version against the latest master head (e76defbcf= 09). Hi Amul, thanks for working on this. I haven't really looked at the source code deeply (I trust Robert eyes much more than mine on this one), just skimmed a little bit: 1. As stated earlier, get_tmp_walseg_path() is still vulnerable (it uses predictable path that could be used by attacker in $TMPDIR) 2. On the usability front: a. If you do `pg_waldump --path pg_wal.tar -s 0/31000000` it will dump a lot of WAL records and then print final: pg_waldump: error: could not find file "000000010000000000000034" in archiv= e However, with `pg_waldump --path pg_wal.tar -s 0/31000000 --stats=3Drecord` (not passing '-e') it will simply bailout without printing stats and with error: pg_waldump: error: could not find file "000000010000000000000034" in archiv= e IMHO, it could print stats if it was capable of getting at least 1 WAL reco= rd. 3. The most critical issue for me was the initial lack of error pass-through from pg_waldump (when used with WALs in tar) to the pg_verifybackup. Now it works fine, so thanks for this: a. pg_waldump is capable of discovering missing WALs as requested and throwing proper return code (good) $ /usr/pgsql19/bin/pg_waldump --path pg_wal.tar -s 0/31005F70 -e 0/343D2650= -q pg_waldump: error: could not find file "000000010000000000000034" in archiv= e $ echo $? 1 $ b. pg_verifybackup now also complains properly with missing WAL inside tar $ tar --delete -f pg_wal.tar 000000010000000000000032 # simulate loss of fi= le $ tar -tf pg_wal.tar 000000010000000000000031 archive_status/000000010000000000000031.done archive_status/000000010000000000000032.done 000000010000000000000033 $ grep Start-LSN backup_manifest { "Timeline": 1, "Start-LSN": "0/31005F70", "End-LSN": "0/333D2650" } $ /usr/pgsql19/bin/pg_verifybackup -P /tmp/basebackup/ 791372/791372 kB (100%) verified pg_waldump: error: could not find file "000000010000000000000032" in archiv= e pg_verifybackup: error: WAL parsing failed for timeline 1 $ echo $? 1 $ -J.