Обсуждение: Re: [BUGS] BUG #4941: pg_stat_statements crash

Поиск
Список
Период
Сортировка

Re: [BUGS] BUG #4941: pg_stat_statements crash

От
Itagaki Takahiro
Дата:
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> > We should call [Read dumpfile] routine only once even on Windows.
> Seems to me that you should simply do the load only when found is false.

Here is a patch to fix pg_stat_statements on Windows.

I see we don't need any locks because initialization is done in postmaster;
There are no chance to see uninitialized state of 'pgss' after relasing
AddinShmemInitLock and before load dumpfile into it.

I also check pgss_shmem_shutdown and no problem.
It is called only once from postmaster on shutdown.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center


Вложения

Re: [BUGS] BUG #4941: pg_stat_statements crash

От
Alvaro Herrera
Дата:
Itagaki Takahiro escribió:
> 
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> > > We should call [Read dumpfile] routine only once even on Windows.
> > Seems to me that you should simply do the load only when found is false.
> 
> Here is a patch to fix pg_stat_statements on Windows.

Hmm, it seems the comment just above the patched line needs to be fixed.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: [BUGS] BUG #4941: pg_stat_statements crash

От
Tom Lane
Дата:
Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp> writes:
> Here is a patch to fix pg_stat_statements on Windows.

Yeah, that looks about right to me.  Committed.
        regards, tom lane


Re: [BUGS] BUG #4941: pg_stat_statements crash

От
Tom Lane
Дата:
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Itagaki Takahiro escribi�:
>> Here is a patch to fix pg_stat_statements on Windows.

> Hmm, it seems the comment just above the patched line needs to be fixed.

I looked at that and decided it was OK as-is.  How do you want to
change it?
        regards, tom lane


Re: [BUGS] BUG #4941: pg_stat_statements crash

От
Alvaro Herrera
Дата:
Tom Lane escribió:
> Alvaro Herrera <alvherre@commandprompt.com> writes:
> > Itagaki Takahiro escribi�:
> >> Here is a patch to fix pg_stat_statements on Windows.
> 
> > Hmm, it seems the comment just above the patched line needs to be fixed.
> 
> I looked at that and decided it was OK as-is.  How do you want to
> change it?

The reason that it doesn't need locks is not that there's no other
process running, but that it was already initialized, in the case when
found is false.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: [BUGS] BUG #4941: pg_stat_statements crash

От
Tom Lane
Дата:
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Tom Lane escribió:
>> I looked at that and decided it was OK as-is.  How do you want to
>> change it?

> The reason that it doesn't need locks is not that there's no other
> process running, but that it was already initialized, in the case when
> found is false.

Mph.  The comment is correct, I think, but it applies to the situation
after we pass the !found test, rather than where the comment is.  Maybe
we should just move it down one statement?
        regards, tom lane