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 1iYBGO-0001n5-Uy for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Nov 2019 15:54:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iYBGN-0004Gz-F7 for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Nov 2019 15:54:27 +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 1iYBGN-0004Gs-01 for pgsql-hackers@lists.postgresql.org; Fri, 22 Nov 2019 15:54:27 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iYBGJ-0007lK-C3 for pgsql-hackers@postgresql.org; Fri, 22 Nov 2019 15:54:25 +0000 Received: by mail-wr1-x444.google.com with SMTP id 4so5878874wro.7 for ; Fri, 22 Nov 2019 07:54:22 -0800 (PST) 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:date:message-id; bh=wECHMV9N0Z71ZhgK6MXWhMAZfOojeW4sKk4VUC3MWx0=; b=GRf1MDIXXyfTypo4aGiuSPPfcQQlghFHxdiUXxuc3KEyY4yPS9dkPuuYqPJTZJCM2p Dyr1ucGA62JdUs8+1sxlZR8rtdhewTW7rgEadtAUTbrMsi0FpbXQywnVRBoRcNzYbUuN wlcTFzntC9u5u7hkncMl05mQH+NdYnDevP5gHQ08+xGJluXgrLpSZB1O8CYk+IZ7RWNe AU9cNRhhcRcbfdrx1Mcegrq2lSnmgiIdmwhfiocb6VQMyjcXVBlh7yAP34Ru4zfZYcU8 E79mC1QrjPis8gTG9qXJ/0QjiE6XMR9oR4w7p95AiKBTgc4x5Hjg4qm6+LYfzDRfvhYe ULsA== 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:date:message-id; bh=wECHMV9N0Z71ZhgK6MXWhMAZfOojeW4sKk4VUC3MWx0=; b=FhsxohOa8OXAirohth8oAn1sfsN9riQfcz5OZn6cJhq3wTVWc4Dw6fuOX0CbwoT6dD 6YAsEdy48EpH5AsVo8OK8M3IVaIe3Z/xxfBHLcKzZIguKsoexfTfOzsk0sUsVoIzsEnH qNkxPD2k4ROUblCpeuVHa21R87zJAFd2RPxXHFpTVS0YcpOaA1j7+51HFpEINXobZ8De q+yMp+yLJOKlinkPQWD3xWbs+dfa4q24YRcl0mfDy7jXlnc0pXblnJt91hm2LHzwvYga nKXcn3wDi1KUG4k4rlKF9AziddxJ1dlo21AyVhTwtYHrm0QV9ulaLKtVEcyjy2fURaYG /Xlg== X-Gm-Message-State: APjAAAV3SH105dA4QmL6q+RjHF61M3WrrMgLG/9upnCYSrvEMZkrb8Y6 nuPBBsM5C/+ITtrTChO2b9CDww== X-Google-Smtp-Source: APXvYqzMIcIjCAgf/eAFhLn3m1LfRo7O6K2GWskNkM0nGwIOzibfG7lgAJv0G1UHhfZF32tTbyYy4Q== X-Received: by 2002:a5d:526f:: with SMTP id l15mr18082885wrc.169.1574438061955; Fri, 22 Nov 2019 07:54:21 -0800 (PST) Received: from antos ([77.87.240.5]) by smtp.gmail.com with ESMTPSA id v6sm8334084wrt.13.2019.11.22.07.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2019 07:54:21 -0800 (PST) From: Antonin Houska To: Alvaro Herrera cc: Michael Paquier , Thomas Munro , Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: Attempt to consolidate reading of XLOG page In-reply-to: <20191122142528.GA6465@alvherre.pgsql> References: <20191122142528.GA6465@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Fri, 22 Nov 2019 11:25:28 -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: <10179.1574438120.1@antos> Date: Fri, 22 Nov 2019 16:55:20 +0100 Message-ID: <10180.1574438120@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera wrote: > On 2019-Nov-22, Michael Paquier wrote: > > > On Fri, Nov 22, 2019 at 10:35:51AM -0300, Alvaro Herrera wrote: > > > FWIW I think the new code is buggy because it doesn't seem to be setting > > > ws_off, so I suppose the optimization in ReadPageInternal to skip > > > reading the page when it's already the page we have is not hit, except > > > for the first page in the segment. I didn't verify this, just my > > > impression while reading the code. > > > > FWIW, this matches with my impression here, third paragraph: > > https://www.postgresql.org/message-id/20191120083802.GB47145@paquier.xyz > > Ah, right. As I pointed out in https://www.postgresql.org/message-id/88183.1574261429%40antos seg.ws_off only replaced readOff in XLogReaderState. So we should only update ws_off where readOff was updated before commit 709d003. This does happen in ReadPageInternal (see HEAD) and I see no reason for the final patch to update ws_off anywhere else. > I was wondering if we shouldn't do away with the concept of "offset" as > such, since the offset there is always forcibly set to the start of a > page. Why don't we count page numbers instead? It seems like the > interface is confusingly generic (measure in bytes) yet not offer any > extra functionality that could not be obtained with a simpler struct > repr (measure in pages). Yes, I agree that page numbers would be sufficient. > But then that's not something that we need to change in this patch. -- Antonin Houska Web: https://www.cybertec-postgresql.com