On Thu, Jul 16, 2020 at 4:04 PM Masahiko Sawada <masahiko.saw...@2ndquadrant.com> wrote: > > On Thu, 16 Jul 2020 at 18:16, Amit Kapila <amit.kapil...@gmail.com> wrote: > > > > On Thu, Jul 16, 2020 at 1:45 PM Masahiko Sawada > > <masahiko.saw...@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. 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? -- With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com