postgresql/contrib/test_decoding
Amit Kapila 3fa17d3771 Use HTAB for replication slot statistics.
Previously, we used to use the array of size max_replication_slots to
store stats for replication slots. But that had two problems in the cases
where a message for dropping a slot gets lost: 1) the stats for the new
slot are not recorded if the array is full and 2) writing beyond the end
of the array if the user reduces the max_replication_slots.

This commit uses HTAB for replication slot statistics, resolving both
problems. Now, pgstat_vacuum_stat() search for all the dead replication
slots in stats hashtable and tell the collector to remove them. To avoid
showing the stats for the already-dropped slots, pg_stat_replication_slots
view searches slot stats by the slot name taken from pg_replication_slots.

Also, we send a message for creating a slot at slot creation, initializing
the stats. This reduces the possibility that the stats are accumulated
into the old slot stats when a message for dropping a slot gets lost.

Reported-by: Andres Freund
Author: Sawada Masahiko, test case by Vignesh C
Reviewed-by: Amit Kapila, Vignesh C, Dilip Kumar
Discussion: https://postgr.es/m/20210319185247.ldebgpdaxsowiflw@alap3.anarazel.de
2021-04-27 09:09:11 +05:30
..
expected Fix test case added by commit f5fc2f5b23. 2021-04-19 09:02:47 +05:30
specs Add option to enable two_phase commits via pg_create_logical_replication_slot. 2021-03-03 07:34:11 +05:30
sql Fix test case added by commit f5fc2f5b23. 2021-04-19 09:02:47 +05:30
t Use HTAB for replication slot statistics. 2021-04-27 09:09:11 +05:30
.gitignore Improve isolation tests infrastructure. 2017-03-14 15:56:17 -07:00
logical.conf Add logical_decoding_work_mem to limit ReorderBuffer memory usage. 2019-11-19 07:32:36 +05:30
Makefile Add information of total data processed to replication slot stats. 2021-04-16 07:34:43 +05:30
test_decoding.c Add a xid argument to the filter_prepare callback for output plugins. 2021-03-30 10:34:43 +05:30