Re: Logical replication timeout problem
Fabrice Chapuis <fabrice636861@gmail.com>
From: Fabrice Chapuis <fabrice636861@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-09-21T15:41:50Z
Lists: pgsql-hackers
> IIUC, these are called after processing each WAL record so not sure how is it possible in your case that these are not reached? I don't know, as you say, to highlight the problem we would have to debug the WalSndKeepaliveIfNecessary function > I was curious to know if the walsender has exited before walreceiver During the last tests we made we didn't observe any timeout of the wal sender process. > Do you mean you are planning to change from 1 minute to 5 minutes? We set wal_sender_timeout/wal_receiver_timeout to 5' and launch new test. The result is surprising and rather positive there is no timeout any more in the log and the 20Gb of snap files are removed in less than 5 minutes. How to explain that behaviour, why the snap files are consumed suddenly so quickly. I choose the value arbitrarily for wal_sender_timeout/wal_receiver_timeout parameters, are theses values appropriate from your point of view? Best Regards Fabrice On Tue, Sep 21, 2021 at 11:52 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > On Tue, Sep 21, 2021 at 1:52 PM Fabrice Chapuis <fabrice636861@gmail.com> > wrote: > > > > If I understand, the instruction to send keep alive by the wal sender > has not been reached in the for loop, for what reason? > > ... > > * Check for replication timeout. */ > > WalSndCheckTimeOut(); > > > > /* Send keepalive if the time has come */ > > WalSndKeepaliveIfNecessary(); > > ... > > > > Are you sure that these functions have not been called? Or the case is > that these are called but due to some reason the keep-alive is not > sent? IIUC, these are called after processing each WAL record so not > sure how is it possible in your case that these are not reached? > > > The data load is performed on a table which is not replicated, I do not > understand why the whole transaction linked to an insert is copied to snap > files given that table does not take part of the logical replication. > > > > It is because we don't know till the end of the transaction (where we > start sending the data) whether the table will be replicated or not. I > think specifically for this purpose the new 'streaming' feature > introduced in PG-14 will help us to avoid writing data of such tables > to snap/spill files. See 'streaming' option in Create Subscription > docs [1]. > > > We are going to do a test by modifying parameters > wal_sender_timeout/wal_receiver_timeout from 1' to 5'. The problem is that > these parameters are global and changing them will also impact the physical > replication. > > > > Do you mean you are planning to change from 1 minute to 5 minutes? I > agree with the global nature of parameters and I think your approach > to finding out the root cause is good here because otherwise, under > some similar or more heavy workload, it might lead to the same > situation. > > > Concerning the walsender timeout, when the worker is started again after > a timeout, it will trigger a new walsender associated with it. > > > > Right, I know that but I was curious to know if the walsender has > exited before walreceiver. > > [1] - https://www.postgresql.org/docs/devel/sql-createsubscription.html > > -- > With Regards, > Amit Kapila. >
Commits
-
Fix the logical replication timeout during large DDLs.
- 8c58624df462 16.0 landed
-
Fix the logical replication timeout during large transactions.
- f95d53eded55 15.0 landed
- d6da71fa8f28 14.4 landed
- 55558df23741 13.8 landed
- f832b5007c1c 12.12 landed
- 87c1dd246af8 11.17 landed
- a4015ec0375d 10.22 landed
-
Rethink the delay-checkpoint-end mechanism in the back-branches.
- 10520f434687 14.3 cited
-
Revert "Logical decoding of sequences"
- 2c7ea57e56ca 15.0 cited
-
Skip empty transactions for logical replication.
- d5a9d86d8ffc 15.0 cited
-
Allow specifying column lists for logical replication
- 923def9a533a 15.0 cited
-
Add decoding of sequences to built-in replication
- 75b1521dae1f 15.0 cited
-
Fix ABI break introduced by commit 4daa140a2f.
- 56e366f6757d 13.4 cited
-
Lag tracking for logical replication
- 024711bb5446 10.0 cited