Thread

Commits

  1. Documenation fixups for replication protocol.

  1. Replication protocol pipelining edge case

    Jeff Davis <pgsql@j-davis.com> — 2021-01-05T17:17:18Z

    The streaming replication protocol docs[1] say (for START_REPLICATION):
    
    "If the client requests streaming at exactly the end of an old
    timeline, the server responds immediately with CommandComplete without
    entering COPY mode."
    
    Is there a reason we do that? It seems like enough of an edge case that
    it's not worth optimizing.
    
    The reason I ask is because it makes clients that do pipelining more
    complex. If the server always enters copy mode, then the client can
    send a CopyDone and then pipeline more requests behind it. But if the
    server may or may not enter copy mode, then the client needs to wait
    until it sees a CopyBothResponse before any new requests can be
    pipelined.
    
    To be clear, my concern is mainly about the simplicity of the protocol
    and the simplicity of clients that support pipelining. I am not arguing
    that there's an important use case for pipelining requests in this
    manner.
    
    Also, I'm curious if we know about other areas where the protocol
    doesn't mix nicely with pipelining.
    
    In a related note, I think the documentation text above is also
    incorrect, because streaming from an old timeline will send a tuple
    back before CommandComplete.
    
    Regards,
    	Jeff Davis
    
    [1] https://www.postgresql.org/docs/devel/protocol-replication.html
    
    
    
    
    
    
  2. Re: Replication protocol pipelining edge case

    Jeff Davis <pgsql@j-davis.com> — 2021-01-05T23:23:34Z

    On Tue, 2021-01-05 at 09:17 -0800, Jeff Davis wrote:
    > The reason I ask is because it makes clients that do pipelining more
    > complex. If the server always enters copy mode, then the client can
    > send a CopyDone and then pipeline more requests behind it. But if the
    > server may or may not enter copy mode, then the client needs to wait
    > until it sees a CopyBothResponse before any new requests can be
    > pipelined.
    
    In an offline conversation with Andres, he pointed out that we can
    never be sure that we'll enter COPY mode, because the START_REPLICATION
    command could throw an error. Therefore we need to always wait for the
    CopyBothResponse, and can't pipeline any new commands until we get it.
    
    Regards,
    	Jeff Davis