Dear Hou,
Thanks for updating the patch. I ran tests and reproducer [1] for all versions.
Confirmed the issue happened before the patch and fixed after applying them.
One difference between master and others is that pg_sync_replication_slots()
on HEAD is not returned. Because the behavior was changed by 0d2d4a0, not
related with the fix.
I feel these patches are enough good shape.
[1]:
https://www.postgresql.org/message-id/TY7PR01MB14554DBE84290130EB421DD28F596A%40TY7PR01MB14554.jpnprd01.prod.outlook.com
Best regards,
Hayato Kuroda
FUJITSU LIMITED