Persist slot invalidation correctly
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Sat, 27 Jun 2020 00:41:29 +0000 (20:41 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Sat, 27 Jun 2020 00:41:29 +0000 (20:41 -0400)
commit4ae08cd5fd19d566538005c15e7bf992ebae4c72
treeb0aa315383a2cf84e373f8ac617c268c6d572912
parenteca08f58d05f45c4cae02bca5e1556ba58732fc4
Persist slot invalidation correctly

We failed to save slot to disk after invalidating it, so the state was
lost in case of server restart or crash.  Fix by marking it dirty and
flushing.

Also, if the slot is known invalidated we don't need to reason about the
LSN at all -- it's known invalidated.  Only test the LSN if the slot is
known not invalidated.

Author: Fujii Masao <masao.fujii@oss.nttdata.com>
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/17a69cfe-f1c1-a416-ee25-ae15427c69eb@oss.nttdata.com
src/backend/replication/slot.c
src/backend/replication/slotfuncs.c