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 1nVAhp-0001jo-Km for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Mar 2022 11:23:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nVAhm-0006oJ-M7 for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Mar 2022 11:23:38 +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 1nVAhm-0006oA-64 for pgsql-hackers@lists.postgresql.org; Fri, 18 Mar 2022 11:23:38 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nVAhg-0002Q1-3h for pgsql-hackers@lists.postgresql.org; Fri, 18 Mar 2022 11:23:36 +0000 Received: by mail-ej1-x630.google.com with SMTP id r13so16407884ejd.5 for ; Fri, 18 Mar 2022 04:23:31 -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=+n7NE+2jToMYtuf5/iJ5Na5YVmi4Cbr1fnGm4CwXNNc=; b=VWOAEFFNodaJ7P2IjcWDkHN1HMSjsbikT7g4Zi1+6MSJJwcfkiQgmcDUN/cqqYmj51 x+a6J4CLUtG5Hy9nwapZI28chlgTd0yOA8lo12F/p8GgCyXjn63/73CU2yeHjCPqjGyw EwPi3l2qsOx9NNAurJBp3ojHeV6niuY31h8P0rSt7luyx/X5LLFOe8GoIjmfpe1GVKQ9 C05Xrs8OfPQq+WtuzjKSdyQ7T2cHgyJL9cyrq3eXuqzspfHGrZuzKDQjy0YIoRQZMffn giEwjnXwMNa3Eu7CyP/ZnbIZPRiI+XsbjXtiXDsvTGzVhh7hixTnBQ7YECKGAPo6Wjvh nUkA== 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=+n7NE+2jToMYtuf5/iJ5Na5YVmi4Cbr1fnGm4CwXNNc=; b=XQ9bNtiifjuZIu0H9+HHZNck3ubyf7m64ar7zThVhq2d//gYNQgooPt4ntNzI9Xvb5 1hqp1aBEine1QxpUmalImhx9uJovJ/TPRcKhK+4vQQyVvQfVWI2Quq9L7B4DYoGmOj63 nHSf27q8l2BAhtx/BIvoNwsgSXPytZFTwy0zuYMtFVN6pf8pXAyzBA7nhPou31WjJXri P94mg/DcAZ11xmGA4InHKi3RSE28KGdSA2AbosbzSMupHuqhVnPnokByVTS23vSYWc/2 HRiFppmlZEk0U1JbWNM14DLnRLmWws3+jX/pqf+BAVglnBtjhfIJo6WajiI6YZ1J1aKi 8zMA== X-Gm-Message-State: AOAM530Rpux1HquQnaLd2reLg6NicEuJLBaV3XIu6n55Z9MFM1luPiz6 icxD85kRsb/qtyTuEl/25xU6Wr0KpyM2KspIn2s= X-Google-Smtp-Source: ABdhPJxhIG/VtuajOu/PQJTuZ4OZ1IQOsfEyxs1t/x2xT0UImIxEonJf43WeiCUwEu55i/iRsXIoAE6doQXFTgDniZA= X-Received: by 2002:a17:906:1be1:b0:6ce:b0a8:17d with SMTP id t1-20020a1709061be100b006ceb0a8017dmr8335974ejg.413.1647602610349; Fri, 18 Mar 2022 04:23:30 -0700 (PDT) MIME-Version: 1.0 References: <20220309141750.jirvp5o5v5zpr4lz@jrouhaud> <20220311100428.amj6hmqyaokgyxf2@jrouhaud> <20220311121300.2uh7k2zbrx2exdtq@jrouhaud> <20220314114555.pqj5pnuxz76vdscn@jrouhaud> In-Reply-To: <20220314114555.pqj5pnuxz76vdscn@jrouhaud> From: Nitin Jadhav Date: Fri, 18 Mar 2022 16:52:52 +0530 Message-ID: Subject: Re: Report checkpoint progress with pg_stat_progress_checkpoint (was: Report checkpoint progress in server logs) To: Julien Rouhaud Cc: Matthias van de Meent , Bharath Rupireddy , Ashutosh Sharma , 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 > > > I don't get it. The checkpoint flags and the view flags (set by > > > pgstat_progrss_update*) are different, so why can't we add this flag to the > > > view flags? The fact that checkpointer.c doesn't update the passed flag and > > > instead look in the shmem to see if CHECKPOINT_IMMEDIATE has been set since is > > > an implementation detail, and the view shouldn't focus on which flags were > > > initially passed to the checkpointer but instead which flags the checkpointer > > > is actually enforcing, as that's what the user should be interested in. If you > > > want to store it in another field internally but display it in the view with > > > the rest of the flags, I'm fine with it. > > > > Just to be in sync with the way code behaves, it is better not to > > update the next checkpoint request's CHECKPOINT_IMMEDIATE with the > > current checkpoint 'flags' field. Because the current checkpoint > > starts with a different set of flags and when there is a new request > > (with CHECKPOINT_IMMEDIATE), it just processes the pending operations > > quickly to take up next requests. If we update this information in the > > 'flags' field of the view, it says that the current checkpoint is > > started with CHECKPOINT_IMMEDIATE which is not true. > > Which is why I suggested to only take into account CHECKPOINT_REQUESTED (to > be able to display that a new checkpoint was requested) I will take care in the next patch. > > Hence I had > > thought of adding a new field ('next flags' or 'upcoming flags') which > > contain all the flag values of new checkpoint requests. This field > > indicates whether the current checkpoint is throttled or not and also > > it indicates there are new requests. > > I'm not opposed to having such a field, I'm opposed to having a view with "the > current checkpoint is throttled but if there are some flags in the next > checkpoint flags and those flags contain checkpoint immediate then the current > checkpoint isn't actually throttled anymore" behavior. I understand your point and I also agree that it becomes difficult for the user to understand the context. > and > CHECKPOINT_IMMEDIATE, to be able to display that the current checkpoint isn't > throttled anymore if it were. > > I still don't understand why you want so much to display "how the checkpoint > was initially started" rather than "how the checkpoint is really behaving right > now". The whole point of having a progress view is to have something dynamic > that reflects the current activity. As of now I will not consider adding this information to the view. If required and nobody opposes having this included in the 'flags' field of the view, then I will consider adding. Thanks & Regards, Nitin Jadhav On Mon, Mar 14, 2022 at 5:16 PM Julien Rouhaud wrote: > > On Mon, Mar 14, 2022 at 03:16:50PM +0530, Nitin Jadhav wrote: > > > > I am not suggesting > > > > removing the existing 'flags' field of pg_stat_progress_checkpoint > > > > view and adding a new field 'throttled'. The content of the 'flags' > > > > field remains the same. I was suggesting replacing the 'next_flags' > > > > field with 'throttled' field since the new request with > > > > CHECKPOINT_IMMEDIATE flag enabled will affect the current checkpoint. > > > > > > Are you saying that this new throttled flag will only be set by the overloaded > > > flags in ckpt_flags? > > > > Yes. you are right. > > > > > So you can have a checkpoint with a CHECKPOINT_IMMEDIATE > > > flags that's throttled, and a checkpoint without the CHECKPOINT_IMMEDIATE flag > > > that's not throttled? > > > > I think it's the reverse. A checkpoint with a CHECKPOINT_IMMEDIATE > > flags that's not throttled (disables delays between writes) and a > > checkpoint without the CHECKPOINT_IMMEDIATE flag that's throttled > > (enables delays between writes) > > Yes that's how it's supposed to work, but my point was that your suggested > 'throttled' flag could say the opposite, which is bad. > > > > I don't get it. The checkpoint flags and the view flags (set by > > > pgstat_progrss_update*) are different, so why can't we add this flag to the > > > view flags? The fact that checkpointer.c doesn't update the passed flag and > > > instead look in the shmem to see if CHECKPOINT_IMMEDIATE has been set since is > > > an implementation detail, and the view shouldn't focus on which flags were > > > initially passed to the checkpointer but instead which flags the checkpointer > > > is actually enforcing, as that's what the user should be interested in. If you > > > want to store it in another field internally but display it in the view with > > > the rest of the flags, I'm fine with it. > > > > Just to be in sync with the way code behaves, it is better not to > > update the next checkpoint request's CHECKPOINT_IMMEDIATE with the > > current checkpoint 'flags' field. Because the current checkpoint > > starts with a different set of flags and when there is a new request > > (with CHECKPOINT_IMMEDIATE), it just processes the pending operations > > quickly to take up next requests. If we update this information in the > > 'flags' field of the view, it says that the current checkpoint is > > started with CHECKPOINT_IMMEDIATE which is not true. > > Which is why I suggested to only take into account CHECKPOINT_REQUESTED (to > be able to display that a new checkpoint was requested) and > CHECKPOINT_IMMEDIATE, to be able to display that the current checkpoint isn't > throttled anymore if it were. > > I still don't understand why you want so much to display "how the checkpoint > was initially started" rather than "how the checkpoint is really behaving right > now". The whole point of having a progress view is to have something dynamic > that reflects the current activity. > > > Hence I had > > thought of adding a new field ('next flags' or 'upcoming flags') which > > contain all the flag values of new checkpoint requests. This field > > indicates whether the current checkpoint is throttled or not and also > > it indicates there are new requests. > > I'm not opposed to having such a field, I'm opposed to having a view with "the > current checkpoint is throttled but if there are some flags in the next > checkpoint flags and those flags contain checkpoint immediate then the current > checkpoint isn't actually throttled anymore" behavior.