RE: Improve the performance to create END_OF_RECOVERY checkpoint

2020-12-22 Thread Jakub Wartak
Hi Ray,

> So can we delete the limit of ArchiveRecoveryRequested, and enable launch 
> bgwriter in master node ?

Please take a look on https://commitfest.postgresql.org/29/2706/ and the 
related email thread.

-J. 




Improve the performance to create END_OF_RECOVERY checkpoint

2020-12-21 Thread Thunder
Dear All


In startup process we only launch bgwriter when ArchiveRecoveryRequested is 
true, which means we will not lauch bgwriter in master node.
The bgwriters can write the dirty buffers to disk which helps startup process 
to do less IO when we complete xlog replay and request to do END_OF_RECOVERY 
checkpoint.
So can we delete the limit of ArchiveRecoveryRequested, and enable launch 
bgwriter in master node ?


   7128 /*
   7129  * Let postmaster know we've started redo now, so that it can 
launch
   7130  * checkpointer to perform restartpoints.  We don't bother 
during
   7131  * crash recovery as restartpoints can only be performed during
   7132  * archive recovery.  And we'd like to keep crash recovery 
simple, to
   7133  * avoid introducing bugs that could affect you when recovering 
after
   7134  * crash.
   7135  *
   7136  * After this point, we can no longer assume that we're the only
   7137  * process in addition to postmaster!  Also, fsync requests are
   7138  * subsequently to be handled by the checkpointer, not locally.
   7139  */
   7140 if (ArchiveRecoveryRequested && IsUnderPostmaster)
   7141 {
   7142 PublishStartupProcessInformation();
   7143 EnableSyncRequestForwarding();
   7144 SendPostmasterSignal(PMSIGNAL_RECOVERY_STARTED);
   7145 bgwriterLaunched = true;
   7146 }


Thanks
Ray