Bug#736532: [postgres-xc] gtm proxy support in init script

2014-04-04 Thread Michael Meskes
On Thu, Apr 03, 2014 at 11:20:38AM -0400, Tim Sattarov wrote:
 can you send me output of
 sh -x postgres-xc start
 ?

Sure, attached.

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at gmail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL
+ set -e
+ PGXC_DATA=/var/lib/postgres-xc
+ PGXC_LOG=/var/log/postgres-xc
+ PGXC_RUN=/var/run/postgresql
+ . /lib/lsb/init-functions
+ run-parts --lsbsysinit --list /lib/lsb/init-functions.d
+ [ -r /lib/lsb/init-functions.d/20-left-info-blocks ]
+ . /lib/lsb/init-functions.d/20-left-info-blocks
+ FANCYTTY=
+ [ -e /etc/lsb-base-logging.sh ]
+ true
+ [ -r /etc/default/postgres-xc ]
+ . /etc/default/postgres-xc
+ FAST_STOP=true
+ [ -d /var/run/postgresql ]
+ chown postgres-xc.postgres-xc /var/run/postgresql
+ chmod 2775 /var/run/postgresql
+ do_ctl start Starting
+ ACTION=start
+ STATUS=0
+ status=0
+ [ start = stop ]
+ SEQUENCE=gtm gtm_proxy coordinator datanode
+ [ start = stop ]
+ PG_CTL=gtm_ctl
+ PG_START=gtm
+ EXTRA_OPTS=
+ log_daemon_msg Starting Postgres-XC gtm
+ [ -z Starting Postgres-XC gtm ]
+ log_daemon_msg_pre Starting Postgres-XC gtm
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ FANCYTTY=0
+ false
+ [ -z  ]
+ echo -n Starting Postgres-XC gtm:
Starting Postgres-XC gtm:+ return
+ ls /etc/postgres-xc/gtm/
+ [ -f /etc/postgres-xc/gtm/GTM/run ]
+ [ start = reload ]
+ [ start = reload ]
+ [ start = stop ]
+ [ 0 -eq 1 ]
+ [ gtm = gtm_proxy ]
+ [ gtm = gtm_proxy ]
+ start-stop-daemon -c postgres-xc -Sx /usr/bin/gtm_ctl -- start -D 
/var/lib/postgres-xc/GTM -Z gtm -l /var/log/postgres-xc/datanode.log
+ STATUS=0
+ true
+ [ 0 -gt 0 ]
+ ERRMSG=server starting
+ REPORT=GTM
+ [ start = status ]
+ log_progress_msg GTM
+ [ -z GTM ]
+ echo -n  GTM
 GTM+ [ 0 -eq 0 ]
+ [ start = start ]
+ check_if_running gtm GTM
+ status=0
+ pidfile=gtm.pid
+ sleep 2
+ [ -r /var/lib/postgres-xc/GTM/gtm.pid ]
+ head -n 1 /var/lib/postgres-xc/GTM/gtm.pid
+ PID=2433
+ [ -z 2433 ]
+ ps h -o comm -p 2433
+ [ gtm != gtm ]
+ return 0
+ STATUS=0
+ log_end_msg 0
+ [ -z 0 ]
+ local retval
+ retval=0
+ log_end_msg_pre 0
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ FANCYTTY=0
+ false
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ FANCYTTY=0
+ false
+ RED=
+ YELLOW=
+ NORMAL=
+ [ 0 -eq 0 ]
+ echo .
.
+ log_end_msg_post 0
+ :
+ return 0
+ PG_CTL=gtm_ctl
+ PG_START=gtm_proxy
+ EXTRA_OPTS=
+ log_daemon_msg Starting Postgres-XC gtm_proxy
+ [ -z Starting Postgres-XC gtm_proxy ]
+ log_daemon_msg_pre Starting Postgres-XC gtm_proxy
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ FANCYTTY=0
+ false
+ [ -z  ]
+ echo -n Starting Postgres-XC gtm_proxy:
Starting Postgres-XC gtm_proxy:+ return
+ ls /etc/postgres-xc/gtm_proxy/
+ [ -f /etc/postgres-xc/gtm_proxy/GTM_PROXY/run ]
+ [ start = reload ]
+ [ start = reload ]
+ [ start = stop ]
+ [ 0 -eq 1 ]
+ [ gtm_proxy = gtm_proxy ]
+ EXTRA_OPTS=-o -D /var/lib/postgres-xc/GTM_PROXY
+ [ gtm_proxy = gtm_proxy ]
+ start-stop-daemon -c postgres-xc -Sx /usr/bin/gtm_ctl -- start -D 
/var/lib/postgres-xc/GTM_PROXY -Z gtm_proxy -l 
/var/log/postgres-xc/datanode.log -o -D /var/lib/postgres-xc/GTM_PROXY
gtm_ctl: another server might be running; trying to start server anyway
+ STATUS=0
+ true
+ [ 0 -gt 0 ]
+ ERRMSG=server starting
+ REPORT=GTM_PROXY
+ [ start = status ]
+ log_progress_msg GTM_PROXY
+ [ -z GTM_PROXY ]
+ echo -n  GTM_PROXY
 GTM_PROXY+ [ 0 -eq 0 ]
+ [ start = start ]
+ check_if_running gtm_proxy GTM_PROXY
+ status=0
+ pidfile=gtm_proxy.pid
+ sleep 2
+ [ -r /var/lib/postgres-xc/GTM_PROXY/gtm_proxy.pid ]
+ head -n 1 /var/lib/postgres-xc/GTM_PROXY/gtm_proxy.pid
+ PID=2443
+ [ -z 2443 ]
+ ps h -o comm -p 2443
+ [  != gtm_proxy ]
+ status=1
+ return 0
+ STATUS=1
+ log_end_msg 1
+ [ -z 1 ]
+ local retval
+ retval=1
+ log_end_msg_pre 1
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ FANCYTTY=0
+ false
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ FANCYTTY=0
+ false
+ RED=
+ YELLOW=
+ NORMAL=
+ [ 1 -eq 0 ]
+ [ 1 -eq 255 ]
+ /bin/echo -e  failed!
 failed!
+ log_end_msg_post 1
+ :
+ return 1


Bug#736532: [postgres-xc] gtm proxy support in init script

2014-04-03 Thread Michael Meskes
On Fri, Jan 24, 2014 at 11:59:59AM -0500, Tim Sattarov wrote:
 Please find below my suggested patch for init script to handle that
 additional component of postgres-xc:

Thanks for the patch, but please for the next time, do not inline it like this. 
There a linebreaks in there which makes it unapplicable.

 --- /etc/init.d/postgres-xc 2013-08-20 07:29:54.0 -0400
 +++ ./postgres-xc   2014-01-24 11:37:20.185485456 -0500

Also, please always send patches against the source files, not the installed 
version. They may be different.

 @@ -40,7 +44,7 @@
  postgres)
  pidfile=postmaster.pid
  confport=$(grep -si '^port *=' $PGXC_DATA/$2/postgresql.conf |
 -   cut -f2 -d= | sed -e 's/#.*$//' -e 's/ //g')
 +cut -f2 -d= | sed -e 's/#.*$//' -e 's/ //g')
  port=${confport:=5432}
 
  # wait for server to come up, but no more than 10 seconds

What is changed here? Only a blank?

Patch will be in the next release.

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at gmail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#736532: [postgres-xc] gtm proxy support in init script

2014-04-03 Thread Michael Meskes
 Please find below my suggested patch for init script to handle that
 additional component of postgres-xc:

I just noticed that this patch does not work. For instance it seems to need
another directory under /etc/postgres-xc that is never created. Do you have a
working version? Or did you never try it our yourself?

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at gmail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#736532: [postgres-xc] gtm proxy support in init script

2014-04-03 Thread Tim Sattarov
Hi Michael,

my apologies for incorrectly reported bug with patch.
This patch needs directory   /etc/postgres-xc/gtm_proxy created as well.
I used this init script in my Lab installation of postgres-xc it seems to
be working for me.

I also noticed that there is no need in EXTRA_OPTS variable.

Please let me know if you need properly formed patch against source package
I will send it to you.

Regards
Tim


On Thu, Apr 3, 2014 at 8:14 AM, Michael Meskes mes...@debian.org wrote:

  Please find below my suggested patch for init script to handle that
  additional component of postgres-xc:

 I just noticed that this patch does not work. For instance it seems to need
 another directory under /etc/postgres-xc that is never created. Do you
 have a
 working version? Or did you never try it our yourself?

 Michael
 --
 Michael Meskes
 Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
 Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
 Jabber: michael.meskes at gmail dot com
 VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL



Bug#736532: [postgres-xc] gtm proxy support in init script

2014-04-03 Thread Tim Sattarov
working version of the script is attached



On Thu, Apr 3, 2014 at 8:26 AM, Tim Sattarov sti...@gmail.com wrote:

 Hi Michael,

 my apologies for incorrectly reported bug with patch.
 This patch needs directory   /etc/postgres-xc/gtm_proxy created as well.
 I used this init script in my Lab installation of postgres-xc it seems to
 be working for me.

 I also noticed that there is no need in EXTRA_OPTS variable.

 Please let me know if you need properly formed patch against source
 package I will send it to you.

  Regards
 Tim


 On Thu, Apr 3, 2014 at 8:14 AM, Michael Meskes mes...@debian.org wrote:

  Please find below my suggested patch for init script to handle that
  additional component of postgres-xc:

 I just noticed that this patch does not work. For instance it seems to
 need
 another directory under /etc/postgres-xc that is never created. Do you
 have a
 working version? Or did you never try it our yourself?

 Michael
 --
 Michael Meskes
 Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
 Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
 Jabber: michael.meskes at gmail dot com
 VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL





postgres-xc.gz
Description: GNU Zip compressed data


Bug#736532: [postgres-xc] gtm proxy support in init script

2014-04-03 Thread Michael Meskes
On Thu, Apr 03, 2014 at 08:28:28AM -0400, Tim Sattarov wrote:
 working version of the script is attached

Doesn't seem to work for me. I only get fails when starting gtm_proxy.

What could I be missing?

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at gmail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#736532: [postgres-xc] gtm proxy support in init script

2014-04-03 Thread Michael Meskes
On Thu, Apr 03, 2014 at 08:26:51AM -0400, Tim Sattarov wrote:
 This patch needs directory   /etc/postgres-xc/gtm_proxy created as well.

And populated I guess.

 Please let me know if you need properly formed patch against source package
 I will send it to you.

No, no need for the patch, but maybe you could send me your
/etc/postgres-xc/gtm_proxy directory to go along with the script.

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at gmail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#736532: [postgres-xc] gtm proxy support in init script

2014-04-03 Thread Tim Sattarov
can you send me output of
sh -x postgres-xc start
?
 On Apr 3, 2014 11:18 AM, Michael Meskes mes...@debian.org wrote:

 On Thu, Apr 03, 2014 at 08:28:28AM -0400, Tim Sattarov wrote:
  working version of the script is attached

 Doesn't seem to work for me. I only get fails when starting gtm_proxy.

 What could I be missing?

 Michael
 --
 Michael Meskes
 Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
 Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
 Jabber: michael.meskes at gmail dot com
 VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL



Bug#736532: [postgres-xc] gtm proxy support in init script

2014-04-03 Thread Tim Sattarov
On Thu, Apr 3, 2014 at 11:26 AM, Tim Sattarov sti...@gmail.com wrote:


 Attached /etc/postgres-xc/gtm_proxy archive


Actually you would want to have all postgres-xc config for that to be tested

attached as well


 Thanks
 Tim



postgres-xc.tar.bz2
Description: BZip2 compressed data


Bug#736532: [postgres-xc] gtm proxy support in init script

2014-04-03 Thread Tim Sattarov
On Thu, Apr 3, 2014 at 11:20 AM, Michael Meskes mes...@debian.org wrote:


 No, no need for the patch, but maybe you could send me your
 /etc/postgres-xc/gtm_proxy directory to go along with the script.


Attached /etc/postgres-xc/gtm_proxy archive

Thanks
Tim


gtm_proxy.tar.bz2
Description: BZip2 compressed data


Bug#736532: [postgres-xc] gtm proxy support in init script

2014-01-24 Thread Tim Sattarov
Package: postgres-xc
Version: 1.1-2
Severity: normal
Tags: patch

--- Please enter the report below this line. ---

Hello,

Original init script included into the package does not support gtm proxy.

Please find below my suggested patch for init script to handle that
additional component of postgres-xc:


--- /etc/init.d/postgres-xc 2013-08-20 07:29:54.0 -0400
+++ ./postgres-xc   2014-01-24 11:37:20.185485456 -0500
@@ -33,6 +33,10 @@
 {
 status=0
 case $1 in
+gtm_proxy)
+pidfile=gtm_proxy.pid
+sleep 2
+;;
 gtm)
 pidfile=gtm.pid
 sleep 2
@@ -40,7 +44,7 @@
 postgres)
 pidfile=postmaster.pid
 confport=$(grep -si '^port *=' $PGXC_DATA/$2/postgresql.conf |
-   cut -f2 -d= | sed -e 's/#.*$//' -e 's/ //g')
+cut -f2 -d= | sed -e 's/#.*$//' -e 's/ //g')
 port=${confport:=5432}

 # wait for server to come up, but no more than 10 seconds
@@ -63,6 +67,7 @@
 [ `ps h -o comm -p $PID` != $1 ]  status=1
 fi
 else
+#   echo $PGXC_DATA/$2/$pidfile is not readable
 status=1
 fi
 return 0
@@ -77,15 +82,24 @@
 $FAST_STOP 
 STOP_MODE=-mf
 }
-for TYPE in datanode coordinator gtm; do
+SEQUENCE=gtm gtm_proxy coordinator datanode
+[ $ACTION = stop ]  SEQUENCE=datanode coordinator gtm_proxy gtm
+for TYPE in $SEQUENCE; do
 case $TYPE in
 gtm)
 PG_CTL=gtm_ctl
 PG_START=gtm
+EXTRA_OPTS=''
+;;
+gtm_proxy)
+PG_CTL=gtm_ctl
+PG_START=gtm_proxy
+EXTRA_OPTS=''
 ;;
 coordinator|datanode)
 PG_CTL=pg_ctl
 PG_START=postgres
+EXTRA_OPTS=''
 ;;
 esac
 log_daemon_msg $2 Postgres-XC ${TYPE}
@@ -94,24 +108,37 @@
 if [ $ACTION = reload ]  [ $TYPE = gtm ]; then
 ACTION=restart
 fi
+if [ $ACTION = reload ]  [ $TYPE = gtm_proxy ];
then
+ACTION=restart
+fi
 [ $ACTION = stop ] 
 check_if_running $PG_START $NODE stop
 if [ $status -eq 1 ]; then
 log_progress_msg $NODE is not running
 else
-ERRMSG=$(start-stop-daemon -c postgres-xc \
-   -Sx /usr/bin/$PG_CTL  -- $ACTION $STOP_MODE
\
-   -D $PGXC_DATA/$NODE -Z $TYPE \
-   -l $PGXC_LOG/datanode.log
-   STATUS=$?
-   if $FAST_STOP  [ $STATUS -gt 0 ] 
-   [ $ACTION = stop ]; then
-   STATUS=0
-   start-stop-daemon -c postgres-xc \
-   -Sx /usr/bin/$PG_CTL  -- stop -mi \
-   -D $PGXC_DATA/$NODE -Z $TYPE \
-   -l $PGXC_LOG/datanode.log ||
STATUS=$?
-   fi)
+if [ $TYPE = gtm_proxy ] ; then EXTRA_OPTS=-o -D
$PGXC_DATA/$NODE; fi
+ERRMSG=$(if [ $TYPE = gtm_proxy ] ; then {
+start-stop-daemon -c postgres-xc \
+-Sx /usr/bin/$PG_CTL  -- $ACTION
$STOP_MODE \
+-D $PGXC_DATA/$NODE -Z $TYPE \
+-l $PGXC_LOG/datanode.log -o -D
$PGXC_DATA/$NODE
+}
+else {
+start-stop-daemon -c postgres-xc \
+-Sx /usr/bin/$PG_CTL  -- $ACTION
$STOP_MODE \
+-D $PGXC_DATA/$NODE -Z $TYPE \
+-l $PGXC_LOG/datanode.log
+}
+fi
+STATUS=$?
+if $FAST_STOP  [ $STATUS -gt 0 ] 
+[ $ACTION = stop ]; then
+STATUS=0
+start-stop-daemon -c postgres-xc \
+-Sx /usr/bin/$PG_CTL  -- stop -mi \
+-D $PGXC_DATA/$NODE -Z $TYPE \
+-l $PGXC_LOG/datanode.log ||
STATUS=$?
+fi)
 REPORT=$NODE
 [ $ACTION = status ]  REPORT=$ERRMSG
 log_progress_msg $REPORT
@@ -153,4 +180,3 @@
 esac

 exit 0
-


Thanks
Tim

--- System information. ---
Architecture: amd64
Kernel:   Linux 3.11-2-amd64

Debian Release: jessie%2Fsid
  800 unstablehttp.us.debian.org
  800 unstabledeb-multimedia.org
  500