Re: Rationalizing code-sharing among src/bin/ directories

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Rationalizing code-sharing among src/bin/ directories
Дата
Msg-id CAB7nPqT6zMvnVogfBRBtGvM66MEt0iaDvkVbHvv=+c2pqjwO=w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Rationalizing code-sharing among src/bin/ directories  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Fri, Mar 25, 2016 at 12:55 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Michael Paquier <michael.paquier@gmail.com> writes:
>> Not sure if Andres is working on that for now or not, the main
>> discussion that I am foreseeing here is how we are going to map elevel
>> for the frontend (should FATAL, PANIC exit immediately, etc).
>
> Doesn't seem that complicated to me: elevel >= ERROR results in exit(1),
> otherwise just print to stderr and return.  We'd be eyeballing each case
> that we remove "#ifndef FRONTEND" from anyway; if it's expecting behavior
> noticeably more complicated than that, we could leave it as-is.

Something that I see as mandatory as well is a way to bypass some of
the elevels depending on the way a frontend tool is called, so we'd
need something like that in the common elog facility:

void
elog(blah)
{
#ifdef FRONTEND    if (!callback_routine_defined_in_frontend(elevel))        return;
#endif
    blah_blah_move_on.
}

This would be useful to avoid code patterns of this type in a frontend
tool where for example a debug flag is linked with elevel. For example
this pattern:
if (debug)   elog(DEBUG1, "Debug blah");
could be reduced to as the callback routine would allow bypassing
elog() directly:
elog(DEBUG1, "Debug blah");

That's just food for thought at this stage, I get back to reviewing...
-- 
Michael



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

Предыдущее
От: Ashutosh Bapat
Дата:
Сообщение: Re: Odd system-column handling in postgres_fdw join pushdown patch
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Optimization for updating foreign tables in Postgres FDW