Re: Add a write_to_file member to PgStat_KindInfo - Mailing list pgsql-hackers

From Nazir Bilal Yavuz
Subject Re: Add a write_to_file member to PgStat_KindInfo
Date
Msg-id CAN55FZ0a--apePFrTQqB+mWXOhDSG=i9=Mb25qa5qgwWUgCJGw@mail.gmail.com
Whole thread Raw
In response to Re: Add a write_to_file member to PgStat_KindInfo  (Nazir Bilal Yavuz <byavuz81@gmail.com>)
List pgsql-hackers
Hi,

On Thu, 21 Nov 2024 at 09:32, Bertrand Drouvot
<bertranddrouvot.pg@gmail.com> wrote:
> That was in fact the main reason why I added this test. But well, just
> adding the "write_to_file" in the injection test is enough to "show" that this
> member does exist. So I'm fine with v3.

I think that the changes below (write_to_file checks) should come
after the assertion checks. Otherwise, they could mask some problems.

=== 1
-        if (!info || !info->fixed_amount)
+        /* skip if not fixed or this kind does not want to write to the file */
+        if (!info || !info->fixed_amount || !info->write_to_file)
             continue;

         if (pgstat_is_kind_builtin(kind))
            Assert(info->snapshot_ctl_off != 0);

=== 2
         kind_info = pgstat_get_kind_info(ps->key.kind);

+        /* skip if this kind does not want to write to the file */
+        if (!kind_info->write_to_file)
+            continue;
+
         /* if not dropped the valid-entry refcount should exist */
         Assert(pg_atomic_read_u32(&ps->refcount) > 0);
===

--
Regards,
Nazir Bilal Yavuz
Microsoft



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: On non-Windows, hard depend on uselocale(3)
Next
From: Peter Eisentraut
Date:
Subject: Re: Changing shared_buffers without restart