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 20140720204852.GB5974@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 16:16:18 -0400, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > On 2014-07-20 13:37:01 -0400, Tom Lane wrote:
> >> I started transcribing Bruce's proposed fix procedure at
> >> https://wiki.postgresql.org/wiki/20140702pg_upgrade_fix
> >> into the release notes, but I'm afraid it's all wet.
>
> > I don't understand why we should do anything but remove the 0000 file if
> > it's all zeroes? This seems far too complicated. Beside the fact that I
> > doubt it's actually achieving anything reliably?
>
> This one is not about the extra 0000 file.  It's about whether datminmxid
> and relminmxid are wrong.  In the previous coding of pg_upgrade, they'd
> have been left at "1" even if that value has wrapped around into the
> future.

Yea, I'm rereading the thread atm. I'd stopped following it after a
while and didn't notice the drift into a second problem.

> Now, if you were lucky, you'd have no bad side-effects even if they had
> wrapped around ...

Hm. If relminmxid = 1 is still in the past everything should be fine,
right? The next vacuum (which will run soon) will just set it anew. But
if not
    /* relminmxid must never go backward, either */
    if (MultiXactIdIsValid(minmulti) &&
        MultiXactIdPrecedes(pgcform->relminmxid, minmulti))
    {
        pgcform->relminmxid = minmulti;
        dirty = true;
    }
will prevent it from being changed. Similarly
    /* ditto */
    if (MultiXactIdPrecedes(dbform->datminmxid, newMinMulti))
    {
        dbform->datminmxid = newMinMulti;
        dirty = true;
    }
will prevent datminmxid from becoming sane.

vac_truncate_clog() will be called with ReadNextMultiXactId() - -
autovacuum_multixact_freeze_max_age as the truncation for multis. That
itself would be fine since there won't be any actual multis in that
range. The problem is that we might miss having to do a full table
vacuum because
we check relminmxid to determine that:
    scan_all |= MultiXactIdPrecedesOrEquals(onerel->rd_rel->relminmxid,
                                            mxactFullScanLimit);
which then could cause problems in the future.

Imo that means we need to fix this :( for existing clusters.

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
Следующее
От: Andres Freund
Дата:
Сообщение: Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts