Re: easy way of copying regex_t

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: easy way of copying regex_t
Дата
Msg-id 21779.1453671690@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: easy way of copying regex_t  (Artur Zakirov <a.zakirov@postgrespro.ru>)
Ответы Re: easy way of copying regex_t  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Список pgsql-hackers
Artur Zakirov <a.zakirov@postgrespro.ru> writes:
> With this message I want to send some patch to your repository with 
> draft of a code, which allows shared_ispell to copy regex_t.

Allowing ispell.c to know that much about regex internals strikes me as
completely unacceptable from a modularity or maintainability standpoint.
If we want to do that, the appropriate thing would be to add a function
to backend/regex/ that copies a regex_t.

However, I'm rather suspicious of the safety of copying a regex_t into
shared memory in the first place.  It contains function pointers, which
we have not historically assumed would be portable between different
backend processes.  And the regex library is old enough to have never
heard of thread safety, so I'm not really sure that it considers the
regex_t structures to be read-only at execution time.

> shared_ispell loads dictionaries into a shared memory. The main benefits 
> are:
> - saving of memory. Every dictionary is loaded only once. Dictionaries 
> are not loaded for each backend. In current version of PostgreSQL 
> dictionaires are loaded for each backend where it was requested.
> - saving of time. The first load of a dictionary takes much time. With 
> this patch dictionaries will be loaded only once.

Where does the shared memory space come from?  It would not take too
many dictionaries to use up whatever slop is available.
        regards, tom lane



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

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Removing Functionally Dependent GROUP BY Columns
Следующее
От: "Dickson S. Guedes"
Дата:
Сообщение: Re: Why format() adds double quote?