Re: Proposal: Generic WAL logical messages

Поиск
Список
Период
Сортировка
От Artur Zakirov
Тема Re: Proposal: Generic WAL logical messages
Дата
Msg-id 56D1D040.2030408@postgrespro.ru
обсуждение исходный текст
Ответ на Re: Proposal: Generic WAL logical messages  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Hello,

On 27.02.2016 03:05, Andres Freund wrote:
> Hi,
>
> I'm not really convinced by RegisterStandbyMsgPrefix() et al. There's
> not much documentation about what it actually is supposed to
> acomplish. Afaics you're basically forced to use
> shared_preload_libraries with it right now?  Also, iterating through a
> linked list everytime something is logged doesn't seem very satisfying?
>

I have did some tests with a simple plugin. I have used event triggers 
to send messages. It works, but I agree with Andres. We have problems if 
plugin is not loaded. For example, if you will execute the query:

SELECT 'msg2' FROM pg_logical_send_message(false, 'test', 'msg2');

you will get the error (if plugin which should register a prefix is not 
loaded yet):

ERROR:  standby message prefix "test" is not registered

Some stylistic note (logical.c):

> +static void message_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,
> +                               XLogRecPtr message_lsn,
> +                               bool transactional, const char *prefix,
> +                               Size sz, const char *message)
> +{
> +    LogicalDecodingContext *ctx = cache->private_data;
> +    LogicalErrorCallbackState state;
> +    ErrorContextCallback errcallback;

It should be written in the following way:

static void
message_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,               XLogRecPtr message_lsn,
booltransactional, const char *prefix,               Size sz, const char *message)
 
{LogicalDecodingContext *ctx = cache->private_data;LogicalErrorCallbackState state;ErrorContextCallback errcallback;

-- 
Artur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company



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

Предыдущее
От: Amit Langote
Дата:
Сообщение: Typo fix
Следующее
От: 大山真実
Дата:
Сообщение: Re: [PROPOSAL] VACUUM Progress Checker.