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 1pD55V-0007u3-Cq for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Jan 2023 14:49:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pD55T-0008Jo-VQ for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Jan 2023 14:49:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pD55T-0008Je-KY for pgsql-hackers@lists.postgresql.org; Wed, 04 Jan 2023 14:49:51 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pD55R-0000mS-1L for pgsql-hackers@lists.postgresql.org; Wed, 04 Jan 2023 14:49:50 +0000 Received: by mail-wr1-x42f.google.com with SMTP id z16so16734937wrw.1 for ; Wed, 04 Jan 2023 06:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=1tLeW1qTvV9+qF6eOhNk+0mJblgcw/nsWeLWN7EmbG0=; b=dl8KdJAjiIxhJXVbvMPc33sUnsctyCtTBuZLVyEv5cu8p533kco4eNQOgikE+xmj6d tqkvkM0BY2eG+XCvCWNo+7mjWY6FInhb6IYoMvFFXwwUvxhgIe2UfigjU9ZdkR8u3kxP DUO/t82ROYQhUNeQEn1f/keP56vyoHnUFr5tz3SxGu+bU9n0GQigDktpra3nRzgCLueX UCoZuEvRsHzKKiJMStFcZrmAWpJNtUoR2MG/Sq6x5Si/xqPIFWmscBfYogN5rt3yF1b9 jxXdzsyUrBRZIiE+SXn+Tku4/v959cyRrODjSAYZLB3wMp1M2rfpHkrOZJf5i/sytw7V HB1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1tLeW1qTvV9+qF6eOhNk+0mJblgcw/nsWeLWN7EmbG0=; b=2iNgCYVU6W2xLgBR4pU/Ds/kuSp90IDgqZugso94w64F5vAqixSUDY++jjP0bDGRrh UI4jQzRKKZTg1YizXm0CoR664nxRDARvp05P26BQkfEhMn09X3fgerNyZt7YkWSZEdbv +XpudQwdzwD/5Rd6qf9wgpJups2hzr07azQqeq7fTewtVW7b/zzcf23blXYk4PMHjAoF nuulAeVb1Ecap98RllIT3lrPezO+F/PId6B71LYyX3zPUTQhqF4/380W8fcvaqmUTn4s 00u1cga0iro0MZNeXK0opm82tJil+qhNvfVqrOxwRDLZIUy55CTmMVpxQkHWab9CBJ/Y ucKQ== X-Gm-Message-State: AFqh2kphVEWLgd+X5XiJ/F9lMuaxFwlkyC7XD1QOnSQ14GxLNk1cw2K2 JRyU9uiGQT6q2ro+0yDqhjc= X-Google-Smtp-Source: AMrXdXu0asw3rZ2BkEDXB3Q/8FWJuwRNTe9QCqwSFz1h5/vLBPTxm0DVc83VyXo104Ivtwax35UDnQ== X-Received: by 2002:a05:6000:18ca:b0:244:48b3:d138 with SMTP id w10-20020a05600018ca00b0024448b3d138mr27545154wrq.54.1672843787253; Wed, 04 Jan 2023 06:49:47 -0800 (PST) Received: from [192.168.5.162] ([54.239.6.189]) by smtp.gmail.com with ESMTPSA id e13-20020adfe7cd000000b0027f9f073211sm25331894wrn.65.2023.01.04.06.49.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Jan 2023 06:49:46 -0800 (PST) Message-ID: Date: Wed, 4 Jan 2023 15:49:45 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: Add a new pg_walinspect function to extract FPIs from WAL records Content-Language: en-US To: Bharath Rupireddy , PostgreSQL Hackers References: From: "Drouvot, Bertrand" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 12/27/22 12:48 PM, Bharath Rupireddy wrote: > Hi, > > Here's a patch that implements the idea of extracting full page images > from WAL records [1] [2] with a function in pg_walinspect. This new > function accepts start and end lsn and returns full page image info > such as WAL record lsn, tablespace oid, database oid, relfile number, > block number, fork name and the raw full page (as bytea). I'll > register this in the next commitfest. > > Thoughts? > I think it makes sense to somehow align the pg_walinspect functions with the pg_waldump "features". And since [1] added FPI "extraction" then +1 for the proposed patch in this thread. > [1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=d497093cbecccf6df26365e06a5f8f8614b591c8 > [2] https://postgr.es/m/CAOxo6XKjQb2bMSBRpePf3ZpzfNTwjQUc4Tafh21=jzjX6bX8CA@mail.gmail.com I just have a few comments: + +/* + * Get full page images and their info associated with a given WAL record. + */ What about adding a few words about compression? (like "Decompression is applied if necessary"?) + /* Full page exists, so let's output it. */ + if (!RestoreBlockImage(record, block_id, page)) "Full page exists, so let's output its info and content." instead? + + Gets raw full page images and their information associated with all the + valid WAL records between start_lsn and + end_lsn. Returns one row per full page image. Worth to add a few words about decompression too? I'm also wondering if it would make sense to extend the test coverage of it (and pg_waldump) to "validate" that both extracted images are the same and matches the one modified right after the checkpoint. What do you think? (could be done later in another patch though). Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com