Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux-HA: Dev

[PATCH] add log_level and keepalive to mysql-proxy ra

 

 

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded


r.bhatia at ipax

Sep 3, 2009, 2:04 AM

Post #1 of 8 (1542 views)
Permalink
[PATCH] add log_level and keepalive to mysql-proxy ra

hi,

i today added log_level and keepalive options to the mysql-proxy ra:

log_level (error|warning|info|message|debug|)
Log all messages of level (error|warning|info|message|debug|) or
higer. An empty value disables logging.

keepalive (true|false|):
Try to restart the proxy if it crashed (default: ).

please commit this patch after my previous patches.

cheers,
raoul
--
____________________________________________________________________
DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
Technischer Leiter

IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
Barawitzkagasse 10/2/2/11 email. office [at] ipax
1190 Wien tel. +43 1 3670030
FN 277995t HG Wien fax. +43 1 3670030 15
____________________________________________________________________
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


r.bhatia at ipax

Sep 3, 2009, 2:09 AM

Post #2 of 8 (1468 views)
Permalink
Re: [PATCH] add log_level and keepalive to mysql-proxy ra [In reply to]

On 09/03/2009 11:04 AM, Raoul Bhatia [IPAX] wrote:
> hi,
>
> i today added log_level and keepalive options to the mysql-proxy ra:
>
> log_level (error|warning|info|message|debug|)
> Log all messages of level (error|warning|info|message|debug|) or
> higer. An empty value disables logging.
>
> keepalive (true|false|):
> Try to restart the proxy if it crashed (default: ).
>
> please commit this patch after my previous patches.
>
> cheers,
> raoul

missing attachment.

cheers,
raoul
--
____________________________________________________________________
DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
Technischer Leiter

IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
Barawitzkagasse 10/2/2/11 email. office [at] ipax
1190 Wien tel. +43 1 3670030
FN 277995t HG Wien fax. +43 1 3670030 15
____________________________________________________________________
Attachments: mysql-proxy_loglevel_keepalive.patch (4.21 KB)


r.bhatia at ipax

Sep 3, 2009, 2:21 AM

Post #3 of 8 (1479 views)
Permalink
Re: [PATCH] add log_level and keepalive to mysql-proxy ra [In reply to]

On 09/03/2009 11:09 AM, Raoul Bhatia [IPAX] wrote:
> On 09/03/2009 11:04 AM, Raoul Bhatia [IPAX] wrote:
>> hi,
>>
>> i today added log_level and keepalive options to the mysql-proxy ra:
>>
>> log_level (error|warning|info|message|debug|)
>> Log all messages of level (error|warning|info|message|debug|) or
>> higer. An empty value disables logging.
>>
>> keepalive (true|false|):
>> Try to restart the proxy if it crashed (default: ).
>>
>> please commit this patch after my previous patches.

i spotted a minor mistake in mysql-proxy_loglevel_keepalive.patch.
of course, "[ "$keepalive" -eq "true" ]" will not work as expected.

please find the corrected patch enclosed.

cheers,
raoul
--
____________________________________________________________________
DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
Technischer Leiter

IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
Barawitzkagasse 10/2/2/11 email. office [at] ipax
1190 Wien tel. +43 1 3670030
FN 277995t HG Wien fax. +43 1 3670030 15
____________________________________________________________________
Attachments: mysql-proxy_loglevel_keepalive.patch (4.21 KB)


florian.haas at linbit

Sep 3, 2009, 2:26 AM

Post #4 of 8 (1460 views)
Permalink
Re: [PATCH] add log_level and keepalive to mysql-proxy ra [In reply to]

On 2009-09-03 11:04, Raoul Bhatia [IPAX] wrote:
> hi,
>
> i today added log_level and keepalive options to the mysql-proxy ra:
>
> log_level (error|warning|info|message|debug|)
> Log all messages of level (error|warning|info|message|debug|) or
> higer. An empty value disables logging.
>
> keepalive (true|false|):
> Try to restart the proxy if it crashed (default: ).
>
> please commit this patch after my previous patches.

Why not simply report $OCF_NOT_RUNNING on monitor, and let the CRM
handle the restart? That way you'll actually have the CRM keep tabs on
failures via failcount, and give it the possibility to react.

Florian
Attachments: signature.asc (0.25 KB)


r.bhatia at ipax

Sep 3, 2009, 3:04 AM

Post #5 of 8 (1468 views)
Permalink
Re: [PATCH] add log_level and keepalive to mysql-proxy ra [In reply to]

On 09/03/2009 11:26 AM, Florian Haas wrote:
> Why not simply report $OCF_NOT_RUNNING on monitor, and let the CRM
> handle the restart? That way you'll actually have the CRM keep tabs on
> failures via failcount, and give it the possibility to react.

i came across some mysql-proxy hangs that the mysql-proxy ra in its
current, commited state, was unable to catch.

currently, the ra is not doing any in-depth monitoring and i figured
that mysql-proxy might have better methods to check its own vitality.

moreover, i think it is ok to expose useful options (see above) to
the user.


regarding the monitoring action:
future enhancements might be to issue a query using something similar
to the mysql ra's check (think test_user, test_table, etc.)

another thought i have got is to add a check via the mysql proxy admin
module, but currently, there is no admin.lua script shipped with the
debian package so i'm still considering what to do in this case.


so to sum things up, i do not think it is a bad idea to let the user
choose, if he wants to use the proxy's keepalive. nobody is forced to
do so and this option defaults to "false" anyways.

cheers,
raoul
--
____________________________________________________________________
DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
Technischer Leiter

IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
Barawitzkagasse 10/2/2/11 email. office [at] ipax
1190 Wien tel. +43 1 3670030
FN 277995t HG Wien fax. +43 1 3670030 15
____________________________________________________________________
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


dejanmm at fastmail

Sep 8, 2009, 4:03 AM

Post #6 of 8 (1392 views)
Permalink
Re: [PATCH] add log_level and keepalive to mysql-proxy ra [In reply to]

Hi Raoul,

On Thu, Sep 03, 2009 at 11:21:59AM +0200, Raoul Bhatia [IPAX] wrote:
> On 09/03/2009 11:09 AM, Raoul Bhatia [IPAX] wrote:
> > On 09/03/2009 11:04 AM, Raoul Bhatia [IPAX] wrote:
> >> hi,
> >>
> >> i today added log_level and keepalive options to the mysql-proxy ra:
> >>
> >> log_level (error|warning|info|message|debug|)
> >> Log all messages of level (error|warning|info|message|debug|) or
> >> higer. An empty value disables logging.
> >>
> >> keepalive (true|false|):
> >> Try to restart the proxy if it crashed (default: ).
> >>
> >> please commit this patch after my previous patches.
>
> i spotted a minor mistake in mysql-proxy_loglevel_keepalive.patch.
> of course, "[ "$keepalive" -eq "true" ]" will not work as expected.
>
> please find the corrected patch enclosed.

Many thanks for the patch.

I fixed one return code (OCF_ERR_CONFIGURED) on check for valid
log_level. And the regular expression test for the same parameter.

Also, log_level set to empty cannot be distinguished from
log_level not set at all using grep(1) or test(1). You either
have to find another way or change the usage. That is, unless
setting --log-level="" is equal to not specifying the --log-level
option at all in which case this won't result in a regression.

Cheers,

Dejan

> cheers,
> raoul
> --
> ____________________________________________________________________
> DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
> Technischer Leiter
>
> IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
> Barawitzkagasse 10/2/2/11 email. office [at] ipax
> 1190 Wien tel. +43 1 3670030
> FN 277995t HG Wien fax. +43 1 3670030 15
> ____________________________________________________________________

> Index: mysql-proxy
> ===================================================================
> --- mysql-proxy (revision 900)
> +++ mysql-proxy (working copy)
> @@ -37,6 +37,8 @@
> # OCF_RESKEY_proxy_backend_addresses
> # OCF_RESKEY_proxy_read_only_backend_addresses
> # OCF_RESKEY_proxy_address
> +# OCF_RESKEY_log_level
> +# OCF_RESKEY_keepalive
> # OCF_RESKEY_admin_address
> # OCF_RESKEY_admin_username
> # OCF_RESKEY_admin_password
> @@ -55,6 +57,8 @@
> : ${OCF_RESKEY_proxy_backend_addresses="127.0.0.1:3306"}
> : ${OCF_RESKEY_proxy_read_only_backend_addresses=""}
> : ${OCF_RESKEY_proxy_address=":4040"}
> +: ${OCF_RESKEY_log_level=""}
> +: ${OCF_RESKEY_keepalive=""}
> : ${OCF_RESKEY_admin_address="127.0.0.1:4041"}
> : ${OCF_RESKEY_admin_username=""}
> : ${OCF_RESKEY_admin_password=""}
> @@ -126,6 +130,24 @@
> <content type="string" default=":4040" />
> </parameter>
>
> +<parameter name="log_level" unique="0" required="0">
> +<longdesc lang="en">
> +Log all messages of level (error|warning|info|message|debug|) or higer.
> +An empty value disables logging.
> +</longdesc>
> +<shortdesc lang="en"></shortdesc>
> +<content type="string" default="" />
> +</parameter>
> +
> +<parameter name="keepalive" unique="0" required="0">
> +<longdesc lang="en">
> +Try to restart the proxy if it crashed (default: ).
> +Valid values: true or false. An empty value equals "false".
> +</longdesc>
> +<shortdesc lang="en"></shortdesc>
> +<content type="string" default="" />
> +</parameter>
> +
> <parameter name="admin_address" unique="0" required="0">
> <longdesc lang="en">
> Listening address:port of the admin-server (default: 127.0.0.1:4041).
> @@ -200,6 +222,7 @@
> PID=`head -n 1 "${pidfile}"`
> if [ ! -z "$PID" ] ; then
> isRunning "$PID"
> + # @TODO in-depth check: issue a query and/or check proxy-admin interface
> return $?
> fi
> fi
> @@ -216,12 +239,22 @@
> return $OCF_SUCCESS
> fi
>
> + PARAM_PREFIX=''
> # check if the MySQL Proxy defaults-file exist
> - PARAM_PREFIX=''
> if [ -f "$defaults_file" ]; then
> PARAM_PREFIX="--defaults-file=$defaults_file "
> fi
>
> + # set log-level
> + if [ ! -z "$log_level" ]; then
> + PARAM_PREFIX="$PARAM_PREFIX --log-level=$log_level "
> + fi
> +
> + # set keepalive
> + if [ "$keepalive" = "true" ]; then
> + PARAM_PREFIX="$PARAM_PREFIX --keepalive "
> + fi
> +
> # honor admin_* options
> if [ ! -z "$admin_username" ]; then
> PARAM_PREFIX="$PARAM_PREFIX --admin-username=$admin_username "
> @@ -325,14 +358,19 @@
>
> mysqlproxy_validate_all()
> {
> - # @TODO
> -
> # check that the MySQL Proxy binary exists and can be executed
> if [ ! -x "$binary" ]; then
> ocf_log err "MySQL Proxy binary '$binary' does not exist or cannot be executed."
> return $OCF_ERR_GENERIC
> fi
>
> + # check for valid log-level
> + ll_check=`echo "$log_level" | egrep -v "^(error|warning|info|message|debug|)$"`
> + if [ ! -z "$ll_check" ]; then
> + ocf_log err "MySQL Proxy log level '$log_level' not in valid range '^(error|warning|info|message|debug|)$'"
> + return $OCF_ERR_GENERIC
> + fi
> +
> return $OCF_SUCCESS
> }
>
> @@ -355,6 +393,8 @@
> admin_password=$OCF_RESKEY_admin_password
> admin_lua_script=$OCF_RESKEY_admin_lua_script
> proxy_address=$OCF_RESKEY_proxy_address
> +log_level=$OCF_RESKEY_log_level
> +keepalive=$OCF_RESKEY_keepalive
>
> # debugging stuff
> #echo OCF_RESKEY_binary=$OCF_RESKEY_binary >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE
> @@ -362,6 +402,8 @@
> #echo OCF_RESKEY_proxy_backend_addresses=$OCF_RESKEY_proxy_backend_addresses >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE
> #echo OCF_RESKEY_proxy_read_only_backend_addresses=$OCF_RESKEY_proxy_read_only_backend_addresses >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE
> #echo OCF_RESKEY_proxy_address=$OCF_RESKEY_proxy_address >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE
> +#echo OCF_RESKEY_log_level=$OCF_RESKEY_log_level >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE
> +#echo OCF_RESKEY_keepalive=$OCF_RESKEY_keepalive >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE
> #echo OCF_RESKEY_admin_address=$OCF_RESKEY_admin_address >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE
> #echo OCF_RESKEY_admin_username=$OCF_RESKEY_admin_username >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE
> #echo OCF_RESKEY_admin_password=$OCF_RESKEY_admin_password >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE

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

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


r.bhatia at ipax

Sep 8, 2009, 5:50 AM

Post #7 of 8 (1395 views)
Permalink
Re: [PATCH] add log_level and keepalive to mysql-proxy ra [In reply to]

On 09/08/2009 01:03 PM, Dejan Muhamedagic wrote:
> log_level. And the regular expression test for the same parameter.
>
> Also, log_level set to empty cannot be distinguished from
> log_level not set at all using grep(1) or test(1). You either
> have to find another way or change the usage. That is, unless
> setting --log-level="" is equal to not specifying the --log-level
> option at all in which case this won't result in a regression.

i first test for "^(error|warning|info|message|debug)$" which means
that loglevel="" passes this test. it is ok to specify no log-level.

before starting i check:
> # set log-level
> if [ ! -z "$log_level" ]; then
> PARAM_PREFIX="$PARAM_PREFIX --log-level=$log_level "
> fi

which should handle this an empty loglevel, right?

thanks,
raoul
--
____________________________________________________________________
DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
Technischer Leiter

IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
Barawitzkagasse 10/2/2/11 email. office [at] ipax
1190 Wien tel. +43 1 3670030
FN 277995t HG Wien fax. +43 1 3670030 15
____________________________________________________________________
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


dejanmm at fastmail

Sep 8, 2009, 8:41 AM

Post #8 of 8 (1383 views)
Permalink
Re: [PATCH] add log_level and keepalive to mysql-proxy ra [In reply to]

Hi,

On Tue, Sep 08, 2009 at 02:50:09PM +0200, Raoul Bhatia [IPAX] wrote:
> On 09/08/2009 01:03 PM, Dejan Muhamedagic wrote:
> > log_level. And the regular expression test for the same parameter.
> >
> > Also, log_level set to empty cannot be distinguished from
> > log_level not set at all using grep(1) or test(1). You either
> > have to find another way or change the usage. That is, unless
> > setting --log-level="" is equal to not specifying the --log-level
> > option at all in which case this won't result in a regression.
>
> i first test for "^(error|warning|info|message|debug)$" which means

It's actually "^(error|warning|info|message|debug|)$"

> that loglevel="" passes this test. it is ok to specify no log-level.

Right.

> before starting i check:
> > # set log-level
> > if [ ! -z "$log_level" ]; then
> > PARAM_PREFIX="$PARAM_PREFIX --log-level=$log_level "
> > fi
>
> which should handle this an empty loglevel, right?

Yes, but I thought that you wanted to append --log-level="",
right? Or is that the same as leaving the option out? If so, then
you don't need all this, because it boils down to not specifying
the parameter. Hmm, I wonder if all this sounds too confusing.
The point is just if "mysql-proxy ... --log-level=" is different
from "mysql-proxy ...".

Cheers,

Dejan


>
> thanks,
> raoul
> --
> ____________________________________________________________________
> DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
> Technischer Leiter
>
> IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
> Barawitzkagasse 10/2/2/11 email. office [at] ipax
> 1190 Wien tel. +43 1 3670030
> FN 277995t HG Wien fax. +43 1 3670030 15
> ____________________________________________________________________
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.