Hi, Serge and Dejan

Thank you for being interested in my patches.

I remade the patch that based on the latest Linux-HA-Dev.
(http://hg.linux-ha.org/dev/rev/f9f9567ee692)

Best regards,
NAKAHIRA Kazutomo

Serge Dubrouski wrote:
Here is the one with applied patch.

On Mon, Jun 22, 2009 at 3:54 PM, Dejan Muhamedagic<[email protected]> wrote:
Hi Serge,

On Mon, Jun 22, 2009 at 02:04:30PM -0600, Serge Dubrouski wrote:
Dejan -

Please try this one.
No luck:

[0]rondo:work > patch -p0 --dry-run < /tmp/pgsql.patch
patching file resources/OCF/pgsql
Hunk #1 FAILED at 194.
Hunk #3 FAILED at 253.
Hunk #4 succeeded at 297 with fuzz 1.
Hunk #5 FAILED at 308.
3 out of 5 hunks FAILED -- saving rejects to file resources/OCF/pgsql.rej

If you're absolutely sure that your copy of pgsql is good, post
it and we'll see how does it differ from the current version in
the hg repository.

Thanks,

Dejan

On Mon, Jun 22, 2009 at 1:54 PM, Serge Dubrouski<[email protected]> wrote:
heartbeat-resources-2.99.2-8.1.i386

And this is the right one. I used it to create that patch and just
applied my patch against it without any problems:

[r...@fc-node1 pgsql]# patch resources/OCF/pgsql pgsql.patch
patching file resources/OCF/pgsql
[r...@fc-node1 pgsql]#

But the one that I see here:
http://hg.clusterlabs.org/pacemaker/stable-1.0/file/e5c2b1d937ac/resources/OCF/pgsql
is the wrong one.

On Mon, Jun 22, 2009 at 1:36 PM, Dejan Muhamedagic<[email protected]> wrote:
Hi Serge,

On Mon, Jun 22, 2009 at 01:04:23PM -0600, Serge Dubrouski wrote:
Dejan -

Something is wrong with your repository. The patch is against the file
that comes with heartbeat-resources package and that file is
absolutely different from what you have in the repository. The file in
repository looks incorrect.
Just checked and what I have in my repository equals this:

http://hg.linux-ha.org/dev/raw-file/tip/resources/OCF/pgsql

Hmm, odd indeed. Which heartbeat-resources package do you have?

Thanks,

Dejan

On Mon, Jun 22, 2009 at 12:33 PM, Dejan Muhamedagic<[email protected]> wrote:
Hi Serge,

On Mon, Jun 22, 2009 at 12:24:44PM -0600, Serge Dubrouski wrote:
And here is the patch.
Looks like you were using a different version than what we have
in the hg repository:

[0]rondo:work > patch -p0 --dry-run < /tmp/pgsql.patch
patching file resources/OCF/pgsql
Hunk #1 FAILED at 194.
Hunk #3 FAILED at 253.
Hunk #4 succeeded at 297 with fuzz 1.
Hunk #5 FAILED at 308.
3 out of 5 hunks FAILED -- saving rejects to file resources/OCF/pgsql.rej

Or maybe I missed some patch. What I have as the last changeset
is this:

changeset: ? 11977:1cbc4c8c571f
user: ? ? ? ?Serge
date: ? ? ? ?Thu Jun 26 01:51:05 2008 +0200
summary: ? ? Low: pgsql RA: check for the non-supported action

Can you please see what's up.

Thanks,

Dejan

On Mon, Jun 22, 2009 at 12:00 PM, Serge Dubrouski <[email protected]>wrote:

All these patches are OK with one exception. Construction $(command) isn't
supported by native Bourne shell so I'd propose changing it to `command`.
Attached is a patch that combines all 3 patches and fixes that
incompatibility issue.

Thanks for the patches.

2009/6/18 NAKAHIRA Kazutomo <[email protected]>

Hello,

The pgsql RA includes the several confusing logs as follows
and I propose 3 patches to solve these problems.

1. When it takes time to start PostgreSQL, the "ERROR" level log
? "PostgreSQL $OCF_RESKEY_pgdb isn't running" is output
? though the start of pgsql RA has succeeded.
? It seems that "WARN" level is more appropriate than "ERROR".

pgsql-ra-logging-1.patch is a patch that corrects No.1 problem.

2. In the start confirmation processing of pgsql RA, An unnecessary
? "sleep 1" is executed though the start of PostgreSQL is confirmed
? with pgsql_monitor().
3. In the stop processing of pgsql RA, An unnecessary log message
? "PostgreSQL still hasn't stopped yet. Waiting..." is output to
? the ha-debug though PostgreSQL has been stopped.

pgsql-ra-logging-2.patch is a patch that corrects No.2 and 3 problem.

4. When failing in the execution of the psql command and
? the pg_ctl command, the execution result of the command is not
? recorded in the log file.

pgsql-ra-logging-3.patch is a patch that corrects No.4 problem.

Best regards,
NAKAHIRA Kazutomo

--
----------------------------------------
NAKAHIRA Kazutomo
NTT DATA INTELLILINK CORPORATION
Open Source Business Unit
Software Services Integration Business Division

_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/



--
Serge Dubrouski.



--
Serge Dubrouski.

_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/



--
Serge Dubrouski.
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/



--
Serge Dubrouski.



--
Serge Dubrouski.

_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/





------------------------------------------------------------------------

_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


--
----------------------------------------
NAKAHIRA Kazutomo
NTT DATA INTELLILINK CORPORATION
Open Source Business Unit
Software Services Integration Business Division
# HG changeset patch
# User r...@prec370b
# Date 1245733638 -32400
# Node ID f48ca25b3dea3503970415ac3bc95eba2f876911
# Parent  f9f9567ee6923f40f71ff99b25b388c072159021
Improvement of log of pgsql RA

diff -r f9f9567ee692 -r f48ca25b3dea resources/OCF/pgsql
--- a/resources/OCF/pgsql	Tue Jun 23 12:46:41 2009 +1000
+++ b/resources/OCF/pgsql	Tue Jun 23 14:07:18 2009 +0900
@@ -194,25 +194,33 @@ pgsql_start() {
 	    return $OCF_ERR_GENERIC
 	fi
 
-	if runasowner "$OCF_RESKEY_pgctl $OCF_RESKEY_ctl_opt -D $OCF_RESKEY_pgdata -l $OCF_RESKEY_logfile -o "\'$OCF_RESKEY_start_opt\'" start > /dev/null 2>&1"
+	output=`runasowner "$OCF_RESKEY_pgctl $OCF_RESKEY_ctl_opt -D $OCF_RESKEY_pgdata -l $OCF_RESKEY_logfile -o "\'$OCF_RESKEY_start_opt\'" start" 2>&1`
+
+	if [ $? -eq 0 ]
 	then
 	   # Probably started.....
             ocf_log info "PostgreSQL start command sent."
 	else
-	    ocf_log err "Can't start PostgreSQL."; return $OCF_ERR_GENERIC
+	    ocf_log err "Can't start PostgreSQL."
+            echo "$output"
+            return $OCF_ERR_GENERIC
 	fi
     else
 	ocf_log err "$OCF_RESKEY_pgctl not found!"
 	return $OCF_ERR_GENERIC
     fi
 
-    rc=$OCF_ERR_GENERIC
-    while [ $rc -ne 0 ]; do
-        pgsql_monitor
-        rc=$? 
+    while :
+    do
+        pgsql_monitor warn
+        rc=$?
+        if [ $rc -eq 0 ]; then
+            break;
+        fi 
         sleep 1
 	ocf_log debug "PostgreSQL still hasn't started yet. Waiting..."
     done
+    ocf_log info "PostgreSQL is started."
 
     return $OCF_SUCCESS
 }
@@ -224,9 +232,9 @@ pgsql_stop() {
         #Already stopped
         return $OCF_SUCCESS
     fi
-    
+
     # Stop PostgreSQL do not wait for clients to disconnect
-    runasowner "$OCF_RESKEY_pgctl -D $OCF_RESKEY_pgdata stop -m fast > /dev/null 2>&1"
+    output=`runasowner "$OCF_RESKEY_pgctl -D $OCF_RESKEY_pgdata stop -m fast" 2>&1`
 
     # stop waiting
     count=0
@@ -245,13 +253,19 @@ pgsql_stop() {
     then
        #PostgreSQL is still up. Use another shutdown mode.
        ocf_log info "PostgreSQL failed to stop after ${OCF_RESKEY_stop_escalate}s using -m fast. Trying -m immediate..."
-       runasowner "$OCF_RESKEY_pgctl -D $OCF_RESKEY_pgdata stop -m immediate > /dev/null 2>&1"
-    fi
-
-    rc=$OCF_ERR_GENERIC
-    while [ $rc != $OCF_NOT_RUNNING ]; do
+       echo "$output"
+       output=`runasowner "$OCF_RESKEY_pgctl -D $OCF_RESKEY_pgdata stop -m immediate" 2>&1`
+       echo "$output"
+    fi
+
+    while :
+    do
         pgsql_monitor
-        rc=$? 
+        rc=$?
+        if [ $rc -eq $OCF_NOT_RUNNING ]; then
+            # An unnecessary debug log is prevented.
+            break;
+        fi 
 	sleep 1
 	ocf_log debug "PostgreSQL still hasn't stopped yet. Waiting..."
     done
@@ -283,6 +297,9 @@ pgsql_status() {
 #
 
 pgsql_monitor() {
+    # Set the log level of the error message
+    loglevel=${1:-err}
+
     if ! pgsql_status
     then
 	ocf_log info "PostgreSQL is down"
@@ -291,14 +308,26 @@ pgsql_monitor() {
 
     if [ "x" = "x$OCF_RESKEY_pghost" ]
     then
-       runasowner "$OCF_RESKEY_psql -p $OCF_RESKEY_pgport -U $OCF_RESKEY_pgdba $OCF_RESKEY_pgdb -c 'select now();' >/dev/null 2>&1"
+       output=`runasowner "$OCF_RESKEY_psql -p $OCF_RESKEY_pgport -U $OCF_RESKEY_pgdba $OCF_RESKEY_pgdb -c 'select now();'" 2>&1`
     else
-       runasowner "$OCF_RESKEY_psql -h $OCF_RESKEY_pghost -p $OCF_RESKEY_pgport -U $OCF_RESKEY_pgdba $OCF_RESKEY_pgdb -c 'select now();' >/dev/null 2>&1"
+       output=`runasowner "$OCF_RESKEY_psql -h $OCF_RESKEY_pghost -p $OCF_RESKEY_pgport -U $OCF_RESKEY_pgdba $OCF_RESKEY_pgdb -c 'select now();'" 2>&1`
     fi
     
-    if [ $? -ne  0 ]
-    then
-	ocf_log err "PostgreSQL $OCF_RESKEY_pgdb isn't running"
+    rc=$?
+    if [ $rc -ne  0 ]
+    then
+	ocf_log $loglevel "PostgreSQL $OCF_RESKEY_pgdb isn't running"
+        if [ $rc -eq 1 ]
+        then
+            ocf_log err "Fatal error(out of memory or file not found, etc.) occurred while executing the psql command."
+        elif [ $rc -eq 2 ]
+        then
+            ocf_log $loglevel "Connection error(connection to the server went bad and the session was not interactive) occurred while executing the psql command."
+        elif [ $rc -eq 3 ]
+        then
+            ocf_log err "Script error(the variable ON_ERROR_STOP was set) occurred while executing the psql command."
+        fi
+        echo "$output"
 	return $OCF_ERR_GENERIC
     fi
     
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to