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 1wwt3B-002Ger-23 for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Aug 2026 03:02:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wwt3A-006xOs-0z for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Aug 2026 03:02:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wwt39-006xOj-2d for pgsql-hackers@lists.postgresql.org; Thu, 20 Aug 2026 03:02:39 +0000 Received: from mail-yx1-xb129.google.com ([2607:f8b0:4864:20::b129]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wwt37-00000001UdO-2FGo for pgsql-hackers@postgresql.org; Thu, 20 Aug 2026 03:02:38 +0000 Received: by mail-yx1-xb129.google.com with SMTP id 956f58d0204a3-66c70f05859so3009473d50.1 for ; Wed, 19 Aug 2026 20:02:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787194956; x=1787799756; darn=postgresql.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=VzqTdKFj3jhC3Jdg1ZvONiDjywjA9OTIZm681XpG7SU=; b=Zc7CuJGo8fGAnXGY+QHVclZ/CkVDIgpEuvPwMBlfkAfIHjuapM9EV6Bpjl2NQ+RduC dTjWSRNwqHxOmHHxCYBlkDy7FGKxjsql/94C7ChGFEDIb3tH5kLsq0bmLfFQHxBqITSg GZY6FmNOd7OdvT7mgMaI51p8apuJFDTCEEeFHiyjk9QJb+xycUih8qbs9X24xK+u8nzB A8muoDG3n0J/oaCA+FgeuYPjau+3JCB54PScTVoiKh+bmbGAQNbTtI6pZcH0BKs0jlw2 F7XhrwX6WXRQGyrF77jJpivldMyiQkAYi3Qq2+T2jE3tBjkxYazB3QkraRUPVBICU+df A2yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787194956; x=1787799756; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VzqTdKFj3jhC3Jdg1ZvONiDjywjA9OTIZm681XpG7SU=; b=KrlZcgvPnM6r+u9taiNpmzzkiFWYrHoNSKwM1zsIx+lRhcK1Po4H5K95KD20cMwivf Qub+Qic2WwdUs7EvyTn/ctYal9eT7yKBEvkauNsSSZy5C4yBdS8JvQeEdDT0lBRL3AWz KndaufBdki7uLe5nSIRaKVLBTKBm4t/BueYQf7h4+MwE9KtXJEKMxgRTZ8zVJOCmIpnA 3YY+ZSy5TsWU4TvxGlZvAINPFPjEbp0zPkiuldqyHIeb9xKICilyJXzR9ZV7iSPbmyiS tBgAtgNthGkI7J2vuknu46a0XD6sRoeazZIWBfp2Kk6kmIhcWcV4Q1WZcgTTiJNlnXS0 89Yw== X-Forwarded-Encrypted: i=1; AHgh+Rp7z05aMYUsTlUYwqxjuj1s4gHdwvmOvi23ZS81L5AVqYICnwqgnr5qPWQOCWvU2CAA1ESmakUHkZvbURQX@postgresql.org X-Gm-Message-State: AFuF++nWI3dO0k3niE7mNwkI0SP7+aq931t2CVhQSlWLX7Lad3uY0rIt tNMu8hq/JxINVHIgBLMS1KVlyq/C+rKJ0hQt30WIiY9wedhdV4bq1Ifo X-Gm-Gg: AR+sD13Vjskr7AYTZcalJEKI+wBYs2sK87Dy2GzxXmmF/P/ZZD9mPjY/BJEZS4YIfXs l/JESutYsC7kmdtoXdFoT86paO83mSHs2DTI9ujAupF8MGQchYPk8qILrnOxUYjBq1V9aW+6H7w Ja4l/UQWMmL3b9BgsTOgcJQ/i/t0i92T/WT/Vj4pldUT+2dV4Hjx49uEVbbk/DJ2RJv1gXKzMKY NVi6xN95OCaz3cN1xc+Y0eouy/R//kguLJk/fCGcQUvFvWLUvLZrjypKReWGA5mYy7LilZ6nV0d UwfrnGmu0wnVLCfznAc2HCjKmMZ8rdFin4isnaUpW3IiyjIufcDzDdm6txgFQ5VTILt+mF40bN5 1d6CRnktw1nSqa7Jq9TIHs61ts0PdfusKPHLV3Ze163vG6IxVIgz7zTQxe6cOuBnCwDEj0+Di0T GnAZGbiWcI3i0u6bBCFYxw61K0mj9v/E6p1HeIOJV6kYnMQkDQSpG0xW0DsjmVwmv0M32bmN+z7 iwXu840nDyn9YlB585Up53PfX28H/v14eyd6UyHT2nQF3EI0U5zFEBYaCk9j4yBg8R8 X-Received: by 2002:a53:b24d:0:b0:66c:c638:8e88 with SMTP id 956f58d0204a3-66ccb5b761fmr2771729d50.2.1787194956461; Wed, 19 Aug 2026 20:02:36 -0700 (PDT) Received: from ?IPV6:2600:1700:7790:5940:39ba:29ce:6e7:d177? ([2600:1700:7790:5940:39ba:29ce:6e7:d177]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8451955a784sm18676997b3.47.2026.08.19.20.02.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Aug 2026 20:02:35 -0700 (PDT) Message-ID: <802ced07-1530-4cb3-9bf3-215fe61308ee@gmail.com> Date: Wed, 19 Aug 2026 23:01:04 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Report bytes and transactions actually sent downtream To: Ashutosh Sharma , Masahiko Sawada Cc: Amit Kapila , Ashutosh Bapat , Kyotaro Horiguchi , michael@paquier.xyz, bertranddrouvot.pg@gmail.com, andres@anarazel.de, shveta.malik@gmail.com, pgsql-hackers@postgresql.org References: <20260615.151943.2105002076083694041.horikyota.ntt@gmail.com> <20260615.180401.1834123951330189307.horikyota.ntt@gmail.com> Content-Language: en-US From: Aditya Gollamudi 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 On 7/3/26 1:44 AM, Ashutosh Sharma wrote: > Thank you for your review comments. > > I have swapped the patch order - please see attached. > > In the refactoring patch, I also ensured that reorderbuffer.h does not > depend on pgstat.h. To make that possible, I introduced a shared > header, src/include/replication/replslot_stats.h, where > PgStat_ReplSlotStats is defined. Both pgstat.h and reorderbuffer.h > include that header. Hope that helps! > > -- > With Regards, > Ashutosh Sharma. Hi Ashutosh! Thanks for the updated patches. I reviewed the latest two as part of the July patch review workshop: First, I wasn't able to cleanly apply the refactoring patch against the current tree. It could be an issue on my end, but it may need to be checked again. Secondly, this was mentioned earlier in the thread and handled for the SQL API path but I believe an excess 25 bytes is still being counted by output_bytes in the WALsender path because of an unaccounted for header. In WalSndPrepareWrite(), we call pq_sendbyte() and pq_sendint64() twice in order to send some header data. In order to be consistent with the renaming to "output_bytes" I think that should not be included. One way this could be fixed is through an offset that simply accounts for this header data, and subtracts it from output_bytes: /* OutputPluginPrepareWrite */ ctx->prepare_write(ctx, ctx->write_location, ctx->write_xid, last_write); ctx->prepared_write_offset = ctx->out->len; /* OutputPluginWrite */ ctx->reorder->stats.output_bytes += ctx->out->len - ctx->prepared_write_offset; Finally, I wonder if the test coverage is sufficient. We only assert that output_bytes is > 0 and that it is equal to 0 after a reset happens. Should we also check that it is equal to the expected number of bytes for the output_plugin? From what I can tell, in the SQL API path, we know the data comes from the buffer contents. So maybe additional verification could do something along the lines of: length output plugin produced data == output_bytes delta I'm fairly new to patch reviews and the postgres community so I'm curious what your thoughts are! Is the new code I suggested to remove the 25 bytes and potentially more tests worth it? Best, Adi Gollamudi