Re: switch UNLOGGED to LOGGED

From: Leonardo Francalanci <m_lists(at)yahoo(dot)it>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: switch UNLOGGED to LOGGED
Date: 2011-04-16 16:52:05
Message-ID: 626426.62684.qm@web29004.mail.ird.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > If the master crashes while a transaction that used CREATE TABLE is
>unfinished,
> > both the master and the standby will indefinitely retain identical, stray
>(not
> > referenced by pg_class) files. The catalogs do reference the relfilenode
of
> > each unlogged relation; currently, that relfilenode never exists on a
>standby
> > while that standby is accepting connections. By the time the startup
>process
> > releases the AccessExclusiveLock acquired by the proposed UNLOGGED ->
normal
> > conversion process, that relfilenode needs to be either fully copied or
>unlinked
> > all over again. (Alternately, find some other way to make sure queries
>don't
> > read the half-copied file.) In effect, the problem is that the relfilenode
>is
> > *not* stray, so its final state does need to be well-defined.
>
> Oh, right.
>
> Maybe we should just put in a rule that a server in Hot Standby mode
> won't ever try to read from an unlogged table (right now we count on
> the fact that there will be nothing to read). If we crash before
> copying the whole file, it won't matter, because the catalogs won't
> have been updated, so we'll refuse to look at it anyway. And we have
> to reinitialize on entering normal running anyway, so we can clean it
> up then.

Ok then... I'll try to code the "easy" version first (the wal_level=minimal
case)
and then we'll see....

Leonardo

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-04-16 17:04:40 Re: Broken HOT chains in system catalogs
Previous Message Noah Misch 2011-04-16 16:48:08 Re: Broken HOT chains in system catalogs