<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi Aron,<br>
    <br>
    On 06/30/2011 10:40 PM, Aron Rosenberg wrote:
    <blockquote
      cite="mid:BANLkTikhiyJFVATvL_7RtZKCDDxtoRrh_w@mail.gmail.com"
      type="cite">Bogdan and Stan,
      <div><br>
        <div class="gmail_quote">On Thu, Jun 30, 2011 at 11:14 AM,
          Bogdan-Andrei Iancu <span dir="ltr">&lt;<a
              moz-do-not-send="true" href="mailto:bogdan@opensips.org">bogdan@opensips.org</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">
            Hi Stan,
            <div class="im"><br>
              <br>
              On 06/30/2011 08:48 PM, Stanisław Pitucha wrote:<br>
              <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
                0.8ex; border-left: 1px solid rgb(204, 204, 204);
                padding-left: 1ex;">
                On 30 June 2011 17:25, Bogdan-Andrei Iancu&lt;<a
                  moz-do-not-send="true"
                  href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>&gt;
                 wrote:<br>
                <blockquote class="gmail_quote" style="margin: 0pt 0pt
                  0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204);
                  padding-left: 1ex;">
                  Revision: 8105<br>
                           <a moz-do-not-send="true"
href="http://opensips.svn.sourceforge.net/opensips/?rev=8105&amp;view=rev"
                    target="_blank">http://opensips.svn.sourceforge.net/opensips/?rev=8105&amp;view=rev</a><br>
                  Author:   bogdan_iancu<br>
                  Date:     2011-06-30 16:25:18 +0000 (Thu, 30 Jun 2011)<br>
                  <br>
                  Log Message:<br>
                  -----------<br>
                  - fixed race between UPDATE and DELETE when using
                  DB_ONLY mode (one processe can update a record, while
                  timer proc tries to delete it). The result is loosing
                  contacts from database. The fix is to use REPLACE (if
                  available on DB level) instead of UPDATE (as records
                  may be missing).<br>
                   Based on an original idea from patch #2969454;
                  Credits go to Stanislaw Pitucha<br>
                </blockquote>
                I think a bit too much stuff was stripped. Now the old
                db schema is<br>
                used without any control from the user.<br>
                That means there's no unique key to generate the
                conflict<br>
                (update/replace happens only on key collision) on insert<br>
              </blockquote>
            </div>
            Thanks for reminding me on that - I almost forgot to update
            the DB schema and to add the unique key constraint as you
            mentioned  - just did that
            <div class="im"><br>
              <br>
              <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
                0.8ex; border-left: 1px solid rgb(204, 204, 204);
                padding-left: 1ex;">  and no way to<br>
                turn off the "atomic" updates from the config if you
                want the old<br>
                schema... Unless it's properly documented in the manual
                it might cause<br>
                some really bizarre situations for people using DB_ONLY.<br>
              </blockquote>
            </div>
            What kind of side effects are you referring at ? My idea was
            to try to automatically fix the problem (when DB_ONLY is
            used), transparent for the user. Of course, it is not a big
            deal to add the config switch for that, but I don't see why
            you should disable it and run a buggy code :D.<br>
            <br>
            Thanks and regards,<br>
            Bogdan<br>
            <font color="#888888">
              <br>
              <br>
              -- <br>
            </font>
            <div>
              <div class="h5"><br>
              </div>
            </div>
          </blockquote>
          <span class="Apple-style-span" style="border-collapse:
            collapse; font-family: arial,sans-serif; font-size: 13px;">One
            major issue with enforcing a unique index on
            username,contact is that if a client comes in and is using a
            Path: header, the contact address is irrelevant and not
            "fixed up" so two accounts from behind NAT's both on the
            192.168.1.x range will have conflicts resulting in one
            endpoint being silently dropped. I believe this is also a
            problem with the internal hash table too.</span><br>
        </div>
      </div>
    </blockquote>
    Partially you are right :) - the internal hash is not affected as it
    is using the callid also as key (see the match mode in the usrloc
    module). But about the DB, you are right - in NATed cases, contacts
    may overlap.<br>
    As fix I suggest adding the callid field in the "unique" key also.
    This should cover all the cases (when received or path is used).<br>
    <br>
    Thanks and regards,<br>
    Bogdan<br>
    <br>
    <br>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Bogdan-Andrei Iancu
OpenSIPS eBootcamp - 2nd of May 2011
OpenSIPS solutions and "know-how"</pre>
  </body>
</html>