MemoryContextSwitchTo (Re: [GENERAL] Autovacuum daemon terminated by signal 11)

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема MemoryContextSwitchTo (Re: [GENERAL] Autovacuum daemon terminated by signal 11)
Дата
Msg-id 1232182478.31669.182.camel@ebony.2ndQuadrant
обсуждение исходный текст
Ответы Re: MemoryContextSwitchTo (Re: [GENERAL] Autovacuum daemon terminated by signal 11)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Fri, 2009-01-16 at 18:43 -0500, Tom Lane wrote:

> What is happening is that autovacuum_do_vac_analyze contains
> 
>         old_cxt = MemoryContextSwitchTo(AutovacMemCxt);
>         ...
>         vacuum(vacstmt, relids);
>         ...
>         MemoryContextSwitchTo(old_cxt);
> 
> and at the time it is called by process_whole_db, CurrentMemoryContext
> points at TopTransactionContext.  Which gets destroyed because
> vacuum()
> internally finishes that transaction and starts a new one.  When we
> come out of vacuum(), CurrentMemoryContext again points at
> TopTransactionContext, but *its not the same one*.  The closing
> MemoryContextSwitchTo is installing a stale pointer, which then
> remains active into CommitTransaction.  It's a wonder this code ever
> works.

Can we add something to memory contexts to make this fail every time?

Seems like we should be able to detect this class of error. If we can't
it seems likely that a number of similar cases exist with other
contexts.

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



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

Предыдущее
От: KaiGai Kohei
Дата:
Сообщение: Status Report on SE-PostgreSQL
Следующее
От: Alan Li
Дата:
Сообщение: Fixes for compiler warnings