[Home]

Summary:ASTERISK-24582: Realtime with multiple DB destinations using priorities results in duplicate queries
Reporter:dant (dant)Labels:
Date Opened:2014-12-02 13:46:41.000-0600Date Closed:
Priority:MinorRegression?
Status:Open/NewComponents:Resources/res_config_odbc Resources/res_odbc
Versions:11.14.1 13.18.4 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Using asterisk 11.14.1 RPMs on CentOS 6.6Attachments:( 0) queue_log_insert.txt
( 1) registration_update.txt
Description:Asterisk is configured to use realtime via ODBC. The database is Percona XtraDB Cluster with 4 configured nodes (multi-master) for Asterisk for failover, priorities have been defined. Pulling realtime information works well, but, updates that store to realtime show running against all databases, this is most noticeable for INSERTs to queue log where entries appear 4 times in the database with only the autoincrementing ID different between rows, but can be seen with sippeers UPDATES in logging too.

From extconfig.conf:
queue_log => odbc,db1,queue_log,1
queue_log => odbc,db2,queue_log,2
queue_log => odbc,db3,queue_log,3
queue_log => odbc,db4,queue_log,4

Expected behavior:
If the log can be written to db1, then it is written only to db1. If there is a failure, the next highest priority, i.e. db2, is tried.

Observed behavior:
The log appears to be written to all servers, which, being multi-master, results in duplicate log inserts.

Comments:By: dant (dant) 2014-12-02 13:49:46.367-0600

Sample debug log for realtime update on registration:
[Edit by Rusty - removing inline debug and attaching as .txt per the guidelines]

By: dant (dant) 2014-12-02 13:51:31.245-0600

Sample debug log for queue_log insert:
[Edit by Rusty - removing inline debug and attaching as .txt per the guidelines]


By: Rusty Newton (rnewton) 2014-12-04 20:14:51.020-0600

Yeah the way the documentation reads, I would expect the same thing - that the failover should only be tried in the case of an error.

From extconfig.conf
{noformat}
;example => odbc,asterisk,alttable,1
;example => mysql,asterisk,alttable,2
;example2 => ldap,"dc=oxymium,dc=net",example2
;
; Additionally, priorities are now supported for use as failover methods
; for retrieving realtime data.  If one connection fails to retrieve any
; information, the next sequential priority will be tried next.  This
; especially works well with ODBC connections, since res_odbc now caches
; when connection failures occur and prevents immediately retrying those
; connections until after a specified timeout.  Note:  priorities must
; start at 1 and be sequential (i.e. if you have only priorities 1, 2,
; and 4, then 4 will be ignored, because there is no 3).
{noformat}