proposal: tsearch dictionary initialization hook

Lists: pgsql-hackers
From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: proposal: tsearch dictionary initialization hook
Date: 2010-09-05 06:36:33
Message-ID: AANLkTiktC223yrxYUT6T7Qq0ZbL-Xr7Bx60WN==EEuTD@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello,

I propose a new hook type - that helps with controlling a life cycle
of some tsearch dictionaries. This hook has minimal impact on
performance - it's called once per session for one tsearch
configuration.

Regards

Pavel Stehule

Attachment Content-Type Size
ts_init_dict_hook.diff application/octet-stream 1.6 KB

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: proposal: tsearch dictionary initialization hook
Date: 2010-09-07 15:01:42
Message-ID: 4C8653D6.1080604@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hm, what is aim of this hook? It looks like a wrapper of dictionary init method.

> I propose a new hook type - that helps with controlling a life cycle
> of some tsearch dictionaries. This hook has minimal impact on
> performance - it's called once per session for one tsearch
> configuration.

--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: proposal: tsearch dictionary initialization hook
Date: 2010-09-07 16:55:35
Message-ID: AANLkTiniZRpCwBUNc0fO7Spf=cBLM3=hLL6bmz8-OT16@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello

2010/9/7 Teodor Sigaev <teodor(at)sigaev(dot)ru>:
> Hm, what is aim of this hook? It looks like a wrapper of dictionary init
> method.

If I use a mmap for shared dictionary, then I have to prealloc and
maybe preread dictionary - it can be done in external module. But I
have to join preloaded dictionary to requested dictionary. This hook
allows this relation - and it's general - I don't need any special
support in ispell dictionary.

Regards

Pavel

>
>> I propose a new hook type - that helps with controlling a life cycle
>> of some tsearch dictionaries. This hook has minimal impact on
>> performance - it's called once per session for one tsearch
>> configuration.
>
> --
> Teodor Sigaev                                   E-mail: teodor(at)sigaev(dot)ru
>                                                   WWW: http://www.sigaev.ru/
>


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Teodor Sigaev <teodor(at)sigaev(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: proposal: tsearch dictionary initialization hook
Date: 2010-09-28 03:17:52
Message-ID: AANLkTimQXs0nJprxL6SD_YZWENRf+dogYCno=Mu+V9-d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Sep 7, 2010 at 12:55 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> 2010/9/7 Teodor Sigaev <teodor(at)sigaev(dot)ru>:
>> Hm, what is aim of this hook? It looks like a wrapper of dictionary init
>> method.
>
> If I use a mmap for shared dictionary, then I have to prealloc and
> maybe preread dictionary - it can be done in external module. But I
> have to join preloaded dictionary to requested dictionary. This hook
> allows this relation - and it's general - I don't need any special
> support in ispell dictionary.

Review:

1. Is this really necessary? It seems that you're inserting a hook
here when you could just as well change tmplinit to point to whatever
function you want to call, which wouldn't require a code change.

2. Our standard criteria for the inclusion of a hook is some sample
code that demonstrates how it can be usefully used. I think you need
to provide that before we can consider this further.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Teodor Sigaev <teodor(at)sigaev(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: proposal: tsearch dictionary initialization hook
Date: 2010-09-30 09:36:56
Message-ID: AANLkTinUjr6bHbX57tch-k4YW5EJmPwjrYjs3wRZnPaU@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello

2010/9/28 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Tue, Sep 7, 2010 at 12:55 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> 2010/9/7 Teodor Sigaev <teodor(at)sigaev(dot)ru>:
>>> Hm, what is aim of this hook? It looks like a wrapper of dictionary init
>>> method.
>>
>> If I use a mmap for shared dictionary, then I have to prealloc and
>> maybe preread dictionary - it can be done in external module. But I
>> have to join preloaded dictionary to requested dictionary. This hook
>> allows this relation - and it's general - I don't need any special
>> support in ispell dictionary.
>
> Review:
>
> 1. Is this really necessary?  It seems that you're inserting a hook
> here when you could just as well change tmplinit to point to whatever
> function you want to call, which wouldn't require a code change.

The a creating of new hacked template is second option - I didn't find
it. It good for hacking and probably I'll use it because I have not a
time to work on this problem. On second hand - it is less on more
little bit dark hack - you have to modify system tables. Using a hook
is more transparent - you can or not just load a module, that uses a
hook.

>
> 2. Our standard criteria for the inclusion of a hook is some sample
> code that demonstrates how it can be usefully used.  I think you need
> to provide that before we can consider this further.
>

yes - I understand, but I have not time to work on this subject now,
so It can be moved to rejected patches queue. Some my ideas depends on
proposed (different people) shared memory control, but I don't see any
move on this, so there isn't reason why implement a hook or some
modules uses this hook now.

Regards

Pavel Stehule

> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise Postgres Company
>