<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hello Tatsuo,<br>
    <br>
    Did the attached log provide any insight?<br>
    <br>
    Thanks,<br>
    Sean<br>
    <div class="moz-forward-container"><br>
      <br>
      -------- Original Message --------
      <table class="moz-email-headers-table" cellpadding="0"
        cellspacing="0" border="0">
        <tbody>
          <tr>
            <th nowrap="nowrap" valign="BASELINE" align="RIGHT">Subject:
            </th>
            <td>Re: [pgpool-general: 2639] Re: pcp_recovery_node failing
              in stage 1</td>
          </tr>
          <tr>
            <th nowrap="nowrap" valign="BASELINE" align="RIGHT">Date: </th>
            <td>Fri, 21 Mar 2014 10:59:21 -0230</td>
          </tr>
          <tr>
            <th nowrap="nowrap" valign="BASELINE" align="RIGHT">From: </th>
            <td>Sean Hogan <a class="moz-txt-link-rfc2396E" href="mailto:sean@compusult.net">&lt;sean@compusult.net&gt;</a></td>
          </tr>
          <tr>
            <th nowrap="nowrap" valign="BASELINE" align="RIGHT">To: </th>
            <td>Tatsuo Ishii <a class="moz-txt-link-rfc2396E" href="mailto:ishii@postgresql.org">&lt;ishii@postgresql.org&gt;</a></td>
          </tr>
          <tr>
            <th nowrap="nowrap" valign="BASELINE" align="RIGHT">CC: </th>
            <td><a class="moz-txt-link-abbreviated" href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <pre>I agree, it makes no sense.  The strace is attached.

Sean

On 14-03-21 10:02 AM, Tatsuo Ishii wrote:
&gt; Ridiculous. There's no code in pgpool which sends signal 2 to recovery
&gt; command. Is it possible to start pgpool from strace and do the
&gt; recovery so that we could find who sends the signal?
&gt;
&gt; strace -f pgpool start
&gt;
&gt; Best regards,
&gt; --
&gt; Tatsuo Ishii
&gt; SRA OSS, Inc. Japan
&gt; English: <a class="moz-txt-link-freetext" href="http://www.sraoss.co.jp/index_en.php">http://www.sraoss.co.jp/index_en.php</a>
&gt; Japanese: <a class="moz-txt-link-freetext" href="http://www.sraoss.co.jp">http://www.sraoss.co.jp</a>
&gt;
&gt;&gt; The stage 1 script is not careful with exit codes, so it continues
&gt;&gt; after the failed rsync and eventually exits with success.  This tricks
&gt;&gt; pgpool into continuing with stage 2, but it's definitely the state 1
&gt;&gt; command that is failing.
&gt;&gt;
&gt;&gt; Sean
&gt;&gt;
&gt;&gt; On 14-03-21 06:20 AM, Tatsuo Ishii wrote:
&gt;&gt;&gt;&gt; Sorry, the subject line should have said stage *1*.
&gt;&gt;&gt; Really? From what I read from pgpool log:
&gt;&gt;&gt;
&gt;&gt;&gt; 2014-03-20 12:42:43 LOG:   pid 18259: 1st stage is done
&gt;&gt;&gt; 2014-03-20 12:42:43 LOG:   pid 18259: starting 2nd stage
&gt;&gt;&gt; 2014-03-20 12:42:47 LOG:   pid 18259: CHECKPOINT in the 2nd stage done
&gt;&gt;&gt; 2014-03-20 12:42:47 LOG: pid 18259: starting recovery command: "SELECT
&gt;&gt;&gt; pgpool_recovery('pgpool_recovery_pitr.sh', 'psql02.compusult.net',
&gt;&gt;&gt; '/var/lib/pgsql/9.2/data')"
&gt;&gt;&gt; 2014-03-20 12:42:49 LOG: pid 18259: check_postmaster_started: try to
&gt;&gt;&gt; connect to postmaster on hostname:psql02.compusult.net
&gt;&gt;&gt; database:postgres user:postgres (retry 0 times)
&gt;&gt;&gt;
&gt;&gt;&gt; I saw "1st stage is done" and I guess the first stage has been
&gt;&gt;&gt; succeeded but the second stage failed. What does the second stage look
&gt;&gt;&gt; like?
&gt;&gt;&gt;
&gt;&gt;&gt; Best regards,
&gt;&gt;&gt; --
&gt;&gt;&gt; Tatsuo Ishii
&gt;&gt;&gt; SRA OSS, Inc. Japan
&gt;&gt;&gt; English: <a class="moz-txt-link-freetext" href="http://www.sraoss.co.jp/index_en.php">http://www.sraoss.co.jp/index_en.php</a>
&gt;&gt;&gt; Japanese: <a class="moz-txt-link-freetext" href="http://www.sraoss.co.jp">http://www.sraoss.co.jp</a>
&gt;&gt;&gt;
&gt;&gt;&gt;&gt; On 14-03-20 12:48 PM, Sean Hogan wrote:
&gt;&gt;&gt;&gt;&gt; Hi,
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt; In my setup at the moment I have a pair of version 3.3.2 pgpool
&gt;&gt;&gt;&gt;&gt; instances with two backend PostgreSQL 9.2.4 servers, all running on
&gt;&gt;&gt;&gt;&gt; CentOS 6.4.  The PostgreSQL data directories are quite large - 144GB.
&gt;&gt;&gt;&gt;&gt; I have run into a situation where pcp_recovery_node consistently fails
&gt;&gt;&gt;&gt;&gt; with a BackendError.
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt; The stage 1 recovery command is a script called do-base-backup.sh that
&gt;&gt;&gt;&gt;&gt; runs an rsync as follows:
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt;       rsync -Cacvv --delete \
&gt;&gt;&gt;&gt;&gt;               --exclude postmaster.pid --exclude postmaster.opts \
&gt;&gt;&gt;&gt;&gt;               --exclude recovery.done \
&gt;&gt;&gt;&gt;&gt;               --exclude pg_log/\* --exclude pg_xlog/\* \
&gt;&gt;&gt;&gt;&gt;               $SOURCE/ $DESTINATION/ 2&gt;&amp;1 |
&gt;&gt;&gt;&gt;&gt;       mailx -s "rsync verbose output" <a class="moz-txt-link-abbreviated" href="mailto:sean@compusult.net">sean@compusult.net</a>
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt; For some reason this rsync is failing after some minutes (typically 10
&gt;&gt;&gt;&gt;&gt; to 12) with undocumented exit code 255.  The verbose rsync logging
&gt;&gt;&gt;&gt;&gt; says this:
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt;       Killed by signal 2.
&gt;&gt;&gt;&gt;&gt;       rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]:
&gt;&gt;&gt;&gt;&gt;       Broken pipe (32)
&gt;&gt;&gt;&gt;&gt;       rsync: connection unexpectedly closed (50735 bytes received so far)
&gt;&gt;&gt;&gt;&gt;       [sender]
&gt;&gt;&gt;&gt;&gt;       rsync error: unexplained error (code 255) at io.c(600) [sender=3.0.6]
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt; Googling has not brought up anything helpful other than bugs with
&gt;&gt;&gt;&gt;&gt; large files in older versions of rsync.  I'm fairly certain that is
&gt;&gt;&gt;&gt;&gt; not the case here, especially because of the "Killed by signal 2",
&gt;&gt;&gt;&gt;&gt; which is suggestive of some sort of timeout on the pgpool end.
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt; The specific command line I'm using to recover the second database
&gt;&gt;&gt;&gt;&gt; node is:
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt;       sudo -u postgres /usr/local/bin/pcp_recovery_node 10000 psql01 9898
&gt;&gt;&gt;&gt;&gt;       postgres XXXXXX 1
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt; With such a large timeout value I shouldn't be hitting a timeout
&gt;&gt;&gt;&gt;&gt; there.
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt; The weird thing, which makes me point the finger at either pgpool or
&gt;&gt;&gt;&gt;&gt; pcp_recovery_node, is that if I run do-base-backup.sh manually it
&gt;&gt;&gt;&gt;&gt; works fine (and takes much much longer, as expected).
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt; Does pgpool have some internal limit on how long it will wait for the
&gt;&gt;&gt;&gt;&gt; 1st stage command to run?  I've attached the log file but it isn't
&gt;&gt;&gt;&gt;&gt; very informative.  (Note that the do-base-backup.sh script isn't
&gt;&gt;&gt;&gt;&gt; communicating the rsync failure back to pgpool, so pgpool goes ahead
&gt;&gt;&gt;&gt;&gt; and runs stage 2.  Of course, that fails because not everything has
&gt;&gt;&gt;&gt;&gt; been synced.)
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt; Thanks,
&gt;&gt;&gt;&gt;&gt; Sean
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt; _______________________________________________
&gt;&gt;&gt;&gt;&gt; pgpool-general mailing list
&gt;&gt;&gt;&gt;&gt; <a class="moz-txt-link-abbreviated" href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a>
&gt;&gt;&gt;&gt;&gt; <a class="moz-txt-link-freetext" href="http://www.pgpool.net/mailman/listinfo/pgpool-general">http://www.pgpool.net/mailman/listinfo/pgpool-general</a>


</pre>
      <br>
    </div>
    <br>
  </body>
</html>