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 1mp0xA-0002de-7E for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Nov 2021 04:29:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mp0x9-0003Ip-5Q for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Nov 2021 04:29:15 +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 1mp0x8-0003GV-S2 for pgsql-hackers@lists.postgresql.org; Mon, 22 Nov 2021 04:29:14 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mp0x6-0001jW-Mt for pgsql-hackers@lists.postgresql.org; Mon, 22 Nov 2021 04:29:14 +0000 Received: by mail-wr1-x42d.google.com with SMTP id u18so30226487wrg.5 for ; Sun, 21 Nov 2021 20:29:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+kCVHWlR4ga0TD6d2uaMGxBS54g3CkcxAncESw7ieTc=; b=QatHV0Y9N/xlV2sCirL1CyZrxX8FffwzJtu7RHA6ACSQ6rCeQKYgv41+PYnXFMMVg4 WgqneEdZmC8Sk0vIdHFBJZCF/3/L4guK2Kdn8XJY0fFQ6qwFGnn+xlon5c+cMH6UJRc9 NKnLNXRQV6d44n3Rh//KFrlXTmeIsGnMY7iJO2SgJT1cnKSdVM57Ar0nxut/b6ZDEjO7 HEH7ZZFPVeCB0DjOCPUZbDErXCCeZD4L03NQINomE/fVhUo6wZfs2nhqmw7jst2dfHL7 IBuV1kCca0i0LWG4o9lIoHJspHIHVjy5RggGBSgMfVkHQFy/nF452W9Gxz61hAsYnDSb MXsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=+kCVHWlR4ga0TD6d2uaMGxBS54g3CkcxAncESw7ieTc=; b=tT+gyb6oKLkOvaVDkhp5lOIwYJmkFazglp1y2BL9Kh9fFV5l+msGQ1jXCvORUt6kp+ NXfDOe9n1aGjoyoj7+9vVsAovf/Y0ixvyFiDOtjeXvY4kygyb4NXAWJPTbJsgD5ewysO 8HyQv/12R2eqUc9l5mKOTdjUFlZYm4tzZi/Ljp4O8cVUZseqfJDncol12ck+rnKf2mDd LQux75RcpchrHHB2rh55Odv+C+BV69vzN18Wvz3XxGhXaiBKZ7iQaclfNkmq9EzPmzR4 HbtNb8ztk/HL78gEGq/QoHSq1YI5AEMeljskfBKOtkzTFCHPyf59WE8PQoD+ruHSsyYJ kvOA== X-Gm-Message-State: AOAM530hMi7E0XMBWD1KaH+6yhxV80f+1Yy1rJMK/wLM3ZQBQZSgM0xq 8NCxm9HjSwgc/jf7FhhhZeozmzfbR1mRAiOW2WY= X-Google-Smtp-Source: ABdhPJydqKOYeTPlAKWvk5JxP0IvJCsVI0n/CJgSOuHzFp9pZOr6kp7DPK/ZcS9VF6JaDsBeND+7Rl9uFjNTi7NLr4I= X-Received: by 2002:a05:6000:1848:: with SMTP id c8mr33624297wri.265.1637555351026; Sun, 21 Nov 2021 20:29:11 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: vignesh C Date: Mon, 22 Nov 2021 09:58:59 +0530 Message-ID: Subject: Re: Failed transaction statistics to measure the logical replication progress To: Masahiko Sawada Cc: Amit Kapila , "osumi.takamichi@fujitsu.com" , Greg Nancarrow , "houzj.fnst@fujitsu.com" , "pgsql-hackers@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Nov 19, 2021 at 7:41 PM Masahiko Sawada wro= te: > > On Thu, Nov 18, 2021 at 12:26 PM Amit Kapila wr= ote: > > > > On Wed, Nov 17, 2021 at 7:12 PM osumi.takamichi@fujitsu.com > > wrote: > > > > > > On Wednesday, November 17, 2021 10:00 PM Amit Kapila wrote: > > > > > > > > Can you please tell us why you think the names in your proposed pat= ch are > > > > better than the existing names proposed in Sawada-San's patch? Is i= t because > > > > those fields always contain the information of the last or latest e= rror that > > > > occurred in the corresponding subscription worker? > > > This is one reason. > > > > > > Another big reason comes from the final alignment when we list up all= columns of both patches. > > > The patches in this thread is trying to introduce a column that indic= ates > > > cumulative count of error to show all error counts that the worker go= t in the past. > > > > > > > Okay, I see your point and it makes sense to rename columns after > > these other stats. I am not able to come up with any better names than > > what is being used here. Sawada-San, do you agree with this, or do let > > us know if you have any better ideas? > > > > I'm concerned that these new names will introduce confusion; if we > have last_error_relid, last_error_command, last_error_message, > last_error_time, and last_error_xid, I think users might think that > first_error_time is the timestamp at which an error occurred for the > first time in the subscription worker. Also, I'm not sure > last_error_count is not clear to me (it looks like showing something > count but the only "last" one?). An alternative idea would be to add > total_error_count by this patch, resulting in having both error_count > and total_error_count. Regarding commit_count and abort_count, I > personally think xact_commit and xact_rollback would be better since > they=E2=80=99re more consistent with pg_stat_database view, although we m= ight > already have discussed that. > > Besides that, I=E2=80=99m not sure how useful commit_bytes, abort_bytes, = and > error_bytes are. I originally thought these statistics track the size > of received data, i.g., how much data is transferred from the > publisher and processed on the subscriber. But what the view currently > has is how much memory is used in the subscription worker. The > subscription worker emulates ReorderBufferChangeSize() on the > subscriber side but, as the comment of update_apply_change_size() > mentions, the size in the view is not accurate: > > + * The byte size of transaction on the publisher is calculated by > + * ReorderBufferChangeSize() based on the ReorderBufferChange structure. > + * But on the subscriber, consumed resources are not same as the > + * publisher's decoding processsing and required to be computed in > + * different way. Therefore, the exact same byte size is not restored on > + * the subscriber usually. > > Also, it seems to take into account the size of FlushPosition that is > not taken into account by ReorderBufferChangeSize(). Let's keep the size calculation similar to the publisher side to avoid any confusion, we can try to keep it the same as ReorderBufferChangeSize wherever possible. Regards, Vignesh