Skip site navigation (1) Skip section navigation (2)

Re: Re: [COMMITTERS] pgsql: Write a WAL record whenever we perform an operation without

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Write a WAL record whenever we perform an operation without
Date: 2010-02-01 09:58:00
Message-ID: 3f0b79eb1002010158m5ce05291i7bd619b5388923b4@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-hackers
On Mon, Feb 1, 2010 at 6:33 PM, Heikki Linnakangas
<heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
> Hmm. The "unlogged" record is written here:
>
> ...
> void
> heap_sync(Relation rel)
> {
>        char reason[NAMEDATALEN + 30];
>
>        /* temp tables never need fsync */
>        if (rel->rd_istemp)
>                return;
>
>        snprintf(reason, sizeof(reason), "heap inserts on \"%s\"",
>                         RelationGetRelationName(rel));
>        XLogReportUnloggedStatement(reason);
> ...
>
>
> So it clearly shouldn't be written for temp relations. Apparently the
> rd_istemp flag not set correctly after CLUSTER / VACUUM FULL.

The cause of the problem seems to be the new heap created by
rebuild_relation() and copy_heap_data(), i.e., new VACUUM FULL.
Since it's not a temporary heap, its rd_istemp is off. OTOH
it needs to be synced after physical copy from old heap. So
XLogReportUnloggedStatement() is called in heap_sync().

The easy fix is to change the code as below.

    if (XLogIsNeeded())
    {
        snprintf(reason, sizeof(reason), "heap inserts on \"%s\"",
                         RelationGetRelationName(rel));
        XLogReportUnloggedStatement(reason);
    }

But I'm not sure this fix is right, so I need to investigate
the code more.

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

pgsql-hackers by date

Next:From: Heikki LinnakangasDate: 2010-02-01 10:11:56
Subject: Re: [COMMITTERS] pgsql: Write a WAL record whenever we perform an operation without
Previous:From: Simon RiggsDate: 2010-02-01 09:53:36
Subject: Re: [COMMITTERS] pgsql: Write a WAL record whenever we perform an operation without

pgsql-committers by date

Next:From: Heikki LinnakangasDate: 2010-02-01 10:11:56
Subject: Re: [COMMITTERS] pgsql: Write a WAL record whenever we perform an operation without
Previous:From: Simon RiggsDate: 2010-02-01 09:53:36
Subject: Re: [COMMITTERS] pgsql: Write a WAL record whenever we perform an operation without

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group