Re: Resetting spilled txn statistics in pg_stat_replication
От | Masahiko Sawada |
---|---|
Тема | Re: Resetting spilled txn statistics in pg_stat_replication |
Дата | |
Msg-id | CA+fd4k4KwfdB2oT61We5fEYwoZSVWrrqxsuSPy5+bFYY6CCFvQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Resetting spilled txn statistics in pg_stat_replication (Amit Kapila <amit.kapila16@gmail.com>) |
Ответы |
Re: Resetting spilled txn statistics in pg_stat_replication
|
Список | pgsql-hackers |
On Thu, 16 Jul 2020 at 20:01, Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Thu, Jul 16, 2020 at 4:04 PM Masahiko Sawada > <masahiko.sawada@2ndquadrant.com> wrote: > > > > On Thu, 16 Jul 2020 at 18:16, Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > > > On Thu, Jul 16, 2020 at 1:45 PM Masahiko Sawada > > > <masahiko.sawada@2ndquadrant.com> wrote: > > > > > > > > A possible solution would be to add an in-use flag to > > > > PgStat_ReplSlotStats indicating whether the stats for slot is used or > > > > not. When receiving a drop message for a slot, the stats collector > > > > just marks the corresponding stats as unused. When receiving the stats > > > > report for a new slot but there is no unused stats slot, ignore it. > > > > What do you think? > > > > > > > > > > As of now, you have a boolean flag msg.m_drop to distinguish the drop > > > message but we don't have a similar way to distinguish the 'create' > > > message. What if have a way to distinguish 'create' message (we can > > > probably keep some sort of flag to indicate the type of message > > > (create, drop, update)) and then if the slot with the same name > > > already exists, we ignore such a message. Now, we also need a way to > > > create the entry for a slot for a normal stats update message as well > > > to accommodate for the lost 'create' message. Does that make sense? > > > > I might be missing your point, but even if we have 'create' message, > > the problem can happen if when slots are full the user drops slot > > ‘slot_a’, creates slot ‘slot_b', and messages arrive in the reverse > > order? > > > > In that case, also, we should drop the 'create' message of 'slot_b' as > we don't have space but later when an 'update' message arrives with > stats for the 'slot_b', we will create the entry. Agreed. > I am also thinking > what if send only 'update' and 'drop' message, the message ordering > problem can still happen but we will lose one 'update' message in that > case? Yes, I think so too. We will lose one 'update' message at a maximum. I've updated the patch so that the stats collector ignores the 'update' message if the slot stats array is already full. Regards, -- Masahiko Sawada http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Вложения
В списке pgsql-hackers по дате отправления: