Re: [AMaViS-user] Database reconnection with PostgreSQL

2006-03-01 Thread Brian Wong
On 2/28/06, Mark Martinec <[EMAIL PROTECTED]> wrote:
> Brian,
>
> > Can anyone else confirm that reconnection does not work with
> > PostgreSQL? Im suspecting that the line:
> >   eval { $self->dbh->begin_work(@_) }; # line 9575 of amavisd 2.3.3
> > always returns true for the DBD::Pg module regardless of the state of
> > the connection. Therefore constantly making false attempts to store
> > sql information with save_info_preliminary() if the connection is
> > actually lost.
>
> Seems like PostgreSQL returns status 7 in such case,
> while MySQL returns either 2006 or 2013.
>
> Could you please add the '7' to the list in sub execute, e.g.:
>
> --- amavisd.origMon Aug 22 01:46:15 2005
> +++ amavisd Wed Mar  1 01:27:01 2006
> @@ -9639,8 +9639,11 @@
>eval { $sth->execute(@args) };
>if ($@ ne '') {
> -my($err) = $@; chomp($err); my($msg) = "sql execute: sts=$DBI::err, 
> $err";
> -if (!$sth || ($sth->err ne '2006' && $sth->err ne '2013')) {
> -  die $msg;
> -} else {  # MySQL specific: server has gone away; Lost connection to...
> +my($err) = $@; chomp($err); my($msg) = "sts=" . $DBI::err . ", $err";
> +if (!$sth) {
> +  die "sql execute (no handle): ".$msg;
> +} elsif ($sth->err ne '2006' && $sth->err ne '2013' && $sth->err ne '7') 
> {
> +  die "sql execute: ".$msg;
> +} else {  # Server has gone away; Lost connection to...
> +  # MySQL: 2006, 2013;  PostgreSQL: 7
>if ($self->{in_transaction}) {
>  $self->disconnect_from_sql;

I have no idea what I was thinking when I said it was the begin_work
failing when the logs clearly said it was the execute. Thanks, ill
test this out.


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
___
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/


Re: [AMaViS-user] Database reconnection with PostgreSQL

2006-02-28 Thread Mark Martinec
Brian,

> Can anyone else confirm that reconnection does not work with
> PostgreSQL? Im suspecting that the line:
>   eval { $self->dbh->begin_work(@_) }; # line 9575 of amavisd 2.3.3
> always returns true for the DBD::Pg module regardless of the state of
> the connection. Therefore constantly making false attempts to store
> sql information with save_info_preliminary() if the connection is
> actually lost.

Seems like PostgreSQL returns status 7 in such case,
while MySQL returns either 2006 or 2013.

Could you please add the '7' to the list in sub execute, e.g.:

--- amavisd.origMon Aug 22 01:46:15 2005
+++ amavisd Wed Mar  1 01:27:01 2006
@@ -9639,8 +9639,11 @@
   eval { $sth->execute(@args) };
   if ($@ ne '') {
-my($err) = $@; chomp($err); my($msg) = "sql execute: sts=$DBI::err, $err";
-if (!$sth || ($sth->err ne '2006' && $sth->err ne '2013')) {
-  die $msg;
-} else {  # MySQL specific: server has gone away; Lost connection to...
+my($err) = $@; chomp($err); my($msg) = "sts=" . $DBI::err . ", $err";
+if (!$sth) {
+  die "sql execute (no handle): ".$msg;
+} elsif ($sth->err ne '2006' && $sth->err ne '2013' && $sth->err ne '7') {
+  die "sql execute: ".$msg;
+} else {  # Server has gone away; Lost connection to...
+  # MySQL: 2006, 2013;  PostgreSQL: 7
   if ($self->{in_transaction}) {
 $self->disconnect_from_sql;


Mark


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/


[AMaViS-user] Database reconnection with PostgreSQL

2006-02-23 Thread Brian Wong
List,
Can anyone else confirm that reconnection does not work with
PostgreSQL? Im suspecting that the line:

  eval { $self->dbh->begin_work(@_) }; # line 9575 of amavisd 2.3.3

always returns true for the DBD::Pg module regardless of the state of
the connection. Therefore constantly making false attempts to store
sql information with save_info_preliminary() if the connection is
actually lost.

(13517-06) WARN save_info_final: sql execute: sts=7, DBD::Pg::st
execute failed: no connection to the server at (eval 40) line 131,
 line 875.
(13517-06) sql_storage: retrying on final, 2 attempts remain
(13517-06) save_info_final: rollback done
(13517-06) WARN save_info_final: sql execute: sts=7, DBD::Pg::st
execute failed: no connection to the server at (eval 40) line 131,
 line 875.
(13517-06) sql_storage: retrying on final, 1 attempts remain
(13517-06) save_info_final: rollback done
(13517-06) WARN save_info_final: sql execute: sts=7, DBD::Pg::st
execute failed: no connection to the server at (eval 40) line 131,
 line 875.
(13517-06) ERROR sql_storage: too many retries on storing final, info not saved


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
___
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/