Although it's not performance-critical, I think it just makes sense to breakthe loop in replorigin_session_setup() as soon as we've found the origin.
-- Antonin HouskaWeb: https://www.cybertec-postgresql.com