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 1hEzKS-0001Li-Tj for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Apr 2019 16:47:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hEzKR-0006r2-MM for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Apr 2019 16:47:03 +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 1hEzKR-0006pr-9u for pgsql-hackers@lists.postgresql.org; Fri, 12 Apr 2019 16:47:03 +0000 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hEzKO-0004b1-Gj for pgsql-hackers@postgresql.org; Fri, 12 Apr 2019 16:47:02 +0000 Received: by mail-qk1-x741.google.com with SMTP id s81so6022036qke.13 for ; Fri, 12 Apr 2019 09:47:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=LqFHLx/nZbh/wTdThKg3U5UJh7sEKSu7ZcigyedLErE=; b=NQegU9vSRmspezk7GBjW/SJwcW3M3COikzHIyyUmmyyklp5HeJr/HNOVQE9fkgrvti JeKBaEm4uEyjeixMCH8Y6sAHKE29SNsIRPljQ5+H4t3xgDK2TyECqCFYQRpYon0dO0Uw dbANXnI+7lP8YlZNGXBV37NXkXrsmYshHyiQaa/GiuD/0eyMxBqd47q4iA/uuiYnTICR R5VIkHB8K5XKuhHuTL9LmEcgqGPe1ahUvaTxpsTbIwdPG/DKJEVg82sYywvaPo3H970O kV4QN/bDw/LMmbxtBD0nb9+D5Xbibv2hIsHEkVylZucQuUpUPn6BwO71qbOENHHGBJW4 vqHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=LqFHLx/nZbh/wTdThKg3U5UJh7sEKSu7ZcigyedLErE=; b=abHwD4B1G/AWuPZm+4YO+gs8YLNmdDgDjQiKEfMSFwFXJLVAMvWZCNBg9UrBVLk33R yjxDSG74rXKyPPQO+4FVEPs83FtSub6wfwhSZn9kwBqoPLegz637WqFwyiqSMU82Dye2 9KUaUgXwl8QLPbqyKR3cxCV4OX5mvHkA/C1igdWlSrrr8kA3x9XktHbLZpNO5DBSXtC4 4eEm0nEAZCC4AEMMcH/0j9z+mxvUBAmGOT1SMNxv3EzeETIjQ9TW9vf/Kp5McTEmj0Jj vs9WVXAw5yI4z49dK/NGZ9nfhtdPl/GdgLHL1sbsvK6YMrlzBS2mUt6LjN+MYyp3kO5e 9BjA== X-Gm-Message-State: APjAAAWQjWslQNBS7D/yMD1nBmUQl0l/POsQWsBqGKVZZtAGkTvA3Ns/ Jsij762kI383xQW+LjL1vChkeL+PrCI= X-Google-Smtp-Source: APXvYqwDk+tuXF0wIm/8C0gxwPuKKqwYlWVf2R15bBnqK3a7C8Uyfjv7L8a3veXVXaK+qzfFKa1atA== X-Received: by 2002:a05:620a:1024:: with SMTP id a4mr46507144qkk.232.1555087619527; Fri, 12 Apr 2019 09:46:59 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id u15sm30002705qth.54.2019.04.12.09.46.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Apr 2019 09:46:59 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 8E4D6120D9A; Fri, 12 Apr 2019 12:46:56 -0400 (-04) Date: Fri, 12 Apr 2019 12:46:56 -0400 From: Alvaro Herrera To: Antonin Houska Cc: pgsql-hackers@postgresql.org Subject: Re: Attempt to consolidate reading of XLOG page Message-ID: <20190412164656.GA21726@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <14984.1554998742@spoje.net> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Apr-11, Antonin Houska wrote: > While working on the instance encryption I found it annoying to apply > decyption of XLOG page to three different functions. Attached is a patch that > tries to merge them all into one function, XLogRead(). The existing > implementations differ in the way new segment is opened. So I added a pointer > to callback function as a new argument. This callback handles the specific > ways to determine segment file name and to open the file. > > I can split the patch into multiple diffs to make detailed review easier, but > first I'd like to hear if anything is seriously wrong about this > design. Thanks. I agree that xlog reading is pretty messy. I think ifdef'ing the way XLogRead reports errors is not great. Maybe we can pass a function pointer that is to be called in case of errors? Not sure about the walsize; maybe it can be a member in XLogReadPos, and given to XLogReadInitPos()? (Maybe rename XLogReadPos as XLogReadContext or something like that, indicating it's not just the read position.) -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services