[asterisk-bugs] [Asterisk 0017038]: Insert fails when database initialized during connection outage to postgres server

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Mar 16 08:00:45 CDT 2010


The following issue has been SUBMITTED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17038 
====================================================================== 
Reported By:                pk16208
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   17038
Category:                   CDR/cdr_pgsql
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           1.6.0.26 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-03-16 08:00 CDT
Last Modified:              2010-03-16 08:00 CDT
====================================================================== 
Summary:                    Insert fails when database initialized during
connection outage to postgres server
Description: 
When asterisk starts up or reload the cdr_pgsql does not work properly when
the database connection fails during startup.
These results in a empty server record list and no cdr's are logged and
reconnect does not resolve the problem

In the case of AST_RWLIST_EMPTY(&psql_columns) 
the databse connection has to be closed completely and a complete
reinitialization is necessery.
The following patch will do the job:
diff asterisk-1.6.0.26/cdr/cdr_pgsql.c
/tmp/asterisk-1.6.0.26-rc1/cdr/cdr_pgsql.c 
109,110d108
< static int config_module(int reload);
< 
123,126d120
<                       if (AST_RWLIST_EMPTY(&psql_columns)) {
<                               ast_log(LOG_ERROR, "cdr_pgsql:
pgsql_columns not loaded, try reload !\n");
<                               config_module(0);               /* reload
the list du to problems during init */
<                       }
479,485c473
< 
< 
<       if (conn != NULL) {  /* in case of a reload close the connection
completely */
<               PQfinish(conn);
<               conn = NULL;
<               ast_log(LOG_WARNING,"cdr_pgsql: Databaces cloesed during
reload\n");
<       }
---
> 


====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-03-16 08:00 pk16208        Asterisk Version          => 1.6.0.26        
2010-03-16 08:00 pk16208        Regression                => No              
2010-03-16 08:00 pk16208        SVN Branch (only for SVN checkouts, not tarball
releases) => N/A             
======================================================================




More information about the asterisk-bugs mailing list