[asterisk-dev] [Code Review] Fix reconnecting to pgsql database after connection loss.

Tilghman Lesher reviewboard at asterisk.org
Sat Feb 11 01:03:09 CST 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1731/#review5480
-----------------------------------------------------------

Ship it!


Please add a note to extconfig.conf.sample noting that the database name is configured in res_pgsql.conf and is otherwise ignored there.  Otherwise, it's good to go.

- Tilghman


On Feb. 10, 2012, 6:05 p.m., rmudgett wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1731/
> -----------------------------------------------------------
> 
> (Updated Feb. 10, 2012, 6:05 p.m.)
> 
> 
> Review request for Asterisk Developers and Matt Jordan.
> 
> 
> Summary
> -------
> 
> Fix reconnecting to pgsql database after connection loss.
> 
> There can only be one database connection in res_config_pgsql just like
> res_config_sqlite.  If the connection is lost, the connection may not get
> reestablished to the same database if the res_pgsql.conf and
> extconfig.conf files are inconsistent.
> 
> * Made only use the configured database from res_pgsql.conf.
> 
> * Fixed potential buffer overwrite of last[] in config_pgsql().
> 
> 
> Rationale for using the original reporter's approach as a base for this
> patch:
> 
> The way the code in res_config_psql is written is biased toward only one
> connection to the database.  That connection is the one specified in
> res_pgsql.conf.
> 
> 1) The pgsql_reconnect() function will not change the open connection if
> the supplied database name differs from the name used to open the current
> link.  It will only open a link if the current link is either not open or
> broken.
> 
> 2) The CLI "realtime show pgsql status" command only uses the res_pgsql.conf
> database name.
> 
> 3) The CLI "realtime show pgsql cache <table>" command only uses the
> res_pgsql.conf database if the table actually isn't cached already.
> 
> 
> This addresses bug ASTERISK-16982.
>     https://issues.asterisk.org/jira/browse/ASTERISK-16982
> 
> 
> Diffs
> -----
> 
>   branches/1.8/res/res_config_pgsql.c 354890 
> 
> Diff: https://reviewboard.asterisk.org/r/1731/diff
> 
> 
> Testing
> -------
> 
> This is based off of the approach of the original reporter's patch.
> 
> 
> Thanks,
> 
> rmudgett
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120211/5c819b73/attachment.htm>


More information about the asterisk-dev mailing list