Extra XLOG in Checkpoint for StandbySnapshot - Mailing list pgsql-hackers

From Amit Kapila
Subject Extra XLOG in Checkpoint for StandbySnapshot
Date
Msg-id 001801cdecd4$03f37080$0bda5180$@kapila@huawei.com
Whole thread Raw
List pgsql-hackers
<div class="WordSection1"><p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif"">Observationis that whenever a checkpoint happens and the
wal_levelconfigured is hot_standby then one standby snapshot XLOG gets written with the information of “running
transaction”.</span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif""><br />So if
firsttime checkpoint happened at specified interval, it will create new XLOG in LogStandbySnapshot, due to which
checkpointoperation doesn’t get skipped again on next interval. This is okay if there are any running transactions, but
itseems XLOG is written even if there is no running xact.<br /><br />As per the analysis below is the code snippet
doingthis: <br />                running = GetRunningTransactionData(); <br />               
LogCurrentRunningXacts(running);<br /><br /></span><p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif"">Soirrespective of value of running, snapshot is getting
logged.<br /><br />So We can modify to change this in function LogStandbySnapshot as below: <br />               
running= GetRunningTransactionData(); <br /><span style="color:navy">                </span><span style="color:blue">if
(running->xcnt> 0)</span><br />                        LogCurrentRunningXacts(running); <br /><br /></span><p
class="MsoNormal"><spanstyle="font-size:10.0pt;font-family:"Arial","sans-serif"">So this check will make sure that if
thereis no operation happening i.e. no new running transaction, then no need to log running transaction snapshot and
hencefurther checkpoint operations will be skipped. <br /><br /></span><p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif"">Letme know if I am missing something?</span><p
class="MsoNormal"><spanstyle="font-size:10.0pt;font-family:"Arial","sans-serif""> </span><p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif"">WithRegards,</span><p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif"">AmitKapila.</span></div> 

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: psql \l to accept patterns
Next
From: Simon Riggs
Date:
Subject: Re: Extra XLOG in Checkpoint for StandbySnapshot