Avoid updating inactive_since for invalid replication slots. It is possible for the inactive_since value of an invalid replication slot to be updated multiple times, which is unexpected behavior like during the release of the slot or at the time of restart. This is harmless because invalid slots are not allowed to be accessed but it is not prudent to update invalid slots. We are planning to invalidate slots due to other reasons like idle time and it will look odd that the slot's inactive_since displays the recent time in this field after invalidated due to idle time. So, this patch ensures that the inactive_since field of slots is not updated for invalid slots.
In the passing, ensure to use the same inactive_since time for all the slots at restart while restoring them from the disk. Author: Nisha Moond <nisha.moond...@gmail.com> Author: Bharath Rupireddy <bharath.rupireddyforpostg...@gmail.com> Reviewed-by: Vignesh C <vignes...@gmail.com> Reviewed-by: Peter Smith <smithpb2...@gmail.com> Reviewed-by: Hou Zhijie <houzj.f...@fujitsu.com> Reviewed-by: Amit Kapila <amit.kapil...@gmail.com> Discussion: https://postgr.es/m/CABdArM7QdifQ_MHmMA=cc4v8+meckkwkncm2nn6tx9wscq-...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/0ec3c295e7594ed3af86bca1a4b4be269c2f069d Modified Files -------------- doc/src/sgml/system-views.sgml | 3 ++- src/backend/replication/logical/slotsync.c | 4 +--- src/backend/replication/slot.c | 21 ++++++++++----------- src/include/replication/slot.h | 17 +++++++++++++++++ 4 files changed, 30 insertions(+), 15 deletions(-)