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 1nOfEA-0000nL-RP for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Feb 2022 12:34:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nOfE9-0002Nz-Nl for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Feb 2022 12:34:09 +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 1nOfE9-0002Nq-Ev for pgsql-hackers@lists.postgresql.org; Mon, 28 Feb 2022 12:34:09 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nOfE7-0002WI-A7 for pgsql-hackers@lists.postgresql.org; Mon, 28 Feb 2022 12:34:08 +0000 Received: by mail-pj1-x1034.google.com with SMTP id cp23-20020a17090afb9700b001bbfe0fbe94so11193417pjb.3 for ; Mon, 28 Feb 2022 04:34:07 -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=+TaD8cynGK+pjnqBSGEdhU07XSjutvs29E4SW5GO7CQ=; b=NOpILVDKCL+v1nKDVnMi+HrnN1kdDzdUCblUkeGW1F6OINiAbfzumuYKA0DHlBvjiS 85SglsTa+j1gGV/46tX9o8zF164YhLkPurQmnYMzeJ1fprAmXTBLibxYCJkDKsS/aPUg ZDHhqANCtUPSsycIKw7R2tXap/dSVMuUi2gR5ji+frBu4e6UGF72kCj+Nhl1OyVlxWg3 cdn+tk7UXxa8wrLdk2YXN2UAHmLdiLZxQTmH04aR43qqKr2aAmzvl7cQuQimXJhUbK29 51dn5hbcZR3jPk0Df4B//My8ftdXDDmPCPz/U0UAwlEFv+DBn/dwSXF7JIt9EhpA4IFn Kd+Q== 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=+TaD8cynGK+pjnqBSGEdhU07XSjutvs29E4SW5GO7CQ=; b=QidLWuhptqIatInom9DBngUPdGL/XL82tfzE2ef3K8Dbx1fY3RptuT7B6fqF+9BcBj 5ducKUkOzV09n3VOBPE6JBvwQuTK4AyrdiU/5BUWGsnyS1wyhnG2BpaloEjHuAxj5QSh q31x+sSGEWBw4/YFTKbZwCBeo5PiSOrcc4EbZRIK1Jb7qHDGqv2UNZcoxf3wDySq+VH6 KjY8WsRBe3ey/cQjlE4eAV2XPqjuTKOAmvZoM1A574xdBmWtGF7Iy8OnUJnob4HDbGyC ibPpACQd7w5hhUWNjoVm5ARlJGDPMOF1NCv58JdxPFbPvh9j6NbdpgKcgt80d+nsVYrr urlA== X-Gm-Message-State: AOAM532FmLV4KAqkAotsQhdkVcAlD5SxWrL3VaNjRf50Xtcuvpnywxp3 OK5UtqsnW8WhZOg2ofQIdmf1WuKVR/RjHlZHYTs= X-Google-Smtp-Source: ABdhPJyzPYBFxPUex9mRTllXXOx5cdeYmf+sJAGMBHc9mycSgBQkcHta5h4v3ThJEnfqj1n6W/NKD9D6DDwdCbYoSAo= X-Received: by 2002:a17:902:f605:b0:14f:5d75:4fb0 with SMTP id n5-20020a170902f60500b0014f5d754fb0mr19672375plg.101.1646051646312; Mon, 28 Feb 2022 04:34:06 -0800 (PST) MIME-Version: 1.0 References: <20220218074351.wgfosjt5lql2vjbr@jrouhaud> <20220219053215.r4wqatln5awklecf@jrouhaud> <20220228063222.rhmlwtdloeetibom@jrouhaud> In-Reply-To: <20220228063222.rhmlwtdloeetibom@jrouhaud> From: Bharath Rupireddy Date: Mon, 28 Feb 2022 18:03:54 +0530 Message-ID: Subject: Re: Report checkpoint progress with pg_stat_progress_checkpoint (was: Report checkpoint progress in server logs) To: Julien Rouhaud Cc: Nitin Jadhav , Ashutosh Sharma , Matthias van de Meent , Bruce Momjian , Tom Lane , Magnus Hagander , PostgreSQL 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 Mon, Feb 28, 2022 at 12:02 PM Julien Rouhaud wrote: > > Hi, > > On Mon, Feb 28, 2022 at 10:21:23AM +0530, Bharath Rupireddy wrote: > > > > Another thought for my review comment: > > > 1) Can't we use pg_is_in_recovery to determine if it's a restartpoint > > > or checkpoint instead of having a new function > > > pg_stat_get_progress_checkpoint_type? > > > > I don't think using pg_is_in_recovery work here as it is taken after > > the checkpoint has started. So, I think the right way here is to send > > 1 in CreateCheckPoint and 2 in CreateRestartPoint and use > > CASE-WHEN-ELSE-END to show "1": "checkpoint" "2":"restartpoint". > > I suggested upthread to store the starting timeline instead. This way you can > deduce whether it's a restartpoint or a checkpoint, but you can also deduce > other information, like what was the starting WAL. I don't understand why we need the timeline here to just determine whether it's a restartpoint or checkpoint. I know that the InsertTimeLineID is 0 during recovery. IMO, emitting 1 for checkpoint and 2 for restartpoint in CreateCheckPoint and CreateRestartPoint respectively and using CASE-WHEN-ELSE-END to show it in readable format is the easiest way. Can't the checkpoint start LSN be deduced from PROGRESS_CHECKPOINT_LSN, checkPoint.redo? I'm completely against these pg_stat_get_progress_checkpoint_{type, kind, start_time} functions unless there's a strong case. IMO, we can achieve what we want without these functions as well. > > 11) I think it's discussed, are we going to add the pid of the > > checkpoint requestor? > > As mentioned upthread, there can be multiple backends that request a > checkpoint, so unless we want to store an array of pid we should store a number > of backend that are waiting for a new checkpoint. Yeah, you are right. Let's not go that path and store an array of pids. I don't see a strong use-case with the pid of the process requesting checkpoint. If required, we can add it later once the pg_stat_progress_checkpoint view gets in. Regards, Bharath Rupireddy.