<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<meta name="Generator" content="Zarafa WebAccess v7.1.10-44973">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Re: [pgpool-general: 2973] pcp_promote_node usecase?</title>
<style type="text/css">
body
{
font-family: Arial, Verdana, Sans-Serif ! important;
font-size: 12px;
padding: 5px 5px 5px 5px;
margin: 0px;
border-style: none;
background-color: #ffffff;
}
p, ul, li
{
margin-top: 0px;
margin-bottom: 0px;
}
</style>
</head>
<body>
<p><style type="text/css">body { font-family: monospace; }</style> <style type="text/css"> .bodyclass { font-family: Arial, Verdana, Sans-Serif ! important; font-size: 12px; padding: 5px 5px 5px 5px; margin: 0px; border-style: none; background-color: #ffffff; } p, ul, li { margin-top: 0px; margin-bottom: 0px; } </style></p><div><p>Hi Yugo,</p> <p> </p> <p>In my case I use pcp_promote_node to also manage/failover my Postgres master-slave streaming-replication cluster backend nodes.</p> <p>I wrote a small patch to accomplish this:</p> <p> </p> <p>--- main.c.orig 2014-08-06 11:23:28.407919835 +0200</p> <p>+++ main.c 2014-08-06 11:25:34.034290079 +0200</p> <p>@@ -1820,6 +1820,9 @@</p> <p> pool_log("starting promotion. promote host %s(%d)",</p> <p> BACKEND_INFO(node_id).backend_hostname,</p> <p> BACKEND_INFO(node_id).backend_port);</p> <p>+</p> <p>+ trigger_failover_command(PRIMARY_NODE_ID, pool_config->failover_command, </p> <p>+ MASTER_NODE_ID, node_id, PRIMARY_NODE_ID);</p> <p> }</p> <p> else</p> <p> {</p> <p> </p> <p>This patch is build against pgpool-II-pg93 version 3.3.2 (I'm using the rpm's from the postgres.org yum repos and patched the source rpm).</p> <p> </p> <p>As you can see it only creates the trigger file on the new master node. My slave is configured as a hot-standby so it's read-only and needs to be set in the master (read/write) state.</p> <p> </p> <p>So I think it's nice to include this in a future version of pgpool and make it configurable in pgpool.conf?</p> <p> </p> <p>Kind regards,</p> <p> </p> <p>Joey Loman</p> <p> </p> <p>> </p> <p>> On Thu, Jun 26, 2014 at 4:54 PM, Yugo Nagata <nagata at sraoss.co.jp> wrote:</p> <p>> </p> <p>> Hi all,</p> <p>> </p> <p>> Are you using pcp_promote_node? If so, please tell me your usecase!</p> <p>> </p> <p>> pgpool-II has pcp_promote_node command, which change specified backend</p> <p>> nodes status to 'primary', but this has some problems.</p> <p>> So, if there is no users of pcp_promote_node, we consider to remove</p> <p>> this from pgpool-II. Or not, I want to know usecases and fix</p> <p>> pcp_promote_node to be more usefull and suitable for the usecase.</p> <p>> </p> <p>> The current pcp_promote_node works as below;</p> <p>> </p> <p>> (0) This is enabled only in master-slave / streaming-replication mode.</p> <p>> </p> <p>> (1) This changes pgpool-II's internal status and set the specified</p> <p>> node to primary. The internal status is used in online-recovery</p> <p>> and loadbalancing etc.. </p> <p>> ** Note that this doesn't control the backend nodes themselves.**</p> <p>> </p> <p>> (2) All nodes other than the new primary are detached from pgpool-II.</p> <p>> </p> <p>> (3) pgpool-II execute follow_master command for all the detached nodes.</p> <p>> follow_master command is mainly used for auto-recovery of standbys</p> <p>> from the new primary.</p> <p>> </p> <p>> Here, I found the some problems:</p> <p>> </p> <p>> (a) Even when DISALLOW_TO_FAILOVER is used, backends node are detached</p> <p>> at step (2).</p> <p>> (b) If pcp_recovery_node is executed in follow_master command at step (3), </p> <p>> recovery can fail because pgpool-II's internal status can be different</p> <p>> from the acutual backend status of primary/standby.</p> <p>> </p> <p>> I want to fix about (a), if there is any user of pcp_promote_node.</p> <p>> I think the design would be:</p> <p>> - When DISALLOW_TO_FAILOVER is used, pcp_promote_node is disabled</p> <p>> because this command can detach some backend nodes.</p> <p>> - or, pcp_promote_node change primary node status, but doesn't detach</p> <p>> any nodes. (In this case, some trick would be required so that </p> <p>> primary node should be unique.)</p> <p>> </p> <p>> About (b), I think this is a restriction of pgpool-II. User have</p> <p>> to note that internal status can be different from the acutual backend</p> <p>> status of primary/standby, after using pcp_promote_node. If you know</p> <p>> other idea, please tell me.</p> <p>> </p> <p>> Any comment and suggestion?</p> <p>> </p> <p>> </p> <p>> Best regards,</p> <p>> -- </p> <p>> Yugo Nagata <nagata at sraoss.co.jp></p></div>
</body>
</html>