Re: Replication slot stats misgivings
От | Amit Kapila |
---|---|
Тема | Re: Replication slot stats misgivings |
Дата | |
Msg-id | CAA4eK1+J4oPex4S90-AYPJ__TEnksq58xPePiA1Dv8envEFTjw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Replication slot stats misgivings (Masahiko Sawada <sawada.mshk@gmail.com>) |
Ответы |
Re: Replication slot stats misgivings
|
Список | pgsql-hackers |
On Tue, Apr 20, 2021 at 7:54 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > I have one question: + /* + * Create the replication slot stats hash table if we don't have + * it already. + */ + if (replSlotStats == NULL) { - if (namestrcmp(&replSlotStats[i].slotname, name) == 0) - return i; /* found */ + HASHCTL hash_ctl; + + hash_ctl.keysize = sizeof(NameData); + hash_ctl.entrysize = sizeof(PgStat_StatReplSlotEntry); + hash_ctl.hcxt = pgStatLocalContext; + + replSlotStats = hash_create("Replication slots hash", + PGSTAT_REPLSLOT_HASH_SIZE, + &hash_ctl, + HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); } It seems to me that the patch is always creating a hash table in pgStatLocalContext? AFAIU, we need to create it in pgStatLocalContext when we read stats via backend_read_statsfile so that we can clear it at the end of the transaction. The db/function stats seems to be doing the same. Is there a reason why here we need to always create it in pgStatLocalContext? -- With Regards, Amit Kapila.
В списке pgsql-hackers по дате отправления: