[Home]

Summary:ASTERISK-03548: cdr_pgsql does not gracefully handle database restarts
Reporter:Ben Klang (bklang)Labels:
Date Opened:2005-02-19 11:22:29.000-0600Date Closed:2008-01-15 15:26:15.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) ast_pgsql_retry.patch
Description:The cdr_pgsql module attempts to handle dead database connections.  However if the database restarts underneath it, it fails to catch the restart until the sql insert is performed.  However, at this point, the driver bails out rather than attempting a reconnect.  This patch changes the cdr_pgsql driver to attempt reconnections one more time.  Note this isn't an attempt to fix a race condition:  When postgresql is restarted, the test PQstatus(conn) succeeds the first time (before the transaction is committed), falsely leading the driver to believe the connection is still valid.

****** STEPS TO REPRODUCE ******

* Start asterisk
* shutdown and restart postgresql
* the first call into the system is never logged
* the subsequent call restarts the cdr_pgsql module and logging continues

This patch changes the behavior so that no call is dropped if the connection can be restarted.
Comments:By: Mark Spencer (markster) 2005-02-19 11:37:12.000-0600

Disclaimer status?

By: Ben Klang (bklang) 2005-02-19 13:27:36.000-0600

Disclaimer on file.
/BAK/

By: Mark Spencer (markster) 2005-02-19 14:12:12.000-0600

Added to CVS, thanks!

By: Russell Bryant (russell) 2005-02-26 12:59:30.000-0600

fixed in 1.0

By: Digium Subversion (svnbot) 2008-01-15 15:25:45.000-0600

Repository: asterisk
Revision: 5056

U   trunk/cdr/cdr_pgsql.c

------------------------------------------------------------------------
r5056 | markster | 2008-01-15 15:25:45 -0600 (Tue, 15 Jan 2008) | 2 lines

Make cdr_pgsql gracefully handle restarts (bug ASTERISK-3548)

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

http://svn.digium.com/view/asterisk?view=rev&revision=5056

By: Digium Subversion (svnbot) 2008-01-15 15:26:15.000-0600

Repository: asterisk
Revision: 5090

U   branches/v1-0/CHANGES
U   branches/v1-0/cdr/cdr_pgsql.c

------------------------------------------------------------------------
r5090 | russell | 2008-01-15 15:26:14 -0600 (Tue, 15 Jan 2008) | 2 lines

attempt a restart on a connection error (bug ASTERISK-3548)

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

http://svn.digium.com/view/asterisk?view=rev&revision=5090