Re: pgsql: Assert(IsTransactionState()) in RelationIdGetRelation().

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pgsql: Assert(IsTransactionState()) in RelationIdGetRelation().
Дата
Msg-id 20140211201526.GP15246@awork2.anarazel.de
обсуждение исходный текст
Ответ на Re: pgsql: Assert(IsTransactionState()) in RelationIdGetRelation().  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-committers
On 2014-02-11 14:45:00 -0500, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > On 2014-02-06 16:28:23 +0000, Tom Lane wrote:
> >> Assert(IsTransactionState()) in RelationIdGetRelation().
>
> > Hm, I am not sure if it works this way. In a patched postgres I just
> > got:
> > #2  0x00000000008b4b27 in ExceptionalCondition (conditionName=0xa90a78 "!(IsTransactionState())",
errorType=0xa90708"FailedAssertion", 
> >     fileName=0xa905c8 "/home/andres/src/postgresql/src/backend/utils/cache/relcache.c", lineNumber=1622)
> >     at /home/andres/src/postgresql/src/backend/utils/error/assert.c:54
> > #3  0x00000000008a3fd6 in RelationIdGetRelation (relationId=1259) at
/home/andres/src/postgresql/src/backend/utils/cache/relcache.c:1622
> > #4  0x00000000004a25ea in relation_open (relationId=1259, lockmode=1) at
/home/andres/src/postgresql/src/backend/access/heap/heapam.c:1038
> > #5  0x00000000004a2898 in heap_open (relationId=1259, lockmode=1) at
/home/andres/src/postgresql/src/backend/access/heap/heapam.c:1201
> > #6  0x00000000008a10ba in ScanPgRelation (targetRelId=2693, indexOK=1 '\001', suspend_snap=1 '\001')
> >     at /home/andres/src/postgresql/src/backend/utils/cache/relcache.c:308
> > #7  0x00000000008a268c in RelationInitPhysicalAddr (relation=0x7fac2a842658)
> >     at /home/andres/src/postgresql/src/backend/utils/cache/relcache.c:1019
>
> Um ... what is RelationInitPhysicalAddr doing calling ScanPgRelation?
> That function shouldn't be doing any new catalog access.

Argh, sorry, didn't think far enough. Yes, that's specific to the branch
I am testing, and the after your recent changes there shouldn't be any
catalog accesses in TRANS_START due to invalidations in master. This
just needed to be adapted to that (i.e the same if (IsTransactionState())
added).

The reason we're doing catalog accesses there is that when decoding the
WAL's contents we want a relation descriptor that looks like one would
have when the WAL record was created, but for catalog tables we want the
the relfilenode to point to the current relfilenode (normal relations
are never accessed). So we use a "historical" snapshot to build the
relcache entry and an up2date one to lookup the
relfilenode.
RelationInitPhysicalAddr() seems like the correct place to deal with
that since nothing else needs to know.

Greetings,

Andres Freund

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


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: Assert(IsTransactionState()) in RelationIdGetRelation().
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Tweak position of $(DLL_DEFFILE) in shared-library link commands