<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/944/">https://reviewboard.asterisk.org/r/944/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On November 23rd, 2010, 11:05 a.m., <b>Tilghman Lesher</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I'm pretty good with this, but I'm a bit confused by your test, as the second parameter in the extconfig line should be "general", as that is the entry in res_pgsql.conf.</pre>
</blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">res_config_pgsql works differently than res_config_odbc. It's required that the database settings be under [general] the section is not the name of the database connection like it is with odbc. The second column from the extconfig.conf 'pbx', is not used in res_config_pgsql.c as far as I can tell.</pre>
<br />
<p>- kobaz</p>
<br />
<p>On December 25th, 2010, 5:38 p.m., kobaz wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.orgrb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By kobaz.</div>
<p style="color: grey;"><i>Updated 2010-12-25 17:38:57</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">If your postgres connection died suddenly in between res_config_pgsql queries, the query will fail because the query is executed on a disconnected/disconnecting handle.
Reviewboard patch adds support for reconnecting and retrying the failed query if the connection was closed while executing the query. The patch also removes lots of duplication of checking for handling query errors.
Ideally there should be a centralized res module for postgres connections that cdr_pgsql and res_config_pgsql (and any other pgsql dependent module) can use for a centralized db abstraction module.
But I believe fixing up res_config_pgsql is the first step.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">res_pgsql_conf.
===============
[general]
dbhost=localhost
dbport=5432
dbname=pbx
dbuser=root
dbpass=password
extconfig.conf
===================
[settings]
voicemail => pgsql,pbx,asterisk.v_asterisk_voicemail_config
===================
Start asterisk
(kill all current connections, replace pbx with appropriate database name)
kill `ps aux | grep postgres | grep pbx | awk {'print $2'}`
Launch voicemail (or something else that uses res_config_pgsql)
[Sep 28 16:02:31] ERROR[23650]: res_config_pgsql.c:167 _pgsql_exec: PostgreSQL RealTime: Failed to query 'asterisk.v_asterisk_voicemail_config@pbx'.
[Sep 28 16:02:31] ERROR[23650]: res_config_pgsql.c:168 _pgsql_exec: PostgreSQL RealTime: Query Failed: SELECT * FROM asterisk.v_asterisk_voicemail_config WHERE mailbox = '2702' AND context = 'internal'
[Sep 28 16:02:31] ERROR[23650]: res_config_pgsql.c:169 _pgsql_exec: PostgreSQL RealTime: Query Failed because: FATAL: terminating connection due to administrator command
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
(PGRES_FATAL_ERROR)
[Sep 28 16:02:31] NOTICE[23650]: res_config_pgsql.c:230 pgsql_exec: PostgreSQL RealTime: Query finally succeeded: SELECT * FROM asterisk.v_asterisk_voicemail_config WHERE mailbox = '2702' AND context = 'internal'
-- <SIP/2701-00000005> Playing 'vm-theperson.ulaw' (language 'en')
-- <SIP/2701-00000005> Playing 'digits/2.ulaw' (language 'en')
-- <SIP/2701-00000005> Playing 'digits/7.ulaw' (language 'en')
-- <SIP/2701-00000005> Playing 'digits/0.ulaw' (language 'en')
-- <SIP/2701-00000005> Playing 'digits/2.ulaw' (language 'en')
</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>trunk/res/res_config_pgsql.c <span style="color: grey">(295123)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/944/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>