Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iE7rP-0000Fs-QD for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Sep 2019 08:13:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iE7rN-0002Ld-AH for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Sep 2019 08:13:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iE7rM-0002JG-RW for pgsql-hackers@lists.postgresql.org; Sat, 28 Sep 2019 08:13:45 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iE7rK-0004HJ-92 for pgsql-hackers@postgresql.org; Sat, 28 Sep 2019 08:13:43 +0000 Received: by mail-wm1-x32b.google.com with SMTP id y135so10155746wmc.1 for ; Sat, 28 Sep 2019 01:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:in-reply-to:references:comments:mime-version :content-id:content-transfer-encoding:date:message-id; bh=ir/HjqOUVL5Voy5SKsuCxrxfpdSGCofSXh/KFTMmpXs=; b=dpCEXqz8u1e8Tt7aBDgBi3GJ2SDWn4aI8mkEOtTe7jK/jGOrA6T8ILf+sfrXPGp2UF hIPVJ7fs0dOrcGGdEHR3neahURnDxOGPOfEGLryuNsRbyUQzyTvdSDGMTv3eaHwWqX7A NgSQKWer/AtCOrej4EiHeJopgBb2Lg/Ceigf9mWBmu13MqzBO96PPE7nX3WrdSQfQZLJ mxYonhan0e7Ut9McthC1lOi+S0zVMD0EVsulXhlWq6E8XfXQFrK3zqRscVqiF0u69i0N +8O40BFzwwLKPxN65+BvMYIGIJMgW2zFy3cVNPAxZJymwpS3e7labzvPOo0/jr/oYZJ8 3KxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :comments:mime-version:content-id:content-transfer-encoding:date :message-id; bh=ir/HjqOUVL5Voy5SKsuCxrxfpdSGCofSXh/KFTMmpXs=; b=a7AFmwm+ssK/VSKzi0k5ervXW9jWwKQYOZXGSBeUwpSSxN30NcFeY1Gd7kTFLxBz2u uXHKwuMenDM7qjXx/hEFxdvSu/vA66txGpaaRBEh52u9yDt9ZRZNLtLZjvU4w0Zqjgvt 2ctOz46W96U6u4LuVe/tq01JvY6clC1jrCX90G/XFd1kllSb03edtQAkutbRgLmdzKTF uWbmhk4VyoDoDYciocO2AEKiC9N1OI8x1GE4KUc/OKBA6OfHuKl77KMSJUEjPf4GlsGD iHxP8YSDjRlXzkhsMYo11s2u3q2Bz5l8jrgfQUPxqsLYd+JBJabc3GIGtkKu74Zl16QX IXgg== X-Gm-Message-State: APjAAAX0+/EBDV8tg0D/UHq7qXEUucI+k/v0qH8wsyFeRW5hBFFtBJQw haHywUWooHW6NsWzq0tKP+78hQ== X-Google-Smtp-Source: APXvYqwn87r97iFuFUR/oUsPnPJX9UtYdOoXJ4vBBM28ItbqfIuH0MHxM+arhQNxZwOuJDIn+axbEA== X-Received: by 2002:a7b:c761:: with SMTP id x1mr2856345wmk.47.1569658419684; Sat, 28 Sep 2019 01:13:39 -0700 (PDT) Received: from antos ([77.87.240.5]) by smtp.gmail.com with ESMTPSA id x2sm6478852wrn.81.2019.09.28.01.13.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Sep 2019 01:13:39 -0700 (PDT) From: Antonin Houska To: Alvaro Herrera cc: Thomas Munro , Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: Attempt to consolidate reading of XLOG page In-reply-to: <20190927191736.GA13447@alvherre.pgsql> References: <20190927191736.GA13447@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Fri, 27 Sep 2019 16:17:36 -0300." X-Mailer: MH-E 8.6+git; nmh 1.7; GNU Emacs 26.2.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7752.1569658465.1@antos> Content-Transfer-Encoding: quoted-printable Date: Sat, 28 Sep 2019 10:14:25 +0200 Message-ID: <7753.1569658465@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera wrote: > BTW that tli_p business to the openSegment callback is horribly > inconsistent. Some callers accept a NULL tli_p, others will outright > crash, even though the API docs say that the callback must determine the > timeline. This is made more complicated by us having the TLI in "seg" > also. Unless I misread, the problem is again that the walsender code is > doing nasty stuff with globals (endSegNo). As a very minor stylistic > point, we prefer to have out params at the end of the signature. XLogRead() tests for NULL so it should not crash but I don't insist on doi= ng it this way. XLogRead() actually does not have to care whether the "open segment callback" determines the TLI or not, so it (XLogRead) can always receive a valid pointer to seg.ws_tli. However that in turn implies that XLogRead() does not need the "tli" argument at all. > > > Why do we leave this responsibility to ReadPageInternal? Wouldn't i= t > > > make more sense to leave XLogRead be always responsible for setting > > > these correctly, and remove those lines from ReadPageInternal? > > = > > I think there's no rule that ReadPageInternal() must use XLogRead(). I= f we do > > what you suggest, we need make this responsibility documented. I'll co= nsider > > that. I think now we should not add any responsibility to XLogPageReadCB or its subroutines because some extensions might already have their implementatio= n of XLogPageReadCB w/o XLogRead, and this change would break them. -- = Antonin Houska Web: https://www.cybertec-postgresql.com