From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Wang Hao <whberet(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Should buffer of initialization fork have a BM_PERMANENT flag |
Date: | 2017-03-14 00:51:54 |
Message-ID: | CAB7nPqSeN5m7o2zCNNznMo6_oN4_VD-zoo8HpLMBEtO3RLeQmQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Mar 14, 2017 at 4:46 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Wed, Jan 25, 2017 at 7:14 PM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> (Adding Robert in CC.)
>>
>> On Thu, Jan 26, 2017 at 4:34 AM, Wang Hao <whberet(at)gmail(dot)com> wrote:
>>> An unlogged table has an initialization fork. The initialization fork does
>>> not have an BM_PERMANENT flag when get a buffer.
>>> In checkpoint (not shutdown or end of recovery), it will not write to disk.
>>> after a crash recovery, the page of initialization fork will not correctly,
>>> then make the main fork not correctly too.
>>
>> For init forks the flush need absolutely to happen, so that's really
>> not good. We ought to fix BufferAlloc() appropriately here.
>
> I agree with that, but I propose the attached version instead. It
> seems cleaner to have the entire test for setting BM_PERMANENT in one
> place rather than splitting it up as you did.
Fine for me. You may want to update the comment of BM_PERMANENT in
buf_internals.h as Artur has mentioned upthread. For example by just
adding "and init forks".
> I believe this sets a record for the longest-lived data corruption bug
> in a commit made by me.
Really? I'll need to double-check the git history here.
> Six years and change, woohoo. :-(
And that much for someone to report it.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2017-03-14 00:54:48 | Re: scram and \password |
Previous Message | Peter Geoghegan | 2017-03-14 00:41:15 | Re: tuplesort_gettuple_common() and *should_free argument |