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 1nMWRe-0002nN-8L for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Feb 2022 14:47: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 1nMWRc-0006FS-7A for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Feb 2022 14:47:12 +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 1nMWRb-0006FJ-RQ for pgsql-hackers@lists.postgresql.org; Tue, 22 Feb 2022 14:47:11 +0000 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nMWRZ-0007LI-0n for pgsql-hackers@postgresql.org; Tue, 22 Feb 2022 14:47:10 +0000 Received: by mail-pg1-x52e.google.com with SMTP id h125so17208030pgc.3 for ; Tue, 22 Feb 2022 06:47:08 -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; bh=B0O427nI5vD6cVxY7pBlhBQ9FSqde+W/5RGkN7U3Kik=; b=jnUZs1jylm/c6EsmsMnUalq+8+ExSImIWc6ltQOxP0QGZBhw/zF86dAbscfnaaIZmm yh+aj7ccZQNo7pFCJceJYY2gjOfxprur5qEWVU5/DyQ88Vewc3Q2h+quPEqx/Z2yK+sE hMkCbTaxzQr+wHHIBvSFs+6+QGzAq8qDFrCnl2h6UaoOsPpTgN8xpihgb3wvhFCYmmA+ MnHZDWwqD42Dab+jgkZ6bFOf/WIsrXr7bsRC+idDw7bPbyqyGPVIO0MYSG2lTfdBKYDo HSOcnR0SHiBodSdIYxkNPkoRvxLrzK5M/IwplYByoPsv8C7PSH4pIJPc2M4D2X5b0EWn B+JQ== 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; bh=B0O427nI5vD6cVxY7pBlhBQ9FSqde+W/5RGkN7U3Kik=; b=es8KMn8saK/rzgFuAC84K/Z5v42evZaG5XIi5JyQOf9bIE5r4zpoH3kZY7i5LkZk6R OS179yosCfxQC8wn2KTQtq9dErhkpXCCxtY0tptFGYgumuGmzj5hr0dGxwjo3rRvDSPC 7K9+SZBI4xnCzXM7XyDhJWYdo+aQc8t4jLuJO6pXRZK79hPdXw1/Wm9fYri4D6vlHzgW wg8NkixtbnN27EXA/k33NLrPLGwWQRRTbtYP15iELtjyXFR8AplJHMPZamagqBcSSc4o HTP4Z8Q5CZ7gAdOsAPFzgO5ElfSCNFKL9J8Kl9M0fOqfsJqBAFLdvVce+I8kV76p0qap 9xuA== X-Gm-Message-State: AOAM5329fHBuL2WQ33GTActgTBj9JbaEywVMtLHg2YOubKD1/bsWxVje 5fLaxCqZ+1KS3n4GyIOCm66oVE6a3xyEBvsva7c= X-Google-Smtp-Source: ABdhPJymR6RL9x75JoJD9bPVyKm3qdI8nSolMUy1tiJf106df3eYWJuMXUrd3iyz2vbmabdtNVKqfZnlfySE01zxES0= X-Received: by 2002:a63:451e:0:b0:373:6a1d:2ad9 with SMTP id s30-20020a63451e000000b003736a1d2ad9mr20427441pga.114.1645541227873; Tue, 22 Feb 2022 06:47:07 -0800 (PST) MIME-Version: 1.0 References: <20220215182641.2cejma6tcgeoqyw2@alap3.anarazel.de> <20220218203255.d3evl6qi2n6gxy6b@alap3.anarazel.de> <20220219160203.y5w2ktc2utthn7pe@alap3.anarazel.de> <20220221053453.lo6fzmji23ennvgj@alap3.anarazel.de> <20220221074806.nyhdberpuwbcbudp@alap3.anarazel.de> In-Reply-To: From: Masahiko Sawada Date: Tue, 22 Feb 2022 23:46:31 +0900 Message-ID: Subject: Re: Design of pg_stat_subscription_workers vs pgstats To: "osumi.takamichi@fujitsu.com" Cc: Amit Kapila , Andres Freund , "David G. Johnston" , pgsql-hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Feb 22, 2022 at 9:22 PM osumi.takamichi@fujitsu.com wrote: > > On Tuesday, February 22, 2022 2:45 PM Masahiko Sawada wrote: > > I've attached a patch that changes pg_stat_subscription_workers view. > > It removes non-cumulative values such as error details such as error-XID and > > the error message from the view, and consequently the view now has only > > cumulative statistics counters: apply_error_count and sync_error_count. Since > > the new view name is under discussion I temporarily chose > > pg_stat_subscription_activity. > Hi, thank you for sharing the patch. > > > Few minor comments for v1. Thank you for the comments! > > (1) commit message's typo > > This commits changes the view so that it stores only statistics > counters: apply_error_count and sync_error_count. > > "This commits" -> "This commit" Will fix. > > (2) minor improvement suggestion for the commit message > > I suggest that we touch the commit id 8d74fc9 > that introduces the pg_stat_subscription_workers > in the commit message, for better traceability. Below is an example. > > From: > As the result of the discussion, we've concluded that the stats > collector is not an appropriate place to store the error information of > subscription workers. > > To: > As the result of the discussion about the view introduced by 8d74fc9,... Okay, will add the commit reference. > > (3) doc/src/sgml/logical-replication.sgml > > Kindly refer to commit id 85c61ba for the detail. > You forgot "the" in the below sentence. > > @@ -346,8 +346,6 @@ > > A conflict will produce an error and will stop the replication; it must be > resolved manually by the user. Details about the conflict can be found in > - > - pg_stat_subscription_workers and the > subscriber's server log. > > > From: > subscriber's server log. > to: > the subscriber's server log. Will fix. > > (4) doc/src/sgml/monitoring.sgml > > > > - last_error_time timestamp with time zone > + sync_error_count uint8 > > > - Last time at which this error occurred > + Number of times the error occurred during the initial data copy > > > I supposed it might be better to use "initial data sync" > or "initial data synchronization", rather than "initial data copy". "Initial data synchronization" sounds like the whole table synchronization process including COPY and applying changes to catch up. But sync_error_count is incremented only during COPY so I used "initial data copy". What do you think? > > (5) src/test/subscription/t/026_worker_stats.pl > > +# Truncate test_tab1 so that table sync can continue. > +$node_subscriber->safe_psql('postgres', "TRUNCATE test_tab1;"); > > The second truncate is for apply, isn't it? Therefore, kindly change > > From: > Truncate test_tab1 so that table sync can continue. > To: > Truncate test_tab1 so that apply can continue. Right, will fix. > > (6) src/test/subscription/t/026_worker_stats.pl > > +# Insert more data to test_tab1 on the subscriber and then on the publisher, raising an > +# error on the subscriber due to violation of the unique constraint on test_tab1. > +$node_subscriber->safe_psql('postgres', "INSERT INTO test_tab1 VALUES (2)"); > > Did we need this insert ? > If you want to indicate the apply is working okay after the error of table sync is solved, > waiting for the max value in the test_tab1 becoming 2 on the subscriber by polling query > would work. But, I was not sure if this is essentially necessary for the testing purpose. You're right, it's not necessary. Also, it seems better to change the TAP test file name from 026_worker_stats.pl to 026_stats.pl. Will incorporate these changes. Regards, -- Masahiko Sawada EDB: https://www.enterprisedb.com/