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 1pGGUb-0008OA-8N for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Jan 2023 09:36:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pGGUa-00017F-68 for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Jan 2023 09:36:56 +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 1pGGUZ-00016t-Td for pgsql-hackers@lists.postgresql.org; Fri, 13 Jan 2023 09:36:55 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pGGUV-00039p-OE for pgsql-hackers@lists.postgresql.org; Fri, 13 Jan 2023 09:36:54 +0000 Received: by mail-wm1-x336.google.com with SMTP id f25-20020a1c6a19000000b003da221fbf48so621831wmc.1 for ; Fri, 13 Jan 2023 01:36:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=PnqJ0AC61WDHeDrrleDi7UVP5snzJLCxqw+nmJU2v3I=; b=P1a/COqYU6Q6OeE7i0eg1txM2s7FPPRxXkn31RI6XlGWlrbPjyZYFtimWWnV8FbYOn lXkmQBayTaeix38+nEbTWq4u2qAw8gf+1bLf+O77ch3eEqcPx1cB1N3sepX2pSSHrGBG Gs+fKTy6NeOdEdrEqnq/NbtY1ghKJpxsBioEs11OnIsblvISrZXOXLNfyJGrPx0T97Ap THCn0Fiq6sJqZl79aIA3fIuKB7htQxOflWxecnWJwxBzyGayJZHV4UYKcyYR8uD6MP6d /GVP0yDHruvf6Qya+Kytz/kpdhx3n9A7O+4ne0zUR/7ljthVnZYUdFA0kHMzpz82lINl Z3vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PnqJ0AC61WDHeDrrleDi7UVP5snzJLCxqw+nmJU2v3I=; b=kz9UM0wc0cdCmbpxIq3WCNx+TR64r1f2pJzXNIfyNBh+eOFWQSBAVppbhNsu/wtCtL bmbIi6Zqr9Ryz6kuy/ptelmdjRziONoyrlzR3ioVHU+qsW4hLStIuO16FNWYQEPrO3MX DAEEtjGcxuZZ8C/fRCXft8hn1qBbVv4w2ElVkXroiWYjbVNX+ATFFu9pT2wZaTXE8adg whdjNNHCGevPweOF0KD3W+KQn/UJzh2VPjedGt/5QkqvImDMim3DKs/GiT+Rv9iULlJi EXalWqX6LWUrox824ddfZ1pr2Xf89Zl6U4kxKnu+Jrko/U7bQXHPLj1jO8DyYugK25xa +Yjw== X-Gm-Message-State: AFqh2kr/2MKTphkOSUjLhfDVW27RrVgEM0Pfryi1OF2ONCtoxJWN5B5F 4UGPpB7h0DRcdpFkHpMxF+g= X-Google-Smtp-Source: AMrXdXts5DLT5rWXMdPbEm+rv335hnSp5hXkiFQ1cSW9xYbG6tqxQjJ2C+IbNa8hSt3upmTiplHMmg== X-Received: by 2002:a05:600c:1d28:b0:3d2:1d51:246e with SMTP id l40-20020a05600c1d2800b003d21d51246emr61051690wms.9.1673602610432; Fri, 13 Jan 2023 01:36:50 -0800 (PST) Received: from [192.168.7.125] ([54.239.6.185]) by smtp.gmail.com with ESMTPSA id n14-20020a05600c3b8e00b003b49bd61b19sm32786709wms.15.2023.01.13.01.36.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Jan 2023 01:36:50 -0800 (PST) Message-ID: <83f7982d-272a-b064-8a0f-8853354edf10@gmail.com> Date: Fri, 13 Jan 2023 10:36:49 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: Generate pg_stat_get_xact*() functions with Macros Content-Language: en-US To: Andres Freund Cc: Michael Paquier , PostgreSQL Hackers References: <89606d96-cd94-af74-18f3-c7ab2b684ba2@gmail.com> <20230111225907.6el6c5j3hukizqxc@awork3.anarazel.de> <20230112182434.ejffbun4plv2g37k@awork3.anarazel.de> From: "Drouvot, Bertrand" In-Reply-To: <20230112182434.ejffbun4plv2g37k@awork3.anarazel.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 1/12/23 7:24 PM, Andres Freund wrote: > Hi, > > On 2023-01-12 08:38:57 +0100, Drouvot, Bertrand wrote: >> On 1/11/23 11:59 PM, Andres Freund wrote: >>>> Now that this patch renames some fields >>> >>> I don't mind renaming the fields - the prefixes really don't provide anything >>> useful. But it's not clear why this is related to this patch? You could just >>> include the f_ prefix in the macro, no? >>> >>> >> >> Right, but the idea is to take the same approach that the one used in 8018ffbf58 (where placing the prefixes in the macro >> would have been possible too). > > I'm not super happy about that patch tbh. > > >>> Probably should remove PgStat_BackendFunctionEntry. >> >> I think that would be a 3rd patch, agree? > > Yep. > > > >>> I now see that PG_STAT_GET_DBENTRY_FLOAT8 already exists, defined the same >>> way. But the name fields misleading enough that I'd be inclined to rename it? >>> >> >> PG_STAT_GET_FUNCENTRY_FLOAT8_MS looks good by me. Waiting on what we'll decide for >> the existing PG_STAT_GET_DBENTRY_FLOAT8 (so that I can align for the PG_STAT_GET_FUNCENTRY_FLOAT8). > > +1 > > > >>> Although I suspect this actually hints at an architectural thing that could be >>> fixed better: Perhaps we should replace find_tabstat_entry() with a version >>> returning a fully "reconciled" PgStat_StatTabEntry? It feels quite wrong to >>> have that intimitate knowledge of the subtransaction stuff in pgstatfuncs.c >>> and about how the different counts get combined. >>> >>> I think that'd allow us to move the definition of PgStat_TableStatus to >>> PgStat_TableXactStatus, PgStat_TableCounts to pgstat_internal.h. Which feels a >>> heck of a lot cleaner. >> >> Yeah, I think that would be for a 4th patch, agree? > > Yea. I am of multiple minds about the ordering. I can see benefits on fixing > the architectural issue before reducing duplication in the accessor with a > macro. The reason is that if we addressed the architectural issue, the > difference between the xact and non-xact version will be very minimal, and > could even be generated by the same macro. > Yeah, I do agree and I'm in favor of this ordering: 1) replace find_tabstat_entry() with a version returning a fully "reconciled" PgStat_StatTabEntry 2) remove prefixes 3) Introduce the new macros And it looks to me that removing PgStat_BackendFunctionEntry can be done independently I'll first look at 1). Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com