Re: Replication slot stats misgivings

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: Replication slot stats misgivings
Дата
Msg-id CAA4eK1K4OYz3W8dUNc2q70+JxXK-BbGpd7FVjQxmj9qTSONWiA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Replication slot stats misgivings  (vignesh C <vignesh21@gmail.com>)
Ответы Re: Replication slot stats misgivings
Re: Replication slot stats misgivings
Список pgsql-hackers
On Wed, Apr 7, 2021 at 2:51 PM vignesh C <vignesh21@gmail.com> wrote:
>

@@ -4069,6 +4069,24 @@ pgstat_read_statsfiles(Oid onlydb, bool
permanent, bool deep)
  * slot follows.
  */
  case 'R':
+ /*
+ * There is a remote scenario where one of the replication slots
+ * is dropped and the drop slot statistics message is not
+ * received by the statistic collector process, now if the
+ * max_replication_slots is reduced to the actual number of
+ * replication slots that are in use and the server is
+ * re-started then the statistics process will not be aware of
+ * this. To avoid writing beyond the max_replication_slots
+ * this replication slot statistic information will be skipped.
+ */
+ if (max_replication_slots == nReplSlotStats)
+ {
+ ereport(pgStatRunningInCollector ? LOG : WARNING,
+ (errmsg("skipping \"%s\" replication slot statistics as
pg_stat_replication_slots does not have enough slots",
+ NameStr(replSlotStats[nReplSlotStats].slotname))));
+ goto done;
+ }

I think we might truncate some valid slots here. I have another idea
to fix this case which is that while writing, we first write the
'nReplSlotStats' and then write each slot info. Then while reading we
can allocate memory based on the required number of slots. Later when
startup process sends the slots, we can remove the already dropped
slots from this array. What do you think?

-- 
With Regards,
Amit Kapila.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Order dependency in function test
Следующее
От: Bharath Rupireddy
Дата:
Сообщение: Re: CREATE SEQUENCE with RESTART option