[asterisk-dev] [Code Review] 3559: sqlite3: Add ability to automatically retry query to busy database

IgorG reviewboard at asterisk.org
Tue May 27 22:23:15 CDT 2014



> On May 27, 2014, 2:35 p.m., Matt Jordan wrote:
> > /trunk/main/db.c, line 260
> > <https://reviewboard.asterisk.org/r/3559/diff/1/?file=58777#file58777line260>
> >
> >     This one is the only usage that concerns me, simply because small changes in the AstDB code could have unforeseen effects.
> >     
> >     Have you run into a situation where the AstDB had similar problems under high load?

No, I have not. I'll then only change logging after sqlite3_exec here, so if problem with database busy ocure sometimes someone should report it.


> On May 27, 2014, 2:35 p.m., Matt Jordan wrote:
> > /trunk/cdr/cdr_sqlite3_custom.c, lines 266-276
> > <https://reviewboard.asterisk.org/r/3559/diff/1/?file=58775#file58775line266>
> >
> >     So, I'm definitely a fan of using the busy timeout rather than this arbitrary polling (which, as the comment suggests, is ... not good).
> >     
> >     I do think we should be handling the return code from sqlite3_exec here however, rather than simply relying on something being in error:
> >     
> >     res = sqlite3_exec(db, sql, NULL, NULL, &error);
> >     
> >     if (res != SQLITE_OK) {
> >         ast_log(LOG_ERROR, "%s. SQL: %s.\n", error, sql);
> >         sqlite3_free(error);
> >     }

Done


- IgorG


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


On May 27, 2014, 2:35 p.m., Igor Goncharovsky wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3559/
> -----------------------------------------------------------
> 
> (Updated May 27, 2014, 2:35 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-23766
>     https://issues.asterisk.org/jira/browse/ASTERISK-23766
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> We have faced situation when using CDR and CEL by sqlite3 modules. With system having high load (~100 concurrent calls created by sipp) we found many cdr and cel records missed. There is special finction in sqlite3, that make able to fix this situation - sqlite3_wait_timeout, that also can replace awful code cdr_sqlite3 ad cel_sqlite3 modules. Also this function can be used for aastdb and res_config_sqlite3 to avoid missed writes to sqlite db.
> 
> 
> Diffs
> -----
> 
>   /trunk/res/res_config_sqlite3.c 414121 
>   /trunk/main/db.c 414121 
>   /trunk/cel/cel_sqlite3_custom.c 414121 
>   /trunk/cdr/cdr_sqlite3_custom.c 414121 
> 
> Diff: https://reviewboard.asterisk.org/r/3559/diff/
> 
> 
> Testing
> -------
> 
> Adding sqlite3_wait_timeout already used as patch in AskoziaPBX and show good result.
> 
> 
> Thanks,
> 
> Igor Goncharovsky
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140528/c3907de3/attachment-0001.html>


More information about the asterisk-dev mailing list