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 1iCmo3-0007wR-L0 for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Sep 2019 15:32:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iCmo1-0003lr-AZ for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Sep 2019 15:32:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iCmo0-0003lk-La for pgsql-hackers@lists.postgresql.org; Tue, 24 Sep 2019 15:32:44 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iCmnx-0007A0-GM for pgsql-hackers@postgresql.org; Tue, 24 Sep 2019 15:32:43 +0000 Received: by mail-wr1-x444.google.com with SMTP id r3so2460779wrj.6 for ; Tue, 24 Sep 2019 08:32:40 -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=q0Rs0tMZ86k9h5Ui+e/rGztoq4zX9uWPpSOfurMDB7s=; b=u71N2KE1gvYZZG3VkWuUIjP1tb1zj+M4eWDE+TJBqfNpFsg7FcEx7LFV4wbkhiVZh5 r2Va50/Irc3bUNM/ogvsEimcCZQfueTHYH4CCnLaxjC8MKXdKoXSf+8xB3OJo8tvqRSy hLkR3HKAoNrkvD9OUzae9eO02PFyGe3yac16sFG4824ctWNoCD2lcxTloSN9x3r4aXcs incFrYEY2PlicBi/fo8p1Ceyf586m6TWvdM5l4HrOT8AkgEY9NEYTvB1yj/C+la1ao95 oOnKlufgutrsNOcENF6F92IrL5gG5I4uI8Wj81Y0wc3k09V1LHs6HPTQD6WsO4quEgyP hxKQ== 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=q0Rs0tMZ86k9h5Ui+e/rGztoq4zX9uWPpSOfurMDB7s=; b=oxZHpzEntM4ZI/xVfE7bwDXAPFNUO0/NgFcli07599QfB825Lbdf+SGOfhQ4ujvPVb vjg0DeLeAAfvCJyPxsrYvwLlGaicQSJPJ641vqVUTdh129PdKoDSKMZLNixS2Hacb6PO qTy9bN/U8lmyZtx7jwIiGjUKZLnwt6aSlQcs6TF1vbVjiGJHoxoWx4OkAyAX/Xz+6ZuR eStpaKEV1LQWJdLjt8qtWHwWpNU9IDW/JFHKtpC+c5oYgyd4L1+h6yIjfUGxcXhK+PAv x62AziWugHEyxJhHWaxcEleT9hj1rRPFOlUhUAr/gs2SoZ+VasY/zsAEPNsL6CHum+DL xpng== X-Gm-Message-State: APjAAAVxT76/DZumJ0b99lG3LNTqtUD4ah44D7HbbsOOIrc/TsUoBf12 Mo6+q4uEBLjmbTRQIQOwYjAPzQ== X-Google-Smtp-Source: APXvYqwckYHRlcEWJ30UwaSXX5rsg8GUoW44JpX9lvZWHqvKvaxuHN3zVVfpRek/TxBdirQud765Wg== X-Received: by 2002:a5d:49c2:: with SMTP id t2mr2833501wrs.351.1569339159631; Tue, 24 Sep 2019 08:32:39 -0700 (PDT) Received: from antos ([77.87.240.5]) by smtp.gmail.com with ESMTPSA id v20sm404749wml.26.2019.09.24.08.32.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2019 08:32:38 -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: <20190923220010.GA23527@alvherre.pgsql> References: <20190923220010.GA23527@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Mon, 23 Sep 2019 19:00:10 -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: <83391.1569339204.1@antos> Content-Transfer-Encoding: quoted-printable Date: Tue, 24 Sep 2019 17:33:24 +0200 Message-ID: <83392.1569339204@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera wrote: > I spent a couple of hours on this patchset today. I merged 0001 and > 0002, and decided the result was still messier than I would have liked, > so I played with it a bit more -- see attached. I think this is > committable, but I'm afraid it'll cause quite a few conflicts with the > rest of your series. > = > I had two gripes, which I feel solved with my changes: > = > 1. I didn't like that "dir" and "wal segment size" were part of the > "currently open segment" supporting struct. It seemed that those two > were slightly higher-level, since they apply to every segment that's > going to be opened, not just the current one. ok > My first thought was to put those as members of XLogReaderState, but > that doesn't work because the physical walsender.c code does not use > xlogreader at all, even though it is reading WAL. `I don't remember clearly but I think that this was the reason I tried to = move "wal_segment_size" away from XLogReaderState. = > Separately from those two API-wise points, there was one bug which meant > that with your 0002+0003 the recovery tests did not pass -- code > placement bug. I suppose the bug disappears with later patches in your > series, which probably is why you didn't notice. This is the fix for th= at: > = > - XLogRead(cur_page, state->seg.size, state->seg.tli, targetPagePtr, > - state->seg.tli =3D pageTLI; > + state->seg.ws_tli =3D pageTLI; > + XLogRead(cur_page, state->segcxt.ws_segsize, state->seg.ws_tli, targ= etPagePtr, > XLOG_BLCKSZ); > = Yes, it seems so - the following parts ensure that XLogRead() adjusts the timeline itself. I only checked that the each part of the series keeps the source tree compilable. Thanks for fixing. > ... Also, yes, I renamed all the struct members. > > = > If you don't have any strong dislikes for these changes, I'll push this > part and let you rebase the remains on top. No objections here. > 2. Not a fan of the InvalidTimeLineID stuff offhand. Maybe it's okay ..= . > not convinced yet either way. Well, it seems that the individual callbacks only use this constant in Assert() statements. I'll consider if we really need it. The argument valu= e should not determine whether the callback derives the TLI or not. -- = Antonin Houska Web: https://www.cybertec-postgresql.com