<div dir="ltr"><div><div>Hi Bo,<br><br></div>I had been reviewing recovery_1st.sh.sample, and I have a question regarding these lines:<br><br><span style="color:rgb(0,0,255)"><font size="4"># start target server as a streaming replication standby server<br>ssh -T ${SSH_OPTIONS} ${POSTGRESQL_STARTUP_USER}@$DEST_NODE_HOST "<br>      $PGHOME/bin/pg_ctl -l /dev/null -w -D $DEST_NODE_PGDATA start<br>"<br><br># wait till the standby catches up primary server or<br># $MAX_DURATION seconds passes<br>sec=0<br>while [ $sec -lt $MAX_DURATION ]<br>do<br>  sec=`expr $sec + 1`</font></span><br><br></div>If you have chosen wait option "-w" in pg_ctl, it would have finished the process before executing "wait until standby catches primary" whole block, so did you mean no wait option "-W" instead?<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 30, 2023 at 9:28 PM Bo Peng <<a href="mailto:pengbo@sraoss.co.jp">pengbo@sraoss.co.jp</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
Thank you for reporting this issue.<br>
<br>
It is a Pgpool-II's bug and I have fixed it:<br>
<br>
<a href="https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=7ed589de5f608eabe4c0d8026f9adcce1eedd015" rel="noreferrer" target="_blank">https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=7ed589de5f608eabe4c0d8026f9adcce1eedd015</a><br>
<br>
On Tue, 30 May 2023 16:50:33 +0800<br>
Zhaoxun Yan <<a href="mailto:yan.zhaoxun@gmail.com" target="_blank">yan.zhaoxun@gmail.com</a>> wrote:<br>
<br>
> Hi Bo Peng!<br>
> <br>
> I found the variable PORT not defined in the recovery_2nd_stage.sample<br>
> <br>
> #!/bin/bash<br>
> # Online recovery 2nd stage script for snapshot mode<br>
> <br>
> set -o xtrace<br>
> <br>
> MAIN_NODE_PGDATA="$1"              # main dabatase cluster<br>
> DEST_NODE_HOST="$2"                 # hostname of the DB node to be<br>
> recovered<br>
> DEST_NODE_PGDATA="$3"              # database cluster of the DB node to be<br>
> recovered<br>
> MAIN_NODE_PORT="$4"                 # PostgreSQL port number<br>
> <br>
> echo 'recovery_2nd_stage for standby @' $DEST_NODE_HOST<br>
> <br>
> PGHOME=/usr/pgsql-15<br>
> ARCHIVEDIR=/var/lib/pgsql/archivedir  # archive log directory<br>
> POSTGRESQL_STARTUP_USER=postgres<br>
> SSH_KEY_FILE=id_rsa_pgpool<br>
> SSH_OPTIONS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i<br>
> ~/.ssh/${SSH_KEY_FILE}"<br>
> <br>
> # Force to flush current value of sequences to xlog<br>
> ${PGHOME}/bin/psql -p $PORT -t -c 'SELECT datname FROM pg_database WHERE<br>
> NOT datistemplate AND datallowconn' template1|<br>
> while read i<br>
> do<br>
>   if [ "$i" != "" ]; then<br>
>     psql -p $PORT -c "SELECT setval(oid, nextval(oid)) FROM pg_class WHERE<br>
> relkind = 'S'" $i<br>
>   fi<br>
> done<br>
> <br>
> psql -p $PORT -c "SELECT pgpool_switch_xlog('$ARCHIVEDIR')" template1<br>
> <br>
> # start target server as a streaming replication standby server<br>
> ssh -T ${SSH_OPTIONS} ${POSTGRESQL_STARTUP_USER}@$DEST_NODE_HOST "<br>
>         $PGHOME/bin/pg_ctl -l /dev/null -w -D $DEST_NODE_PGDATA promote<br>
> "<br>
> <br>
> On Fri, May 19, 2023 at 8:03 AM Bo Peng <<a href="mailto:pengbo@sraoss.co.jp" target="_blank">pengbo@sraoss.co.jp</a>> wrote:<br>
> <br>
> > Hi,<br>
> ><br>
> > You can find all the scripts here:<br>
> ><br>
> > <a href="https://git.postgresql.org/gitweb/?p=pgpool2.git;a=tree;f=src/sample/scripts;h=4cd73845f012972d73b24be77911288486bb6c08;hb=refs/heads/V4_4_STABLE" rel="noreferrer" target="_blank">https://git.postgresql.org/gitweb/?p=pgpool2.git;a=tree;f=src/sample/scripts;h=4cd73845f012972d73b24be77911288486bb6c08;hb=refs/heads/V4_4_STABLE</a><br>
> ><br>
> > The scripts:<br>
> >   replication_mode_recovery_1st_stage.sample<br>
> >   replication_mode_recovery_2nd_stage.sample<br>
> > are for isolation snapshot mode.<br>
> ><br>
> > The documetation is wrong and I will fix it.<br>
> ><br>
> > On Wed, 17 May 2023 16:31:24 +0800<br>
> > Zhaoxun Yan <<a href="mailto:yan.zhaoxun@gmail.com" target="_blank">yan.zhaoxun@gmail.com</a>> wrote:<br>
> ><br>
> > > Hi!<br>
> > > I cannot find the recovery_2nd_stage.sample from<br>
> > > <a href="https://www.pgpool.net/docs/44/en/html/runtime-online-recovery.html" rel="noreferrer" target="_blank">https://www.pgpool.net/docs/44/en/html/runtime-online-recovery.html</a>. Is<br>
> > > there such a file? What does it do when snap-shot mode?<br>
> > ><br>
> > > Thanks!<br>
> > > Zhaoxun<br>
> ><br>
> ><br>
> > --<br>
> > Bo Peng <<a href="mailto:pengbo@sraoss.co.jp" target="_blank">pengbo@sraoss.co.jp</a>><br>
> > SRA OSS LLC<br>
> > <a href="https://www.sraoss.co.jp/" rel="noreferrer" target="_blank">https://www.sraoss.co.jp/</a><br>
> ><br>
<br>
<br>
-- <br>
Bo Peng <<a href="mailto:pengbo@sraoss.co.jp" target="_blank">pengbo@sraoss.co.jp</a>><br>
SRA OSS LLC<br>
<a href="https://www.sraoss.co.jp/" rel="noreferrer" target="_blank">https://www.sraoss.co.jp/</a><br>
</blockquote></div>