Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TA3Jr-0002KC-Gd for pgsql-hackers@postgresql.org; Fri, 07 Sep 2012 18:30:19 +0000 Received: from mail-vb0-f46.google.com ([209.85.212.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TA3Jk-0005Hx-UC for pgsql-hackers@postgresql.org; Fri, 07 Sep 2012 18:30:18 +0000 Received: by vbbff1 with SMTP id ff1so3748383vbb.19 for ; Fri, 07 Sep 2012 11:30:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=K4MUX4KETW0g2bAi5uDdhKH/EGOPQ89sHERNL8Zxnvk=; b=WK/LifSJBa8bFSf2i5c1EjPW1eMtB77uQ3+TXcgJbhkMGCmmwbg7M5KknhsQ35d7+s zB4gTDxtuHOy/lOuhC7HTvOHclW7Q+Ii56uvmTZyHx2wzMu22Djqem+T8ShH6w5B01FI hU/x7bxuO6l1fTIvjcTVYNzZCAvTrYDSYfUFXH/UHL4g78Tl97wfFnH4/vNy+dFRjDLu M56pm9GZVc2IiKsyQS1rehbk2NlqAAtivNHho9nM09IsJ1w4r1cNYZeq9u+lAhxLkceI 8PUAuxMvhYWSuB5TDeJdKnEet+Sn8F0CuzujKFnx1+eO/MilyGO2XdzwBxuMpgr9BUQu J35A== Received: by 10.52.99.167 with SMTP id er7mr6716919vdb.57.1347042610996; Fri, 07 Sep 2012 11:30:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.35.206 with HTTP; Fri, 7 Sep 2012 11:29:50 -0700 (PDT) In-Reply-To: References: <6542094C-D8DC-4F96-B989-B1445103ADBF@atsc.nl> <1346965940-sup-53@alvh.no-ip.org> <55EF2E27-5806-4D55-9EF1-8EAA7B48EC73@gmail.com> From: Pavan Deolasee Date: Fri, 7 Sep 2012 23:59:50 +0530 Message-ID: Subject: Re: [BUGS] BUG #7521: Cannot disable WAL log while using pg_dump To: =?ISO-8859-1?Q?Gezeala_M=2E_Bacu=F1o_II?= Cc: pgsql-hackers Content-Type: multipart/alternative; boundary=20cf3071c6f05365da04c920cc18 X-Pg-Spam-Score: -2.7 (--) X-Archive-Number: 201209/345 X-Sequence-Number: 213373 --20cf3071c6f05365da04c920cc18 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable (Adding -hackers. Did not realize it got dropped) On Fri, Sep 7, 2012 at 11:25 PM, Gezeala M. Bacu=F1o II = wrote: > On Fri, Sep 7, 2012 at 7:17 AM, Pavan Deolasee > wrote: > > > > > > On Fri, Sep 7, 2012 at 7:00 PM, Marie Bacuno II > wrote: > >> > >> > >> On Sep 7, 2012, at 2:19, Pavan Deolasee > wrote: > >> > >> > >> > or have long running transactions ? > >> > >> Yes but I don't think there are when the snapshot was taken. Does the > >> pg_xlog_location_diff() result from latest and prior checkpoint upon > >> start-up indicates the size of replayed changes? > >> > > > > Thats the amount of additional WAL generated after you started the > server. > > > >> > >> > > >> > BTW, the following query returns ~60GB. Thats the amount of WAL > >> > written after the server was started and at the end of pg_dump (I > >> > don't think pg_xlog_location_diff() is available in the older > >> > releases). > >> > > >> > postgres=3D# select pg_xlog_location_diff('4450/7A14F280', > >> > '4441/5E681F38')/(2^30); > >> > ?column? > >> > ------------------ > >> > 60.1980484202504 > >> > >> It'll be great to know what the wals modified..? > > > > > > You would need something like xlogdump to decipher them. I quickly trie= d > > this and it seems to work against 8.4 version that you are running. > > https://github.com/snaga/xlogdump > > > > Download the source code, compile and run it against one of the most > recent > > WAL files in the cluster against which you ran pg_dump. You would need = to > > set PATH to contain the pg_config of the server you are running. Please > post > > the output. > > > > Thanks, > > Pavan > > > > > > Here you go: > > ## last WAL > $ xlogdump -S /dbpool/data/pg_xlog/00000001000044500000007A > > /dbpool/data/pg_xlog/00000001000044500000007A: > > Unexpected page info flags 0003 at offset 0 > Skipping unexpected continuation record at offset 0 > ReadRecord: record with zero len at 17488/7A14F310 > Unexpected page info flags 0001 at offset 150000 > Skipping unexpected continuation record at offset 150000 > Unable to read continuation page? > ** maybe continues to next segment ** > --------------------------------------------------------------- > TimeLineId: 1, LogId: 17488, LogSegment: 122 > > Resource manager stats: > [0]XLOG : 3 records, 120 bytes (avg 40.0 bytes) > checkpoint: 3, switch: 0, backup end: 0 > [1]Transaction: 0 record, 0 byte (avg 0.0 byte) > commit: 0, abort: 0 > [2]Storage : 0 record, 0 byte (avg 0.0 byte) > [3]CLOG : 0 record, 0 byte (avg 0.0 byte) > [4]Database : 0 record, 0 byte (avg 0.0 byte) > [5]Tablespace: 0 record, 0 byte (avg 0.0 byte) > [6]MultiXact : 0 record, 0 byte (avg 0.0 byte) > [7]Reserved 7: 0 record, 0 byte (avg 0.0 byte) > [8]Reserved 8: 0 record, 0 byte (avg 0.0 byte) > [9]Heap2 : 2169 records, 43380 bytes (avg 20.0 bytes) > [10]Heap : 0 record, 0 byte (avg 0.0 byte) > ins: 0, upd/hot_upd: 0/0, del: 0 > [11]Btree : 0 record, 0 byte (avg 0.0 byte) > [12]Hash : 0 record, 0 byte (avg 0.0 byte) > [13]Gin : 0 record, 0 byte (avg 0.0 byte) > [14]Gist : 0 record, 0 byte (avg 0.0 byte) > [15]Sequence : 0 record, 0 byte (avg 0.0 byte) > > Backup block stats: 2169 blocks, 16551816 bytes (avg 7631.1 bytes) > > I think both my theories seem to be holding up. Heap2 resource manager is used only for vacuum freeze, lazy vacuum or HOT prune. Given your access pattern, I bet its the third activity that kicking in on your database. You got many pages with dead tuples and they are getting cleaned at the first opportunity, which happens to be the pg_dump thats run immediately after the server restart. This is seen by all 2169 WAL records in the file being attributed to the Heap2 RM above. Whats additionally happening is each of these records are on different heap pages. The cleanup activity dirties those pages. Since each of these pages is being dirtied for the first time after a recent checkpoint and full_page_writes is turned ON, entire page is backed up in the WAL record. You can see the exact number of backup blocks in the stats above. I don't think we have any mechanism to control or stop HOT from doing what it wants to do, unless you are willing to run a modified server for this reason. But you can at least bring down the WAL volume by turning full_page_writes OFF. Thanks, Pavan --20cf3071c6f05365da04c920cc18 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable (Adding -hackers. Did not realize it got dropped)

On Fri, Sep 7, 2012 at 11:25 PM, Gezeala M. Bacu=F1o II <gezeala= @gmail.com> wrote:
On F= ri, Sep 7, 2012 at 7:17 AM, Pavan Deolasee <pavan.deolasee@gmail.com> wrote:
>
>
> On Fri, Sep 7, 2012 at 7:00 PM, Marie Bacuno II <gezeala@gmail.com> wrote:
>>
>>
>> On Sep 7, 2012, at 2:19, Pavan Deolasee <pavan.deolasee@gmail.com> wrote:
>>
>>
>> > or have long running transactions ?
>>
>> Yes but I don't think there are when the snapshot was taken. D= oes the
>> pg_xlog_location_diff() result from latest and prior checkpoint up= on
>> start-up indicates the size of replayed changes?
>>
>
> Thats the amount of additional WAL generated after you started the ser= ver.
>
>>
>> >
>> > BTW, the following query returns ~60GB. Thats the amount of W= AL
>> > written after the server was started and at the end of pg_dum= p (I
>> > don't think pg_xlog_location_diff() is available in the o= lder
>> > releases).
>> >
>> > postgres=3D# select pg_xlog_location_diff('4450/7A14F280&= #39;,
>> > '4441/5E681F38')/(2^30);
>> > =A0 =A0?column?
>> > ------------------
>> > 60.1980484202504
>>
>> It'll be great to know what the wals modified..?
>
>
> You would need something like xlogdump to decipher them. I quickly tri= ed
> this and it seems to work against 8.4 version that you are running. > https:= //github.com/snaga/xlogdump
>
> Download the source code, compile and run it against one of the most r= ecent
> WAL files in the cluster against which you ran pg_dump. You would need= to
> set PATH to contain the pg_config of the server you are running. Pleas= e post
> the output.
>
> Thanks,
> Pavan
>
>

Here you go:

## last WAL
$ xlogdump -S /dbpool/data/pg_xlog/00000001000044500000007A

/dbpool/data/pg_xlog/00000001000044500000007A:

Unexpected page info flags 0003 at offset 0
Skipping unexpected continuation record at offset 0
ReadRecord: record with zero len at 17488/7A14F310
Unexpected page info flags 0001 at offset 150000
Skipping unexpected continuation record at offset 150000
Unable to read continuation page?
=A0** maybe continues to next segment **
---------------------------------------------------------------
TimeLineId: 1, LogId: 17488, LogSegment: 122

Resource manager stats:
=A0 [0]XLOG =A0 =A0 =A0: 3 records, 120 bytes (avg 40.0 bytes)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0checkpoint: 3, switch: 0, backup end: 0<= br> =A0 [1]Transaction: 0 record, 0 byte (avg 0.0 byte)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0commit: 0, abort: 0
=A0 [2]Storage =A0 : 0 record, 0 byte (avg 0.0 byte)
=A0 [3]CLOG =A0 =A0 =A0: 0 record, 0 byte (avg 0.0 byte)
=A0 [4]Database =A0: 0 record, 0 byte (avg 0.0 byte)
=A0 [5]Tablespace: 0 record, 0 byte (avg 0.0 byte)
=A0 [6]MultiXact : 0 record, 0 byte (avg 0.0 byte)
=A0 [7]Reserved 7: 0 record, 0 byte (avg 0.0 byte)
=A0 [8]Reserved 8: 0 record, 0 byte (avg 0.0 byte)
=A0 [9]Heap2 =A0 =A0 : 2169 records, 43380 bytes (avg 20.0 bytes)
=A0 [10]Heap =A0 =A0 =A0: 0 record, 0 byte (avg 0.0 byte)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ins: 0, upd/hot_upd: 0/0, del: 0
=A0 [11]Btree =A0 =A0 : 0 record, 0 byte (avg 0.0 byte)
=A0 [12]Hash =A0 =A0 =A0: 0 record, 0 byte (avg 0.0 byte)
=A0 [13]Gin =A0 =A0 =A0 : 0 record, 0 byte (avg 0.0 byte)
=A0 [14]Gist =A0 =A0 =A0: 0 record, 0 byte (avg 0.0 byte)
=A0 [15]Sequence =A0: 0 record, 0 byte (avg 0.0 byte)

Backup block stats: 2169 blocks, 16551816 bytes (avg 7631.1 bytes)


I think both my theories seem to be ho= lding up. Heap2 resource manager is used only for vacuum freeze, lazy vacuu= m or HOT prune. Given your access pattern, I bet its the third activity tha= t kicking in on your database. You got many pages with dead tuples and they= are getting cleaned at the first opportunity, which happens to be the pg_d= ump thats run immediately after the server restart. This is seen by all 216= 9 WAL records in the file being attributed to the Heap2 RM above.

Whats additionally happening is each of these records a= re on different heap pages. The cleanup activity dirties those pages. Since= each of these pages is being dirtied for the first time after a recent che= ckpoint and full_page_writes is turned ON, entire page is backed up in the = WAL record. You can see the exact number of backup blocks in the stats abov= e.

I don't think we have any mechanism to control or s= top HOT from doing what it wants to do, unless you are willing to run a mod= ified server for this reason. But you can at least bring down the WAL volum= e by turning full_page_writes OFF.

Thanks,
Pavan
--20cf3071c6f05365da04c920cc18--