Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kwpxX-00029P-Nb for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Jan 2021 17:17:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kwpxW-0005ZA-Kw for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Jan 2021 17:17:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kwpxW-0005Yx-9x for pgsql-hackers@lists.postgresql.org; Tue, 05 Jan 2021 17:17:26 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kwpxT-0006SK-KH for pgsql-hackers@postgresql.org; Tue, 05 Jan 2021 17:17:25 +0000 Received: by mail-pj1-x1031.google.com with SMTP id z12so18220pjn.1 for ; Tue, 05 Jan 2021 09:17:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:mime-version :content-transfer-encoding; bh=G9GJSdX+IJ7Yf4AMOpH+BhJcL+DIHNUkzbz1KZP5kL8=; b=vdd8gAzd8L5bIjBZMjgzmX/i7AvG2iMTjw0YbUWUQ/DG9PWpAE5VfkjA0uGiSpPcd9 aequIvBXksp8+K/MKAm16RFQotEU4DI9JmhglZipihBncKwO78+PvWl+Gyo87Ru1janM gyngzQFFAE/U49ZyOsyAFdgRgYTZHrl7+lJs6iFwFWwwOKKGW+gyCwGhDbpBfb2+LHig EHEPFsFFO2oJB6ocvC6J7xFH/hWufLmx/pnuWhuxajaMeNmRFUgtTbP5j0xzGhfKGiNV NXdfu+d40/NpIsA+3Xeom8D+eQVZpMLOJWzw2bDFTIwbWSUlUt5TMweN5lXmMLs97TBZ bMiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:mime-version :content-transfer-encoding; bh=G9GJSdX+IJ7Yf4AMOpH+BhJcL+DIHNUkzbz1KZP5kL8=; b=UvKHMSzX5z9QBUz7gDc5Jvl9sWaCk1R8u5jWeWEhWdvdFkSEmMSxQEUMoKpiUoYSM1 riStsOkV6/ps+zdoPYlyAFn8wyr5eAs7QIXbPA/TaTCkYI919HwYa7JaWhwhj183sUf5 U1YOLgWReavzhX2kPkNrNxsQMZp+VnbmHgjTA+yjKVLoXh9ZtyLNO3pELMLqF/a5UvHi aaNSrSTB5DSA6puiQelR7Q5AzB1pfbqAA3o8CiYG969IzfccmY22yaSvPbpnT+cOO2Qf iOeMCMAjw2f9Yf87F3BiqYnPPljUjMs161+lbX94oFeQwIY2rqN9s86zWwd35QO9lnVj g4UQ== X-Gm-Message-State: AOAM530GQbFjQHFjSYLOutYtgdiUgUYVEwSpcBaBGhDHq0D5H4cA99Ln DCWfehOQg8JFFm2wdSRad0IRkO+3W4qbjg== X-Google-Smtp-Source: ABdhPJxEL0JV+UjJZovWdUHKL+9mY0IWJjGq55hv6/MkrMIN3kSj11LVgG6YmhAnufqHs+Rv8UWZ8g== X-Received: by 2002:a17:90b:204:: with SMTP id fy4mr241489pjb.57.1609867041822; Tue, 05 Jan 2021 09:17:21 -0800 (PST) Received: from jdavis.lan (c-73-231-146-4.hsd1.ca.comcast.net. [73.231.146.4]) by smtp.gmail.com with ESMTPSA id x5sm130270pjr.38.2021.01.05.09.17.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jan 2021 09:17:20 -0800 (PST) Message-ID: <0a2c985ebcaa1acd385350aeba561b6509187394.camel@j-davis.com> Subject: Replication protocol pipelining edge case From: Jeff Davis To: pgsql-hackers@postgresql.org Date: Tue, 05 Jan 2021 09:17:18 -0800 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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