Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts
Дата
Msg-id 20140720213258.GD5974@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On 2014-07-20 17:22:48 -0400, Tom Lane wrote:
> 2. However, pg_upgrade also sets datminmxid/relminmxid to equal the old
> cluster's NextMultiXactId.  The trouble with this is that it might fool
> (auto)vacuum into never seeing and freezing the pre-upgrade mxids; they're
> in the table but the metadata says not, so we'd not force a full table
> scan to find them.

We effectively can't actually assume those are going to be vacuumed away
anyway. There might have been 2**32 mxids in the older cluster already -
no value of datminmxid/relminmxid can protect us against that.

> 4. The patch Bruce applied to initialize datminmxid/relminmxid to the old
> NextMultiXactId rather than 1 does not fundamentally change anything here.
> It narrows the window in which wraparound can cause problems, but only by
> the distance that "1" is in-the-future at the time of upgrade.

I think it's actually more than that. Consider what happens if
pg_upgrade has used pg_resetxlog to set nextMulti to > 2^31. If
rel/datminmxid are set to 1 regardless vac_update_relstats() and
vac_update_datfrozenxid() won't increase them anymore because of:
    /* relminmxid must never go backward, either */
    if (MultiXactIdIsValid(minmulti) &&
        MultiXactIdPrecedes(pgcform->relminmxid, minmulti))
    {
        pgcform->relminmxid = minmulti;
        dirty = true;
    }

And that can actually cause significant problems once 9.3+ creates new
multis because they'll never get vacuumed away but still do get
truncated. If it's an updating multi xmax that can effectively make the
row unreadable - not just block updates.

Greetings,

Andres Freund

--
 Andres Freund                       http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts