Re: Proposal: Generic WAL logical messages - Mailing list pgsql-hackers

From Artur Zakirov
Subject Re: Proposal: Generic WAL logical messages
Date
Msg-id 56D1D040.2030408@postgrespro.ru
Whole thread Raw
In response to Re: Proposal: Generic WAL logical messages  (Andres Freund <andres@anarazel.de>)
List 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 by date:

Previous
From: Amit Langote
Date:
Subject: Typo fix
Next
From: 大山真実
Date:
Subject: Re: [PROPOSAL] VACUUM Progress Checker.