Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vSqOn-006k4f-0q for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Dec 2025 05:36:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vSqOl-0037VO-2f for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Dec 2025 05:36:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vSqOl-0037VF-1j for pgsql-hackers@lists.postgresql.org; Tue, 09 Dec 2025 05:36:31 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vSqOj-003ys8-2G for pgsql-hackers@lists.postgresql.org; Tue, 09 Dec 2025 05:36:31 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-29558061c68so63612015ad.0 for ; Mon, 08 Dec 2025 21:36:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765258588; x=1765863388; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HrOLw8EMN1fRWTPi6H3B2Qdinm4Ev6BOEzuzFWSogXU=; b=QE8Es8RcJyKWH7eOwuDnCjfLO7AEe5SEBdikqao7atYHYb14+NWZoM8v+xwtCHZygK +qZrrfmRlxDOKRD749QlZBZ5xw/Y+2UW80/x7L+ibRfK20Euiav9guHQk3+U5UWpMBnu 26gD9UE+JF7Qx0l5z+beF1CHB0nTaDPnbhLrKyqwoJFWxCnx0Mh/xmm6WtO0omIPBn+2 Cc7K0EBYN/KO6XFvzsvDd4JF3mQ4jgpXFJJ8Gj4oHFtdIj+tfcBL3yWqaiRy29PPUnug hQiwd1bq/xOlTTLlM4Bhx/vCu8fw2G+HhdppCcBJvcFJeiYX7yaIZFY9TKRJKpiftJyq D2VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765258588; x=1765863388; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=HrOLw8EMN1fRWTPi6H3B2Qdinm4Ev6BOEzuzFWSogXU=; b=RLDwlW2uwdlpSRlMLsdY9UCeLc/6tlnz2rOLxgDMTz6kvWVaejkP3Zb6UAjeflzoyZ P7hPf9VrYVZ1FM+1cfN15Pbf66HAmGTA+CmtNC6uVGM9T3damxOTE6EtGhy0TSpD1NeI VjLkXawQWSJ9v8Bx63peDMAi+YOI9n4L7JRnHpUDxTqolK0kd1C62y3w6DozaxVPaw+u mCW7QsHcN0C7rTvNJwKjqwIh4F5LzVd3wJ6yO4fDWUZcg1vCkYGDzsK9YyDEK0+EBSqM 2nChGAJOEWOdAE5eX5ChVzmiKcP8zIsfmD98YWvzzVo7nbml+XkRX+BKkCJcz2gjAfuL tKMQ== X-Forwarded-Encrypted: i=1; AJvYcCUn5RnXcIg0mqTh1Y8rFxHyixbZgtliMic1bTMFcVDKqoWWOwddSviOarMHEpuVSF2xuoesZgMAdU0eVihI@lists.postgresql.org X-Gm-Message-State: AOJu0YyAYq1jptgFo1fQAzcR/l8rOINNuJBPaJWM9Ys1beecmYf1NZsm SqBKSGqr8ke9kVPdL6zTXSmcj+uvt+39kRrSWAEa3u2sqgZNHPxa75IE X-Gm-Gg: ASbGnctcBeasIOjUGw/skish/amQDzNf7kTGHkAKBVZqnLduNG0Gv5UNld5UB2N9rwI lluYDT2zZyDnfOB8iK2QciCWzFYM3rO32MicKMFjEWvGoAZ4SmoUqUJykQFxkuyfBwtkeOXKpK0 ejxBf8tcVGzrCaL5idCXHVuiJ27b0ZgjHetK5WL/V+rKv4/8CYHNb4/0efrBqRVNNh8yuIeC6Ce jAJjELGsgthAK8r3sRR7bZRVAobT+y+tVV1t6t0t28i1ArZ1JX5gKralfTSO+aJ+2tcSYpBWE6L GACqAqGSXuukycsQMSO3ky2uzFL+uJCCjlTgHrSoX/RmMad6mZY6sRHighKa8hu+bgTARsAKZGP 4b2EN2VFf8qfHwZ4FSZ0nqqySAmI47+jXCIkDQ7ThFhdfLuJbq8CF23QzDlzMgJI+XH2LwTCfQa OXpg5MCAqVP2vuBvPTedQ= X-Google-Smtp-Source: AGHT+IFZHZ855HeHrVHnejvw/bcuHLuJJQm1iLwp1PRxF2Z0S4Y/Rk2HidAXk3uD5XXQfHEHnemajw== X-Received: by 2002:a17:903:b83:b0:298:4ee2:19f3 with SMTP id d9443c01a7336-29df5dbb9d9mr98687455ad.49.1765258587504; Mon, 08 Dec 2025 21:36:27 -0800 (PST) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29e9b548a4esm6895845ad.22.2025.12.08.21.36.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Dec 2025 21:36:27 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: [Proposal] Adding callback support for custom statistics kinds From: Chao Li In-Reply-To: Date: Tue, 9 Dec 2025 13:35:47 +0800 Cc: Sami Imseih , PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: <9252DA7C-C611-4A93-A484-E6CD42557C15@gmail.com> References: <4FEEC2B8-D9CF-4BD0-AA7E-44CE3E27ADD8@gmail.com> <5EC13E39-B41E-464A-B382-0ACEB18A15BB@gmail.com> To: Michael Paquier X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Dec 9, 2025, at 13:23, Chao Li wrote: >=20 >=20 >=20 >> On Dec 9, 2025, at 12:45, Michael Paquier = wrote: >>=20 >> It seems to me that you are missing nothing here, and that Chao has >> missed the fact that the end of pgstat_read_statsfile() does a "goto >> done", meaning that we would take a round of >=20 > No, I didn=E2=80=99t miss that part. But in the =E2=80=9Cdone=E2=80=9D = clause: >=20 > ``` > done: > /* First, cleanup the main stats file, PGSTAT_STAT_PERMANENT_FILENAME = */ > FreeFile(fpin); >=20 > elog(DEBUG2, "removing permanent stats file \"%s\"", statfile); > unlink(statfile); >=20 > /* Let each stats kind run its cleanup callback, if it provides one */ > for (PgStat_Kind kind =3D PGSTAT_KIND_MIN; kind <=3D PGSTAT_KIND_MAX; = kind++) > { > const PgStat_KindInfo *kind_info =3D pgstat_get_kind_info(kind); >=20 > if (kind_info && kind_info->end_extra_stats) > kind_info->end_extra_stats(STATS_READ); > } > ``` >=20 > end_extra_stats(STATS_READ) has no failure indication. >=20 Sorry, I incidentally clicked =E2=80=9Csend=E2=80=9D too quickly. My point is that, there are many places jumping to =E2=80=9Cerror=E2=80=9D= , then from =E2=80=9Cerror=E2=80=9D goto =E2=80=9Cdone=E2=80=9D, if an = error didn=E2=80=99t happen from the deserialize callback, how = end_extra_stats() can know if failure happened and takes action = accordingly? Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/