Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dHnIm-0006UB-Kh for pgsql-bugs@arkaria.postgresql.org; Mon, 05 Jun 2017 08:23:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dHnIm-0002Pd-2W for pgsql-bugs@arkaria.postgresql.org; Mon, 05 Jun 2017 08:23:52 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dHnIl-0002PT-Gp for pgsql-bugs@postgresql.org; Mon, 05 Jun 2017 08:23:51 +0000 Received: from mail-lf0-x236.google.com ([2a00:1450:4010:c07::236]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dHnIh-0006uI-G7 for pgsql-bugs@postgresql.org; Mon, 05 Jun 2017 08:23:50 +0000 Received: by mail-lf0-x236.google.com with SMTP id v20so35183518lfa.1 for ; Mon, 05 Jun 2017 01:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=6dH2XvNM48sGJO+4mZI8OlB2isGkjhv4mVpEGyuOpyk=; b=NAt6MStvYoEXZ/l0LqKtqnhBygTMCaSC0R0G8CwQZWpP8LDpzkechNPid5hYdq2xYx rI3+uhZSrfZVJaTrZwQtqx08AiYxv1NiOvazsm2Y/2mA5QfD1x9lnndhoTcQckb09GF5 YQnGiyYHF79RTB7mt7kRLJ5l2Cn54jsdSfXfXgOkq928MdynaqRQFcTG9LtWtlnYo94f ufPYJomhyit6DybrCBLqPfeFc3yZ6slwMyD8H159xwbZ6JTCoViKNnfHMreWy+Qosa50 ld5mGaQknurnyUrzE0Ax56aM8Gq+Oq6KY3haQpa9r87oeNFzEnuy/keS5yENUa3V4iFW bRAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=6dH2XvNM48sGJO+4mZI8OlB2isGkjhv4mVpEGyuOpyk=; b=nIA/Tj1uS0VE500q1vMGKnCiozBv3R1IOIqxBInHbCXKopr6BENjqUIWT8hdusISTE IVqFO7qIBF5exGGA74sWGXLnJqY/Y/+VJHDXZKdDFyczHgWOIMTbNvRXqeMDUL208Yrv /mrZmQfqgmYUvUo2bfdBWdypYKFKx8obocWfzDNeoRkdokhslU6XH4Cwap7k4vuQuwVK UWtlJ+a3enpxgu/H+xV3PiI8s2CcEnuZ5hn1JIvL0yvKZfpm7c3p9BXjckBhWVDBmbgG 68+AfEQytYQI1aWuTX5sL9Tw5fvz2sJ8eGXkIDyJIpSNTBDK1jsME3T4qqA+6196/C1J 9K/w== X-Gm-Message-State: AODbwcBv+kWwnITqeYWl/71jjUddVCTFHh1mJCCpXc+19A8KjoZJfwOH F0WW41XqOw0r8daI X-Received: by 10.25.31.9 with SMTP id f9mr4750039lff.160.1496651025288; Mon, 05 Jun 2017 01:23:45 -0700 (PDT) Received: from [192.168.1.99] (dsl-hkibrasgw1-50df7f-241.dhcp.inet.fi. [80.223.127.241]) by smtp.gmail.com with ESMTPSA id 3sm6924011ljb.60.2017.06.05.01.23.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jun 2017 01:23:44 -0700 (PDT) Subject: Re: BUG #14687: pg_xlogdump does only count "main data" for record length and leading to incorrect statistics To: Andres Freund References: <20170603165939.1436.58887@wrigleys.postgresql.org> <20170604231012.rkhlpf5hqiiszwmb@alap3.anarazel.de> <20170605022511.imow2t2ojsbauk72@alap3.anarazel.de> Cc: pgsql-bugs@postgresql.org, chjischj@163.com From: Heikki Linnakangas Message-ID: Date: Mon, 5 Jun 2017 11:23:43 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170605022511.imow2t2ojsbauk72@alap3.anarazel.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 06/05/2017 05:25 AM, Andres Freund wrote: > Hi Heikki, > > On 2017-06-04 16:10:12 -0700, Andres Freund wrote: >> On 2017-06-03 16:59:39 +0000, chjischj@163.com wrote: >>> Currently, record length in pg_xlogdump/pg_waldump's output only count >>> length of "main data", >> >> Good catch! Will fix. > > I notice that this seems to originate in > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=ebc2b681b8ffa597137aa7a19619e6a21176e928 > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=2c03216d831160bedd72d45f712601b6f7d03f1c > and that it's not just stats, but also plain xlogdump displaying wrong > data. > > Do you see any better way to get at the !fpi len than to iterate over > the blocks and sum up the image length? It's not really accurate to > display len (rec/tot) as total-fpi, total, but I don't have a better > backward-compatible idea? Actually, I don't even have a better idea for > master, so maybe it's ok as proposed? Your patch seems OK to me. Defining non-FPI size as (total_len - fpi_len) seems correct to me, I'm not sure what other definition you could have. > + /* > + * Calculate the length of the record as the total length - the length of > + * all the block images. That's commonly more accurate than just using > + * XLogRecGetDataLen(), because that's only the main record, not per-block > + * data registered wity XLogRegisterBufData(). > + */ s/wity/with/. But I would leave out the whole sentence starting with "That's commonly more accurate ...". Using XLogRecGetDataLen() would be (and was) just plain wrong. - Heikki -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs