[Home]

Summary:ASTERISK-12647: [patch] Mysql CDR logger should not DESC the table every time through.
Reporter:Tilghman Lesher (tilghman)Labels:
Date Opened:2008-08-26 15:49:19Date Closed:2008-08-28 11:29:21
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Addons/cdr_mysql
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20080826__cdr_mysql__2.diff.txt
( 1) 20080826__cdr_mysql.diff.txt
Description:On Tuesday 26 August 2008 14:28:40 Chris Maciejewski wrote:
> I have just noticed cdr_mysql (addons 1.6) before inserting a CDR
> record into MySQL table, runs "DECS(ribe) cdr" _EVERY_ time.
>
> Would it not be better to load table structure (fields mappings) from
> cdr_mysql.conf and run ONLY "INSERT ...." statement?
>
> It seems to me we are causing unnecessary load on MySQL server and
> slowing things down.
Comments:By: Chris Maciejewski (chris-mac) 2008-08-26 17:05:13

I would like to test this code, but when patching addons 1.6.0 branch (r651) I am getting the following error:

root@dev2:/usr/src/asterisk-addons-1.6.0# patch -p0 < ../20080826__cdr_mysql.diff.txt
patching file channels/chan_mobile.c
Hunk #1 succeeded at 558 (offset -10 lines).
Hunk #2 FAILED at 580.
Hunk #3 succeeded at 599 (offset -12 lines).
1 out of 3 hunks FAILED -- saving rejects to file channels/chan_mobile.c.rej
patching file cdr/cdr_addon_mysql.c

Could you please let me know, how should I apply this patch?

Regards,
Chris

By: Tilghman Lesher (tilghman) 2008-08-26 18:24:59

My apologies.  It appears that I had some extra bits in that patch.  Try this newly uploaded patch.

By: Chris Maciejewski (chris-mac) 2008-08-28 02:03:50

This time patched addons 1.6.0 OK and the only query sent to MySQL server I can see is "INSERT INTO cdr ...". Great improvement!!!

I vote with my both hands to include this patch into addons 1.6.X

By: Digium Subversion (svnbot) 2008-08-28 11:29:17

Repository: asterisk-addons
Revision: 653

U   trunk/cdr/cdr_addon_mysql.c

------------------------------------------------------------------------
r653 | tilghman | 2008-08-28 11:29:16 -0500 (Thu, 28 Aug 2008) | 8 lines

Don't DESC the MySQL table every time through, but instead cache the state
at module load and reload, just like the other CDR drivers.
(closes issue ASTERISK-12647)
Reported by: Corydon76
Patches:
      20080826__cdr_mysql__2.diff.txt uploaded by Corydon76 (license 14)
Tested by: chris-mac

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

http://svn.digium.com/view/asterisk-addons?view=rev&revision=653