Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 2BE4B13FA3D7 for ; Mon, 18 Jun 2012 16:20:07 -0300 (ADT) Received: from exprod7og112.obsmtp.com ([64.18.2.177]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SghUb-00087H-6k for pgsql-hackers@postgresql.org; Mon, 18 Jun 2012 19:20:06 +0000 Received: from mail-ey0-f179.google.com ([209.85.215.179]) (using TLSv1) by exprod7ob112.postini.com ([64.18.6.12]) with SMTP ID DSNKT99/VyW4X5dw8g8darE0tGxn2LyMesR2@postini.com; Mon, 18 Jun 2012 12:20:05 PDT Received: by eaaa1 with SMTP id a1so1914264eaa.24 for ; Mon, 18 Jun 2012 12:19:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=L8pxLm+P6nlVHkglKjrcnmex8w62DMJpgeT042Q+un0=; b=le9KCT1LKDaAjOG76rCWcYO+GUOGRtgBH/T7pKe8GRUqQlhRDATEceOehk7EsR+8Kz 4/wSvDqcHcfEj9xCxMUtpgOovfnUL7OWi1bxsegCTuxkhawTD4yf8k/ke7rgxK9knoEL defLTgfFF1rhAUGx16hWi5rxv8Bd27Xu6sOsZYFj9jrmhSkpF+KX3Vjw+uvyMwBoE+yp i57MQa4+sa38Gh+BNnX5EGH6K3xcWYBKgaWN3shjziFsp31tTjPV5QvYOmfFj9r3V9LE Us6h507V09sqlzfCc2RwrYH+TaO6cR2rw7ZzRPOZccMMG7WKao6+P5FgXhhwAMNNyqQF xvAQ== Received: by 10.152.112.138 with SMTP id iq10mr15657687lab.13.1340047190506; Mon, 18 Jun 2012 12:19:50 -0700 (PDT) Received: from [192.168.1.100] (dsl-hkibrasgw2-ff6cc300-200.dhcp.inet.fi. [88.195.108.200]) by mx.google.com with ESMTPS id k4sm12057584lbb.12.2012.06.18.12.19.48 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 18 Jun 2012 12:19:49 -0700 (PDT) Message-ID: <4FDF7F54.5060406@enterprisedb.com> Date: Mon, 18 Jun 2012 22:19:48 +0300 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4 MIME-Version: 1.0 To: Andres Freund CC: pgsql-hackers@postgresql.org, Robert Haas Subject: Re: WAL format changes References: <4FDA5136.6080206@enterprisedb.com> <201206182013.12868.andres@2ndquadrant.com> <4FDF7456.9010709@enterprisedb.com> <201206182045.53962.andres@2ndquadrant.com> In-Reply-To: <201206182045.53962.andres@2ndquadrant.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQlGBRjXzKXTtW4Mk+OQjhIhWk/qtJNZgtDdOYSjypZXf0KzdV4eR4I8XLebe4nwF5JaK6Ys X-Pg-Spam-Score: -4.2 (----) X-Archive-Number: 201206/919 X-Sequence-Number: 209759 On 18.06.2012 21:45, Andres Freund wrote: > On Monday, June 18, 2012 08:32:54 PM Heikki Linnakangas wrote: >> On 18.06.2012 21:13, Andres Freund wrote: >>> On Monday, June 18, 2012 08:08:14 PM Heikki Linnakangas wrote: >>>> The page header contains an XLogRecPtr (LSN), so if we change it we'll >>>> have to deal with pg_upgrade. I guess we could still keep XLogRecPtr >>>> around as the on-disk representation, and convert between the 64-bit >>>> integer and XLogRecPtr in PageGetLSN/PageSetLSN. I can try that out - >>>> many xlog calculations would admittedly be simpler if it was an uint64. >>> >>> I am out of my depth here, not having read any of the relevant code, but >>> couldn't we simply replace the lsn from disk with InvalidXLogRecPtr >>> without marking the page dirty? >>> >>> There is the valid argument that you would loose some information when >>> pages with hint bits are written out again, but on the other hand you >>> would also gain the information that it was a hint-bit write... >> >> Sorry, I don't understand that. Where would you "replace the LSN from >> disk with InvalidXLogRecPtr" ? (and no, it probably won't work ;-) ) > In ReadBuffer_common or such, after reading a page from disk and verifying > that the page has a valid header it seems to be possible to replace pd_lsn *in > memory* by InvalidXLogRecPtr without marking the page dirty. > If the page isn't modified the lsn on disk won't be changed so you don't loose > debugging information in that case. If will be zero if it has been written by > a hint-bit write and thats arguable a win. We use the LSN to decide whether a full-page image need to be xlogged if the page is modified. If you reset LSN every time you read in a page, you'll be doing full page writes every time a page is read from disk and modified, whether or not it's the first time the page is modified after the last checkpoint. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com