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 1iVjL4-0003or-W8 for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Nov 2019 21:41:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iVjL3-0000ji-QT for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Nov 2019 21:41:09 +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 1iVjL3-0000jb-B1 for pgsql-hackers@lists.postgresql.org; Fri, 15 Nov 2019 21:41:09 +0000 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iVjL0-0000j8-MH for pgsql-hackers@postgresql.org; Fri, 15 Nov 2019 21:41:08 +0000 Received: by mail-qk1-x744.google.com with SMTP id m4so9287096qke.9 for ; Fri, 15 Nov 2019 13:41:06 -0800 (PST) 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=fGgHXVf+ZvjRQ4X3rGXSG/PL/7oTwehLQlzmKMkOU40=; b=IB5Cs/+dpnoSRz9gHahI7T+vcPqegWjoHI8qt0r1Os8CQnRnRUfPjeq9AC0hvM6rWJ jYXDR3TrqRAshpj0XTQ8sUoNHRWMLtyQ5dGHMvegtqMsN7G6x5wKQSi1wT+7q7XiSgAY VzIgDJXRszoWze+1ivRA/Sr7N09oKXwipsDwLc5ad6k5kn7hyuMOwHdnHReOVs/sPrgh bcZhNINocd0WorvDJAlO/1fdnNDtsRTuClWDHTNn614ZA7fsHnSUePg5Lm4J+UGuhKQH EciICV3x0vmbwrzgZTR5Nw6RIcuGSQXle0dD5alMjRwC+70HAsUKeED8X5kZWZ74PM1e u7WA== 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=fGgHXVf+ZvjRQ4X3rGXSG/PL/7oTwehLQlzmKMkOU40=; b=ObbbEYV+1vbSZPYTiTTRZnkfuueI4No3gxCIa0JPIlglUlWk/ufbfGSi+/begMkt2M FdLqTMKQcCmtePiGE0XkXFh9bJaZrLwM2yrZBtXLBDoWi+fH11MGF/7t07JeEwaX60NU OfSpnhGLeiOAnVzry2DFD7EB14vwbf43CjX9BiqQOn8FmpUZFu6tUn4JIxXI+wnbtVa4 eawGOIFsfFXxKX0lD+ygYowQFVWm4IFs3cf/bLOUmXmzMW7HmNXDlIjRuyKm+Ksa7I5v hDNdthHYhDsIGyAmIvwRFE3+kxLJGPjjEZWR+ErusAFAwWm2nmvbNlz4hc0WNx6XV6eV 6Dow== X-Gm-Message-State: APjAAAUVsSrGAD2HMdd4FWZ1srjq7OfE6ifEWeCieRZcoLuIGn1Jv4tJ bZZO43LJGVv8Mjhkw10IGxaVWg== X-Google-Smtp-Source: APXvYqyK9moJCYvc48/lF7+znpA/iy0KPNdfwNQssVNCOm/XFBinQSx+IZQV6I9QWmnjSqRjB7AGIQ== X-Received: by 2002:a37:6ec4:: with SMTP id j187mr14576081qkc.193.1573854065513; Fri, 15 Nov 2019 13:41:05 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id b10sm4597821qkh.69.2019.11.15.13.41.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2019 13:41:04 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 5C297300ABE; Fri, 15 Nov 2019 18:41:02 -0300 (-03) Date: Fri, 15 Nov 2019 18:41:02 -0300 From: Alvaro Herrera To: Antonin Houska Cc: Michael Paquier , Thomas Munro , Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: Attempt to consolidate reading of XLOG page Message-ID: <20191115214102.GA15616@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <44237.1573556793@antos> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Nov-12, Antonin Houska wrote: > ok, the next version uses explicit lseek(). Maybe the fact that XLOG is mostly > read sequentially (i.e. without frequent seeks) is the reason pread() has't > been adopted so far. I don't quite understand why you backed off from switching to pread. It seemed a good change to me. Here's a few edits on top of your latest. The new routine WALRead() is not at all the same as the previous XLogRead, so I don't see why we would keep the name. Hence renamed. I see no reason for the openSegment callback to return the FD in an out param instead of straight return value. Changed that way. Having seek/open be a boolean "xlr_seek" seems a bit weird. Changed to an "operation" enum. (Maybe if we go back to pg_pread we can get rid of this.) Accordingly, change WALReadRaiseError and WALDumpReadPage. Change xlr_seg to be a struct rather than pointer to struct. It seems a bit dangerous to me to return a pointer that we don't know is going to be valid at raise-error time. Struct assignment works fine for the purpose. Renamed XLogDumpReadPage to WALDumpReadPage, because what the heck is XLogDump anyway? That doesn't exist. I would only like to switch this back to pg_pread() (from seek/read) and I'd be happy to commit this. What is logical_read_local_xlog_page all about? Seems useless. Let's get rid of it. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services