• Andres Freund's avatar
    Again report a useful error message when walreceiver's connection closes. · 5fd56b9f
    Andres Freund authored
    Since 7c4f5240 (merged in v10), a shutdown master is reported as
      FATAL:  unexpected result after CommandComplete: server closed the connection unexpectedly
    by walsender. It used to be
      LOG:  replication terminated by primary server
      FATAL:  could not send end-of-streaming message to primary: no COPY in progress
    while the old message clearly is not perfect, it's definitely better
    than what's reported now.
    
    The change comes from the attempt to handle finished COPYs without
    erroring out, needed for the new logical replication, which wasn't
    needed before.
    
    There's probably better ways to handle this, but for now just
    explicitly check for a closed connection.
    
    Author: Petr Jelinek
    Reviewed-By: Andres Freund
    Discussion: https://postgr.es/m/f7c7dd08-855c-e4ed-41f4-d064a6c0665a@2ndquadrant.com
    Backpatch: -
    5fd56b9f
libpqwalreceiver.c 24.9 KB