[asterisk-dev] [Code Review] 3815: Improve AstDb I/O When Updating Rows

Tilghman Lesher reviewboard at asterisk.org
Wed Jul 16 21:34:44 CDT 2014


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



/trunk/main/db.c
<https://reviewboard.asterisk.org/r/3815/#comment22987>

    It looks like you're adding a 3rd and 4th bound value to the statement, yet you're not actually binding any values to those placeholders.  Don't you need to do that?


- Tilghman Lesher


On July 16, 2014, 10:44 p.m., Michael Young wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3815/
> -----------------------------------------------------------
> 
> (Updated July 16, 2014, 10:44 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-24050
>     https://issues.asterisk.org/jira/browse/ASTERISK-24050
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> When updating a row, we are currently doing an INSERT OR REPLACE INTO.  The downside to this is that the row is deleted if it exists and then a new row is inserted.  So, we are hitting the disk twice.  One for the deletion and one for the insertion.
> 
> The proposed patch will attempt to do an INSERT INTO and if it fails because a row with that key exists, we will ignore that.  Then we will attempt to perform an UPDATE on the existing row.  If a record was INSERTED, the UPDATE statement will end up doing nothing.
> 
> 
> Diffs
> -----
> 
>   /trunk/main/db.c 418785 
>   /trunk/include/asterisk/astdb.h 418785 
> 
> Diff: https://reviewboard.asterisk.org/r/3815/diff/
> 
> 
> Testing
> -------
> 
> Local pbx with a couple of peers.  Did see a slight I/O increase.
> 
> before patch
> Re-Register  Avg. 404 ms
> Register     Avg. 442 ms
> 
> after patch
> Re-Register  Avg. 361.5 ms
> Register     Avg. 419 ms
> 
> 
> Thanks,
> 
> Michael Young
> 
>

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


More information about the asterisk-dev mailing list