[OpenSER-Devel] [ openser-Patches-2020657 ] atomic location update

SourceForge.net noreply at sourceforge.net
Thu Jul 17 16:26:44 CEST 2008


Patches item #2020657, was opened at 2008-07-17 16:26
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=2020657&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Stanislaw Pitucha (viraptor)
Assigned to: Nobody/Anonymous (nobody)
Summary: atomic location update

Initial Comment:
If someone runs more than 1 openser host with shared `location` table in DB_ONLY mode, there's a possibility that one host will delete expired record/contact while another host retrieves it and tries to update (resulting in 0 rows updated). This patch adds 'db_atomic' option to usrloc module, which switches to using update_ucontact_atomic (and because of that, insert/update function instead of standard insert) in ul_mi and registrar/save.
It works only when db_mode==3 (DB_ONLY) and db_atomic==1. It needs a database schema change - making username+domain+contact (+callid if matching mode includes callid) a unique key, instead of standard index.

In mysql it results in running:
INSERT INTO location ... ON DUPLICATE KEY UPDATE ...
instead of normal SELECT FROM + INSERT/UPDATE

Patch is for an older version of 1.3, but seems to be trivially portable to trunk. Unfortunately I don't have proper environment to test that.

One issue I know of is that ul callbacks are not supported properly. Before db update it's not known if event was UL_CONTACT_INSERT, or UL_CONTACT_UPDATE, so I left it as ..._INSERT

As far as I can tell, patch worked reliably for couple of days without issues.

Stanisaw Pitucha

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=2020657&group_id=139143



More information about the Devel mailing list