Hi Sawada-san,
Attached v5 drops the lock and adds a comment on why the read is safe.It also adds the !OidIsValid(leader->roleId) check and sets roleId toInvalidOid directly, so only a leader with no advertised role changesanything.
Thanks,Shihao