Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p7xZ8-0008Jv-J2 for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Dec 2022 11:47:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p7xZ7-0001vF-En for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Dec 2022 11:47:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p7xZ7-0001v4-6G for pgsql-hackers@lists.postgresql.org; Wed, 21 Dec 2022 11:47:17 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p7xZ4-0007eF-KC for pgsql-hackers@postgresql.org; Wed, 21 Dec 2022 11:47:16 +0000 Received: by mail-lf1-x132.google.com with SMTP id cf42so23138519lfb.1 for ; Wed, 21 Dec 2022 03:47:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=gD9n1ec7yJg33p29DhboH/BqJrMrNy4wdLYpqir2S7o=; b=p9NT2Fm7eUrJ/jPGDXnvWRSSGPGau8kzPWUk2q8xvCuU7mcfNjMmPN/Itqz28AZUmM fZrdcXjR53Bl7YFFtSN70tn0CjkANchOVZ+vVo5lszSs3k4gmYaNeG8VAIHEePPgykMv czSSCegnWRN5Gll3ktgi9Dr6L1UcFiLr4ZeSGnafqQIuG3BIJxWr6uPQTmQPMpJUZ9Uu 0txAQt/I9XcpejXyzohfrm956vA4n2/bJICzOkhCWVBttzlP8J7VfjMVVB5s9kQ0TryC BFXbpMXn3zMXcaEUngW3BoJXNjxjJT+GNpeE8dzTtJ/5Dyf8f+ab2Y8AeokrT2nGb8Of eRdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gD9n1ec7yJg33p29DhboH/BqJrMrNy4wdLYpqir2S7o=; b=L08Iaorm7szCW1CSwnqVcOXJj7w6BiZGN98QxMlNjBIt25HlwLcffM9+N3wnHEHxyZ oCdyAGD9K6ZK2GTIFqN7yGFVz2ikaNQYZq9fTWKLyMWbP8Qt7VxnPTJnww02QrjI6qwI il2TAm/zM5ZJhdynSJLSy7v2AveMUUcdmNOwwAvqPsEbqNKHKN5lADLEg9rYTyzXJt+U 1tltQk9mZTQvN5SisbYWQvtQKootg/tKXk7K2C/flYm53vLOGayTjO5/yMvQPOQd2Hqf HXwFyIg0V3tNFnScTszk6m69BLLOv70z4gzLqMC2i7xly+4feyLSB3/eB3hEF0o5QTQC MYfQ== X-Gm-Message-State: AFqh2kqQ0MW6N2TW0DLxbMQjK1+Td9KhdjGBTcvXVS8xbDPpuoLdWV1r 6CnnhE/DwTR/cK8wp+OZL02Tk65Tn9C59RE7TIz2P1sAw6g= X-Google-Smtp-Source: AMrXdXtnyTmhEp1Fkg+zlyC5M9c+NvfY1YB+1fiO+xWYEjkCCNx9dgiF9DzCuIWBJmFuKHSVELH8vdF1My5jnRPlv38= X-Received: by 2002:a05:6512:4c3:b0:4b5:7fde:9568 with SMTP id w3-20020a05651204c300b004b57fde9568mr196548lfq.139.1671623233967; Wed, 21 Dec 2022 03:47:13 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Bharath Rupireddy Date: Wed, 21 Dec 2022 17:17:01 +0530 Message-ID: Subject: Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL To: David Christensen Cc: Michael Paquier , Justin Pryzby , Ian Lawrence Barwick , Matthias van de Meent , pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Dec 16, 2022 at 4:47 AM David Christensen wrote: > > On Thu, Dec 15, 2022 at 12:36 AM Michael Paquier wrote: > > > > On Wed, Dec 14, 2022 at 04:44:34PM -0600, David Christensen wrote: > > > I can get one sent in tomorrow. > > This v10 should incorporate your feedback as well as Bharath's. Thanks for the patch. Here're some minor comments: 1. +my $node = PostgreSQL::Test::Cluster->new('primary'); Can the name be other than 'primary' because we don't create a standby for this test? Something like - 'node_a' or 'node_extract_fpi' or some other. 2. +$node->init(extra => ['-k'], allows_streaming => 1); When enabled with allows_streaming, there are a bunch of things that happen to the node while initializing, I don't think we need all of them for this. 3. +$node->init(extra => ['-k'], allows_streaming => 1); Can we use --data-checksums instead of -k for more readability? Perhaps, a comment on why we need that option helps greatly. 4. + page = (Page) buf.data; + + if (!XLogRecHasBlockRef(record, block_id)) + continue; + + if (!XLogRecHasBlockImage(record, block_id)) + continue; + + if (!RestoreBlockImage(record, block_id, page)) + continue; Can you shift page = (Page) buf.data; just before the last if condition RestoreBlockImage() so that it doesn't get executed for the other two continue statements? -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com