From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Wang Hao <whberet(at)gmail(dot)com> |
Cc: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com> |
Subject: | Re: Should buffer of initialization fork have a BM_PERMANENT flag |
Date: | 2017-01-29 14:00:42 |
Message-ID: | CAB7nPqQwTZHow0M0bDnWoinjTh28x+UzYjWTT_rWcuQLwgFSfw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jan 26, 2017 at 9:14 AM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> So the patch attached fixes the problem by changing BufferAlloc() in
> such a way that initialization forks are permanently written to disk,
> which is what you are suggesting. As a simple fix for back-branches
> that's enough, though on HEAD I think that we should really rework the
> empty() routines so as the write goes through shared buffers first,
> that seems more solid than relying on the sgmr routines to do this
> work. Robert, what do you think?
Attached is what I have in mind for HEAD. btree, gist, spgist and
bloom indexes are changed so as the init forks created go through the
shared buffers instead of having their empty() routines handle the
flush of the page created. This removes any kind of race conditions
between the checkpointer and the init fork creations, which is I think
a good thing.
Here are the tests I have done.
First running those commands to create all types of indexes.
create extension bloom;
create extension btree_gist;
create extension btree_gin;
create unlogged table foo (a int);
create index foo_bt on foo(a);
create index foo_bloom on foo using bloom(a);
create index foo_gin on foo using gin (a);
create index foo_gist on foo using gist (a);
create index foo_brin on foo using brin (a);
create unlogged table foo_geo (a box);
create index foo_spgist ON foo_geo using spgist(a);
checkpoint;
Then crash the server, restart it, and the following vacuums are able
to complete.
vacuum foo;
vacuum foo_geo;
I have as well created a CF entry for this set of patches:
https://commitfest.postgresql.org/13/971/
Thanks,
--
Michael
Attachment | Content-Type | Size |
---|---|---|
unlogged-flush-fix-head.patch | application/x-patch | 7.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Corey Huinker | 2017-01-29 20:40:31 | Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless) |
Previous Message | Thomas Munro | 2017-01-29 13:52:17 | Re: WIP: [[Parallel] Shared] Hash |