Re: Perform streaming logical transactions by background workers and parallel apply - Mailing list pgsql-hackers

From Dilip Kumar
Subject Re: Perform streaming logical transactions by background workers and parallel apply
Date
Msg-id CAFiTN-vfUFAzrgMQixQ7rKHXYL+2xbPR_8OVVX0zkiGWC2M+aQ@mail.gmail.com
Whole thread Raw
In response to Re: Perform streaming logical transactions by background workers and parallel apply  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: Perform streaming logical transactions by background workers and parallel apply  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
On Mon, Dec 26, 2022 at 6:59 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
>


In the commit message, there is a statement like this

"However, if the leader apply worker times out while attempting to
send a message to the
parallel apply worker, it will switch to "partial serialize" mode -  in this
mode the leader serializes all remaining changes to a file and notifies the
parallel apply workers to read and apply them at the end of the transaction."

I think it is a good idea to serialize the change to the file in this
case to avoid deadlocks, but why does the parallel worker need to wait
till the transaction commits to reading the file?  I mean we can
switch the serialize state and make a parallel worker pull changes
from the file and if the parallel worker has caught up with the
changes then it can again change the state to "share memory" and now
the apply worker can again start sending through shared memory.

I think generally streaming transactions are large and it is possible
that the shared memory queue gets full because of a lot of changes for
a particular transaction but later when the load switches to the other
transactions then it would be quite common for the worker to catch up
with the changes then it better to again take advantage of using
memory.  Otherwise, in this case, we are just wasting resources
(worker/shared memory queue) but still writing in the file.

-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Error-safe user functions
Next
From: Dilip Kumar
Date:
Subject: Re: Time delayed LR (WAS Re: logical replication restrictions)