Re: GiST insert algorithm rewrite

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
Subject: Re: GiST insert algorithm rewrite
Date: 2010-12-16 13:52:33
Message-ID: 4D0A19A1.2040700@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 13.12.2010 20:30, Tom Lane wrote:
> Can we fix it so that each child page is updated, and its downlink
> inserted, as a separate atomic action? That'd require each intermediate
> state to be consistent and crash-safe, but I think you really need the
> intermediate states to be consistent anyway because of concurrent scans.

Here's an updated patch, using that idea.If a page split into more than
two pages, the downlinks for the pages are inserted to the parent
one-by-one, right-to-left, until there's only two remaining. Finally the
downlink for the last remaining right page is inserted and the downlink
for the original page is updated as one atomic operation.

It was a pretty big rewrite again, but seems to work now. I tested
splits that span more than two pages by rigging the btree_gist picksplit
function to choose very bad split points, and the fix-split logic by
adding elog(ERROR) in strategic places to sometimes leave splits incomplete.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

Attachment Content-Type Size
gist-insert-rewrite-5.patch text/x-diff 116.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-12-16 13:55:59 Re: Instrument checkpoint sync calls
Previous Message Andres Freund 2010-12-16 13:49:45 Re: [PATCH] V3: Idle in transaction cancellation