Re: Hot standby, RestoreBkpBlocks and cleanup locks

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Hot standby, RestoreBkpBlocks and cleanup locks
Date: 2009-01-09 16:52:37
Message-ID: 1231519957.18005.494.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Fri, 2009-01-09 at 18:30 +0200, Heikki Linnakangas wrote:

> The hot standby patch has some hacks to decide which full-page-images
> can be restored holding an exclusive lock and which ones need a
> vacuum-strength lock. It's not very pretty as is, as mentioned in
> comments too.

Agreed!

> How about we refactor things so that redo-functions are responsible for
> calling RestoreBkpBlocks? The redo function can then pass an argument
> indicating what kind of lock is required. We should also change
> XLogReadBufferExtended so that it doesn't lock the page; the caller
> knows better what kind of a lock it needs. That makes it more analogous
> with ReadBufferExtended too, although I think we should keep
> XLogReadBuffer() unchanged for now.

Much better idea, thanks. I felt a new rmgr function was overkill but
couldn't think of how to do this.

> See attached patch. One shortfall of this patch is that you can pass
> only one argument to RestoreBkpBlocks, but there can multiple backup
> blocks in one WAL record. That's OK in current usage, though.

If we're doing this because of cleanup locks, then I'd say we don't
currently need a cleanup lock with any WAL record that uses multiple
backup blocks. So we can just document that so anybody adding such a
record in the future will be careful.

So all seems good.

Would you want to push ResolveRedoVisibilityConflicts() down into the
rmgrs as well and make reachedSafeStartPoint a global? That is only
called for cleanup records.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bernd Helmle 2009-01-09 16:53:31 Re: WIP: Automatic view update rules
Previous Message Guillaume Smet 2009-01-09 16:45:05 Re: foreign_data test fails with non-C locale