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 1mVmV4-0004Dl-2N for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Sep 2021 03:12:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mVmV1-0000aH-Vd for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Sep 2021 03:12:43 +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 1mVmV1-0000a8-LU for pgsql-hackers@lists.postgresql.org; Thu, 30 Sep 2021 03:12:43 +0000 Received: from mail-yb1-xb2e.google.com ([2607:f8b0:4864:20::b2e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mVmUx-00013j-U6 for pgsql-hackers@lists.postgresql.org; Thu, 30 Sep 2021 03:12:43 +0000 Received: by mail-yb1-xb2e.google.com with SMTP id v195so9519115ybb.0 for ; Wed, 29 Sep 2021 20:12:39 -0700 (PDT) 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=ojjGvoikFlDzy/Yr+TZ81ZGr5PJWA3iqzlspjlPJTPs=; b=Ux10ryw0ZTryXDMyt+FwJqHlOMRWrlE+CxDqxlE/JDe5fSVhQWd4NGkYBy/Ykn1SOK PysuOXae66byliKeM/JGo7T7G4ZJ8zaY8aVAQ/wm6PS4aJxKDAJw4Tl/9SSF+sYLIOzp zCeBLUUlr/ONuCBNrr61Jj17UBvVKUvjRjSeQ5N5V0xRuL3ehRHOfh8KtbtRTxx9N/5k FaGmlwkpG9phDghFVB6LAdG9W71KHYVAOaYPWQIalSEOUNmGfyxnzl6RZ2AN29ShJjKQ xXZIJGKOUcV0VWxLt3wxC++TKaR4MsefnoqBVYra+tm7nXIwyjB+gdy0+KntZrI0nADn iQEQ== 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=ojjGvoikFlDzy/Yr+TZ81ZGr5PJWA3iqzlspjlPJTPs=; b=rSRz0zIXAjTJlmfztUh2/LjluVCJfDbYYSwxpGEEsTlQnUgb5eNaDXk5AaFcxzvCqs 4v53UXEQR0T9RRkMm1GvADJoOGI2fmhVSqqFeqd2BOLQmVthBpRXgeuLmj0g+XccW3w1 SgYc+JNU32fc4IbZ8Ex9JuHq5czxNQNWD0OD2iDaiZ6fVf2rdgeU79Q5vqbhfy8lEhaY 5HdRIg8waCRXgrzgB1xrD6YRX2O9/1JKJqFPci0w8/PawPTIKCs9OW7QSzlvbrU+hPix oLE67j0ijldqddHj/QLEjlA54ahO9jB0Ppy1ffY8tDWr/I0VV9og26R9Fok1rxzR/Vzg 3TWQ== X-Gm-Message-State: AOAM5318WCv5rBq8dyJV+w1ByouME4llcZrg74xZ5uDYCgcYM/Tsf/si 3aMeQfA0zL6qZsS6GIyEU+LVPDbMOQ34bX0rrcQ= X-Google-Smtp-Source: ABdhPJy66+1x1sXTTMadWcayxWecphStnis66olEu5UTYOh8ESM0074r4j1pmh5SzNgSCKctC478dxu06vOZXAVGFho= X-Received: by 2002:a25:cac8:: with SMTP id a191mr3885191ybg.74.1632971557836; Wed, 29 Sep 2021 20:12:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Thu, 30 Sep 2021 08:42:26 +0530 Message-ID: Subject: Re: Failed transaction statistics to measure the logical replication progress To: Masahiko Sawada Cc: "osumi.takamichi@fujitsu.com" , "pgsql-hackers@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Sep 30, 2021 at 8:18 AM Masahiko Sawada wrote: > > On Wed, Sep 29, 2021 at 8:55 PM Amit Kapila wrote: > > > > On Wed, Sep 29, 2021 at 4:49 PM Masahiko Sawada wrote: > > > > > > On Tue, Sep 28, 2021 at 7:04 PM Amit Kapila wrote: > > > > > > > > On Tue, Sep 28, 2021 at 11:35 AM Masahiko Sawada wrote: > > > > > > > > > > On Tue, Sep 28, 2021 at 1:54 PM Amit Kapila wrote: > > > > > > > > > > > > > > > > > > > > Then, if, we proceed in this direction, > > > > > > > the place to implement those stats > > > > > > > would be on the LogicalRepWorker struct, instead ? > > > > > > > > > > > > > > > > > > > Or, we can make existing stats persistent and then add these stats on > > > > > > top of it. Sawada-San, do you have any thoughts on this matter? > > > > > > > > > > I think that making existing stats including received_lsn and > > > > > last_msg_receipt_time persistent by using stats collector could cause > > > > > massive reporting messages. We can report these messages with a > > > > > certain interval to reduce the amount of messages but we will end up > > > > > seeing old stats on the view. > > > > > > > > > > > > > Can't we keep the current and new stats both in-memory and persist on > > > > disk? So, the persistent stats data will be used to fill the in-memory > > > > counters after restarting of workers, otherwise, we will always refer > > > > to in-memory values. > > > > > > Interesting. Probably we can have apply workers and table sync workers > > > send their statistics to the stats collector at exit (before the stats > > > collector shutting down)? And the startup process will restore them at > > > restart? > > > > > > > I think we do need to send at the exit but we should probably send at > > some other regular interval as well to avoid losing all the stats > > after the crash-restart situation. > > But we clear all statistics collected by the stats collector during > crash recovery. > Right. So, maybe if we do what you are suggesting is sufficient. -- With Regards, Amit Kapila.