<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><head><!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]--></head><body><div class="ydpc2a7a62fyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div><div>I think you might hit a bug which is solved in 3.7.4, here is the bug report I made at the time. The behavior was like you say : first failover OK, then second not anymore.</div><div><br></div><div><a href="http://www.sraoss.jp/pipermail/pgpool-general/2018-May/006152.html" rel="nofollow" target="_blank" class="enhancr_card_0468502261">[pgpool-general: 6094] Re: pgpool failover from node 1 to node 0: incorrect value for %P in version 3.7.3 ?</a><br></div><div><br></div><div id="ydp94cff70cenhancr_card_0468502261" class="ydp94cff70cyahoo-link-enhancr-card ydp94cff70cyahoo-link-enhancr-not-allow-cover ydp94cff70cymail-preserve-class ydp94cff70cymail-preserve-style" style="max-width:400px;font-family:Helvetica Neue, Segoe UI, Helvetica, Arial, sans-serif" data-url="http://www.sraoss.jp/pipermail/pgpool-general/2018-May/006152.html" data-type="YENHANCER" data-size="MEDIUM" contenteditable="false"><a href="http://www.sraoss.jp/pipermail/pgpool-general/2018-May/006152.html" style="text-decoration:none !important;color:#000 !important" class="ydp94cff70cyahoo-enhancr-cardlink" rel="nofollow" target="_blank"><table border="0" class="ydp94cff70ccard-wrapper ydp94cff70cyahoo-ignore-table" cellpadding="0" cellspacing="0" style="max-width:400px"><tbody><tr><td width="400"><table border="0" class="ydp94cff70ccard ydp94cff70cyahoo-ignore-table" cellpadding="0" cellspacing="0" width="100%" style="max-width:400px;border-width:1px;border-style:solid;border-color:rgb(224, 228, 233);border-radius:2px"><tbody><tr><td><table border="0" class="ydp94cff70ccard-info ydp94cff70cyahoo-ignore-table" cellpadding="0" cellspacing="0" style="background:#fff;position:relative;z-index:2;width:100%;max-width:400px;border-radius:0 0 2px 2px;border-top:1px solid rgb(224, 228, 233)"><tbody><tr><td style="background-color:#ffffff;padding:16px 0 16px 12px;vertical-align:top;border-radius:0 0 0 2px"></td><td style="vertical-align:middle;padding:12px 24px 16px 12px;width:99%;font-family:Helvetica Neue, Segoe UI, Helvetica, Arial, sans-serif;border-radius:0 0 2px 0"><h2 class="ydp94cff70ccard-title" style="font-size: 14px; line-height: 19px; margin: 0px 0px 6px; font-family: Helvetica Neue, Segoe UI, Helvetica, Arial, sans-serif; color: rgb(38, 40, 42);">[pgpool-general: 6094] Re: pgpool failover from node 1 to node 0: incorr...</h2><p class="ydp94cff70ccard-description" style="font-size: 12px; line-height: 16px; margin: 0px; color: rgb(151, 155, 167);"></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></a></div><div><br></div><div>Regards,</div><div><br></div><div class="ydpc2a7a62fsignature">Pierre</div></div>
        <div><br></div><div><br></div>
        
        </div><div id="ydp83c956e2yahoo_quoted_0785524086" class="ydp83c956e2yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Tuesday, February 12, 2019, 6:44:45 PM GMT+1, Andre Piwoni &lt;apiwoni@webmd.net&gt; wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="ydp83c956e2yiv7786064115"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">I have cluster of two nodes with failover script which promotes primary node only when&nbsp;<span style="color:rgb(0,0,0);font-family:Menlo;font-size:9pt;">${failed_node_id} = ${old_primary_node_id}</span><div><span style="color:rgb(0,0,0);font-family:Menlo;font-size:9pt;">A</span><span style="color:rgb(64,64,64);">fter failover from node1 to node2 is successfully executed, second failover attempt from node2 to node1 fails because old primary node is incorrectly reported.</span></div><div><font color="#404040">Other people seem to have problems with reporting old primary node id <a href="https://www.pgpool.net/mantisbt/view.php?id=112" rel="nofollow" target="_blank">https://www.pgpool.net/mantisbt/view.php?id=112</a></font></div><div><font color="#404040">I noticed that many failover scripts do not check if&nbsp;</font><span style="color:rgb(0,0,0);font-family:Menlo;font-size:12px;">${failed_node_id} = ${old_primary_node_id}</span><span style="color:rgb(64,64,64);">&nbsp;before promotion so my question is a follows.</span></div><div><span style="color:rgb(64,64,64);">Given this flakiness in reporting, is there any reason to perform this test in failover script before promotion? I run PgPool-II 3.7.3.</span></div><div><span style="color:rgb(64,64,64);"><br></span></div><div><span style="color:rgb(64,64,64);">Here's relevant info:</span></div><div><span style="color:rgb(64,64,64);"><br></span></div><div><font color="#404040">systemctl start pgpool</font><br></div><div><div>Feb 12 09:13:01 pg-hdp-node1 pgpool[25308]: [7-1] 2019-02-12 09:13:01: pid 25308: LOG:&nbsp; find_primary_node: primary node id is 1<br></div><div><br></div><div><div>postgres=&gt; show pool_nodes;</div><div>&nbsp;node_id |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hostname&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | port | status | lb_weight |&nbsp; role&nbsp; &nbsp;| select_cnt | load_balance_node | replication_delay&nbsp;</div><div>---------+----------------------------+------+--------+-----------+---------+------------+-------------------+-------------------</div><div>&nbsp;0&nbsp; &nbsp; &nbsp; &nbsp;| pg-hdp-node1.kitchen.local | 5432 | up&nbsp; &nbsp; &nbsp;| 0.500000&nbsp; | standby | 0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | false&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 0</div><div>&nbsp;1&nbsp; &nbsp; &nbsp; &nbsp;| pg-hdp-node2.kitchen.local | 5432 | up&nbsp; &nbsp; &nbsp;| 0.500000&nbsp; | primary | 0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | true&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | 0</div></div><div><br></div><div>pg-hdp-node2.kitchen.local&gt; systemctl stop postgresql-10<br></div><div><div>Feb 12 09:15:06 pg-hdp-node1 pgpool[25308]: [9-1] 2019-02-12 09:15:06: pid 25308: LOG:&nbsp; Pgpool-II parent process has received failover request</div><div>Feb 12 09:15:06 pg-hdp-node1 pgpool[25308]: [10-1] 2019-02-12 09:15:06: pid 25308: LOG:&nbsp; starting degeneration. shutdown host pg-hdp-node2.kitchen.local(5432)</div></div><div><br></div><div><div>[root@pg-hdp-node1 pgpool]# cat failover.log&nbsp;</div><div>failed_node_id&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1</div><div>failed_node_host&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pg-hdp-node2.kitchen.local</div><div>failed_node_port&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5432</div><div>failed_node_pgdata&nbsp; &nbsp; &nbsp; &nbsp;/var/lib/pgsql/10/data</div><div>old_primary_node_id&nbsp; &nbsp; &nbsp; 0</div><div>old_master_node_id&nbsp; &nbsp; &nbsp; &nbsp;0</div><div>new_master_node_id&nbsp; &nbsp; &nbsp; &nbsp;0</div><div>new_master_node_host&nbsp; &nbsp; &nbsp;pg-hdp-node1.kitchen.local</div><div>new_master_node_port&nbsp; &nbsp; &nbsp;5432</div><div>new_master_node_pgdata&nbsp; &nbsp;/var/lib/pgsql/10/data</div></div><div><br></div><div>Old primary node id should 1.</div><div><br></div><div><b><span style="color:rgb(64,64,64);">Andre Piwoni</span></b><br></div></div></div></div></div></div></div></div></div></div></div>_______________________________________________<br>pgpool-general mailing list<br><a href="mailto:pgpool-general@pgpool.net" rel="nofollow" target="_blank">pgpool-general@pgpool.net</a><br><a href="http://www.pgpool.net/mailman/listinfo/pgpool-general" rel="nofollow" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-general</a><br></div>
            </div>
        </div></body></html>