Re: Logical replication timeout problem
От | Euler Taveira |
---|---|
Тема | Re: Logical replication timeout problem |
Дата | |
Msg-id | 8cc4f31f-240a-4590-94a8-a50bdf4f4d1c@www.fastmail.com обсуждение исходный текст |
Ответ на | Re: Logical replication timeout problem (Amit Kapila <amit.kapila16@gmail.com>) |
Ответы |
Re: Logical replication timeout problem
|
Список | pgsql-hackers |
On Thu, Mar 31, 2022, at 11:27 PM, Amit Kapila wrote:
This is exactly our initial analysis and we have tried a patch onthese lines and it has a noticeable overhead. See [1]. Calling thisfor each change or each skipped change can bring noticeable overheadthat is why we decided to call it after a certain threshold (100) ofskipped changes. Now, surely as mentioned in my previous reply we canmake it generic such that instead of calling this (update_progressfunction as in the patch) for skipped cases, we call it always. Willthat make it better?
That's what I have in mind but using a different approach.
> The functions CreateInitDecodingContext and CreateDecodingContext receives the> update_progress function as a parameter. These functions are called in 2> places: (a) streaming replication protocol (CREATE_REPLICATION_SLOT) and (b)> SQL logical decoding functions (pg_logical_*_changes). Case (a) uses> WalSndUpdateProgress as a progress function. Case (b) does not have one because> it is not required -- local decoding/communication. There is no custom update> progress routine for each output plugin which leads me to the question:> couldn't we encapsulate the update progress call into the callback functions?>Sorry, I don't get your point. What exactly do you mean by this?AFAIS, currently we call this output plugin API in pgoutput functionsonly, do you intend to get it invoked from a different place?
It seems I didn't make myself clear. The callbacks I'm referring to the
*_cb_wrapper functions. After every ctx->callbacks.foo_cb() call into a
*_cb_wrapper() function, we have something like:
if (ctx->progress & PGOUTPUT_PROGRESS_FOO)
NewUpdateProgress(ctx, false);
The NewUpdateProgress function would contain a logic similar to the
update_progress() from the proposed patch. (A different function name here just
to avoid confusion.)
The output plugin is responsible to set ctx->progress with the callback
variables (for example, PGOUTPUT_PROGRESS_CHANGE for change_cb()) that we would
like to run NewUpdateProgress.
В списке pgsql-hackers по дате отправления: