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 1nSE3q-00018X-Hw for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Mar 2022 08:22:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nSE3p-0002dr-DV for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Mar 2022 08:22:13 +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 1nSE3o-0002di-Vu for pgsql-hackers@lists.postgresql.org; Thu, 10 Mar 2022 08:22:13 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nSE3m-0006ZI-3t for pgsql-hackers@lists.postgresql.org; Thu, 10 Mar 2022 08:22:11 +0000 Received: by mail-pf1-x434.google.com with SMTP id z15so4476859pfe.7 for ; Thu, 10 Mar 2022 00:22:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20210112.gappssmtp.com; s=20210112; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=afugNmzN4Quik255bubERkpBAjBYOWA7ERt41MTOj8E=; b=aQknVd0p/Z/OCvKPodY9JZKSfDJR77QW+7SOnKqGR3zvq1YKQU0p5Uj/ktV/ZKLDIE D8ulauXG/sns4FiTWJ2yAemBTdGwu2hcE+bXS6Jf96qa0UhLnugD8732eCMo0o0LccHq kJTUiL5QCMC1aIq4rXaBQyaZxy0LU1IltEX/J6FtyzswxHIyX8bXXUXEF1EsmsN6q9e0 1zkWrGIZ0KgL1yS2/Pp2jIJpOVtwWJ8fB7tsLjI8CV0xrZb/8ApdcVllMlCvUUXcdtvB 9jxSu3OdYtVp0eb4pHZhHK+d6koxNlgQIBhChvnWtZFAr/O4cCPvO5//HnOYGfcsLDAo FyMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=afugNmzN4Quik255bubERkpBAjBYOWA7ERt41MTOj8E=; b=f2ZiMhIjSBhM5MM+igOE/Gn6lSIS/xYBDBY7VADIjc4QaQ/E7JD2PflJZgGMm7G4Zl 7fzK0HxCaKtaeAEblgJoHstD2uMGp3NTNAgRF2PJC/XYlANOlYTOHOS5U4w12dnXPLIp 9sQGxiIx/b++uzEAxuzaA4xWhIsc42n5JHbUsU4jbsL7mkVggZ2dxOcsatyNnB7y8MsJ ZlV2HcfJV9vtPWld/Sj0N8idIiN+bnPKGEcDIkr5Qadlx8x60M2Xif58mNz2wkP69H/z OyEUWNuV+vqZZPmLWw5gzKk0WM0AeokK05/0eckzxs+SFXRL/L5pOr/rjFuS6ACy7Jao fSog== X-Gm-Message-State: AOAM532U249k6B4Y2bJ7jfUEchkQwGtJQTCWOahnsW4U8RZg8SjU+R+o 0qjY3JfCoLbv8EKGN030RzFrbw== X-Google-Smtp-Source: ABdhPJxSX1YLEkZahEOD9fTQjyc2gNUVAISZQrH409sn3guxf0WRr5Kn1PbZmvdcSOMdAB1cS/3ihg== X-Received: by 2002:a63:1c7:0:b0:37c:4e86:25e9 with SMTP id 190-20020a6301c7000000b0037c4e8625e9mr3139717pgb.550.1646900528881; Thu, 10 Mar 2022 00:22:08 -0800 (PST) Received: from jdavis.lan (c-73-231-146-4.hsd1.ca.comcast.net. [73.231.146.4]) by smtp.gmail.com with ESMTPSA id y34-20020a056a00182200b004f71c56a7e8sm5869857pfa.213.2022.03.10.00.22.06 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Mar 2022 00:22:07 -0800 (PST) Message-ID: <39c13407c8b7311e9a3b24f2df814696bfa2ebff.camel@j-davis.com> Subject: Re: pg_walinspect - a new extension to get raw WAL data and WAL stats From: Jeff Davis To: Bharath Rupireddy , Ashutosh Sharma Cc: Andrew Dunstan , Robert Haas , Greg Stark , Jeremy Schneider , Bruce Momjian , PostgreSQL Hackers , SATYANARAYANA NARLAPURAM , marvin_liang@qq.com, actyzhang@outlook.com Date: Thu, 10 Mar 2022 00:22:05 -0800 In-Reply-To: References: <20211005220707.GC24555@momjian.us> <47c04e88-7df8-963c-e32e-491260a09691@ardentperf.com> <20211006004310.GE24555@momjian.us> <9186c1cd-04b6-3dc9-40c5-5977dd854e36@ardentperf.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2022-03-02 at 22:37 +0530, Bharath Rupireddy wrote: > > Attaching v6 patch set with above review comments addressed. Please > review it further. * Don't issue WARNINGs or other messages for ordinary situations, like when pg_get_wal_records_info() hits the end of WAL. * It feels like the APIs that allow waiting for the end of WAL are slightly off. Can't you just do pg_get_wal_records_info(start_lsn, least(pg_current_wal_flush_lsn(), end_lsn)) if you want the non-waiting behavior? Try to make the API more orthogonal, where a few basic functions can be combined to give you everything you need, rather than specifying extra parameters and issuing WARNINGs. I * In the docs, include some example output. I don't see any output in the tests, which makes sense because it's mostly non-deterministic, but it would be helpful to see sample output of at least pg_get_wal_records_info(). * Is pg_get_wal_stats() even necessary, or can you get the same information with a query over pg_get_wal_records_info()? For instance, if you want to group by transaction ID rather than rmgr, then pg_get_wal_stats() is useless. * Would be nice to have a pg_wal_file_is_valid() or similar, which would test that it exists, and the header matches the filename (e.g. if it was recycled but not used, that would count as invalid). I think pg_get_first_valid_wal_record_lsn() would make some cases look invalid even if the file is valid -- for example, if a wal record spans many wal segments, the segments might look invalid because they contain no complete records, but the file itself is still valid and contains valid wal data. * Is there a reason you didn't include the timeline ID in pg_get_wal_records_info()? * Can we mark this extension 'trusted'? I'm not 100% clear on the standards for that marker, but it seems reasonable for a database owner with the right privileges might want to install it. * pg_get_raw_wal_record() seems too powerful for pg_monitor. Maybe that function should require pg_read_server_files? Or at least pg_read_all_data? Regards, Jeff Davis