[asterisk-dev] [Code Review] 4405: Fix ast_odbc_find_table function in res_odbc

wdoekes reviewboard at asterisk.org
Thu Feb 5 04:49:23 CST 2015


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

Ship it!


LGTM.


branches/11/res/res_odbc.c
<https://reviewboard.asterisk.org/r/4405/#comment24936>

    Remove this if(obj) while you're in the vicinity. It's always true.


@Mark: it's calling ast_odbc_request_obj and ast_odbc_release_obj, which is not needed unless we are actually going use obj.

The effects are that ast_odbc_find_table() will call SQL_ATTR_TXN_ISOLATION setup code, which has already been called anyway and which will be called another time when it's actually used. Like this:

    static int update_odbc(
    ...
        tableptr = ast_odbc_find_table(database, table);
        if (!(obj = ast_odbc_request_obj2(database, connected_flag))) {

- wdoekes


On Feb. 4, 2015, 6:21 p.m., ibercom wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4405/
> -----------------------------------------------------------
> 
> (Updated Feb. 4, 2015, 6:21 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-24742
>     https://issues.asterisk.org/jira/browse/ASTERISK-24742
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> This patch fixes an anomalous behavior in ast_odbc_find_table function with Asterisk Realtime.
> 
> - SELECT or INSERT operation generate a single command "SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED" in database engine before operation.
> - UPDATE operation generates two commands "SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED" in database engine before operation.
> 
> The patch is trivial, just rearranges the call to ast_odbc_request_obj function. This isn't necessary when the table is cached.
> 
> 
> Diffs
> -----
> 
>   branches/11/res/res_odbc.c 431571 
> 
> Diff: https://reviewboard.asterisk.org/r/4405/diff/
> 
> 
> Testing
> -------
> 
> Log mysql usage.
> It is working for a week without problems.
> 
> 
> Thanks,
> 
> ibercom
> 
>

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


More information about the asterisk-dev mailing list