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 1ovFif-0006xM-Ee for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Nov 2022 10:32:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ovFie-0006Dm-CO for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Nov 2022 10:32:36 +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 1ovFiJ-000330-En for pgsql-hackers@lists.postgresql.org; Wed, 16 Nov 2022 10:32:15 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ovFiE-0003gF-Bn for pgsql-hackers@lists.postgresql.org; Wed, 16 Nov 2022 10:32:15 +0000 Received: by mail-wr1-x432.google.com with SMTP id cl5so29160462wrb.9 for ; Wed, 16 Nov 2022 02:32:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=pE2xX9gngBk8spk9cAIlx9ykT0jS3knzVvKNNZqEMVk=; b=abh3sc8u3gLiWK3ZrHRm4isdDRSYMnxdatFeD2VupviKon6IZuMu34do66ROw+AVuq DSxVrQ+tgilxJMAdaXS72jhlsDhFOO7GW0QW/ZYMwFyAvhjjnBaSnbARl5jOVjvlisqV H0ZLGQxLIze1+LL9a0KpNXzz82hWug7Z67JEw0SRuDGZ8yhlyqzJdjFwbK8wK/1oI+Em JYXt0sIb1DhUfUg+2nY8l/8YCDZTmzH7bxvlanO8dR87qog3iWxVe7nD/Bzob6WSLNU/ 6A5Y3MzKtOosA2vzUHDAgsH5UDLuYoU40zCFDV+MPE91UlE9A2qDZcYzGV1RMdn5fxJ5 irog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pE2xX9gngBk8spk9cAIlx9ykT0jS3knzVvKNNZqEMVk=; b=Y0WCUFOn6f4AKRLARJTjWW6F828VYQinqZANyh2aHFRhHwM4KoH6nxg+fMuyH3gzNg 2q8n3eeQWwowg7OWxLh5vgThliw1GNMtj3aAri74FUraaLuTDAcolB0V5CkSDZEeOIIv 2/MxIMIVshstEeFmzcGVoVqdsV/WHlBkCTriv3uVk2OqVvf1tM12kjNwx6PMw3khaB2Z p7B/ZRvNrggHYx3yS7PA5/OZkA3XW2dnJHcf+9GM65/cLVDBHUfZl5wWMcqnYELd53ww K2rE1RPz2JHyPexPOtDKBQXwsoyLNUpI7O+2E7KqmKI75zpnDnHRrjIfm6VG0jEDKYAV OcQw== X-Gm-Message-State: ANoB5pndaX76n2sEeVnr5UjoyZIikF7fkPGKZkwMSE02Pj8ZaT2Spo2y 7AH7WtGXjnB8WpuVdqeNVVip3E3RlOwLdrkkq/A= X-Google-Smtp-Source: AA0mqf5+PiRuH401Fw8VmTfnY3KTqgTTeJnAdeeX4m2F6rhu33Dpcy2fr8B/qaZNY4MAC0tP0ulEjQemYudLYeIXwdY= X-Received: by 2002:a05:6000:3c3:b0:22e:3275:983e with SMTP id b3-20020a05600003c300b0022e3275983emr13863006wrg.71.1668594726741; Wed, 16 Nov 2022 02:32:06 -0800 (PST) MIME-Version: 1.0 References: <20220319001556.atuqbmafvc73pa2k@alap3.anarazel.de> <20220707000446.hefgyu5xikxwt4md@alap3.anarazel.de> In-Reply-To: From: Bharath Rupireddy Date: Wed, 16 Nov 2022 16:01:55 +0530 Message-ID: Subject: Re: Report checkpoint progress with pg_stat_progress_checkpoint (was: Report checkpoint progress in server logs) To: Robert Haas Cc: "Drouvot, Bertrand" , Nitin Jadhav , Andres Freund , Matthias van de Meent , Ashutosh Sharma , Julien Rouhaud , 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 Wed, Nov 16, 2022 at 1:35 AM Robert Haas wrote: > > On Fri, Nov 4, 2022 at 4:27 AM Drouvot, Bertrand > wrote: > > Please find attached a rebase in v7. > > I don't think it's a good thing that this patch is using the > progress-reporting machinery. The point of that machinery is that we > want any backend to be able to report progress for any command it > happens to be running, and we don't know which command that will be at > any given point in time, or how many backends will be running any > given command at once. So we need some generic set of counters that > can be repurposed for whatever any particular backend happens to be > doing right at the moment. Hm. > But none of that applies to the checkpointer. Any information about > the checkpointer that we want to expose can just be advertised in a > dedicated chunk of shared memory, perhaps even by simply adding it to > CheckpointerShmemStruct. Then you can give the fields whatever names, > types, and sizes you like, and you don't have to do all of this stuff > with mapping down to integers and back. The only real disadvantage > that I can see is then you have to think a bit harder about what the > concurrency model is here, and maybe you end up reimplementing > something similar to what the progress-reporting stuff does for you, > and *maybe* that is a sufficient reason to do it this way. -1 for CheckpointerShmemStruct as it is being used for running checkpoints and I don't think adding stats to it is a great idea. Instead, extending PgStat_CheckpointerStats and using shared memory stats for reporting progress/last checkpoint related stats is a good idea IMO. I also think that a new pg_stat_checkpoint view is needed because, right now, the PgStat_CheckpointerStats stats are exposed via the pg_stat_bgwriter view, having a separate view for checkpoint stats is good here. Also, removing CheckpointStatsData and moving all of those members to PgStat_CheckpointerStats, of course, by being careful about the amount of shared memory required, is also a good idea IMO. Going forward, PgStat_CheckpointerStats and pg_stat_checkpoint view can be a single point of location for all the checkpoint related stats. Thoughts? In fact, I was recently having an off-list chat with Bertrand Drouvot about the above idea. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com