<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Daniel,<div class=""><br class=""></div><div class="">Yes, sorry, there are two issues at discussion here.</div><div class=""><br class=""></div><div class="">1. Use of UUID’s instead of INT.  This is kinda moot for us right now.  We switched subscriber to autogenerate UUID, and it’s working great for us.  We don’t really *need* to do this anywhere else currently.  I don’t know when I would have time to test all of the other modules/use cases.</div><div class="">2. I’d love to PR back the kamdbctl updates that make CockroachDB work out of the box with the existing PGSQL scripts.  I have a branch that has some small updates that works for both PostgreSQL and CockroachDB: <a href="https://github.com/reperio/kamailio/tree/cockroachdb-compat" class="">https://github.com/reperio/kamailio/tree/cockroachdb-compat</a>.  However, there is one thing that I don’t really know if it can be fixed.  The kamdbctl scripts for PostgreSQL creates a function in the kamailio (created) db called “rand()”.  The comment in the script seems to point to something in the lcr module.  But I can’t seem to find where the lcr module is using rand().  Basically, I’m wondering if this is still needed?  Or, if this could be abstracted so that rand() is used for MySQL and random() is used for PostgreSQL?</div><div class=""><br class=""></div><div class="">Thanks!</div><div class=""><br class=""></div><div class="">~Noah<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 25, 2020, at 9:28 AM, Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" class="">miconda@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
  
  <div class=""><p class="">Hello,</p><p class="">somehow I understood that you want to replace id filed in tables
      from integer (auto increment) to some sort of string uid. Some
      modules expect that field to be integer, so changing its type can
      break them. If you change to use random unique values instead of
      auto-increment, then I expect to work.</p><p class="">Cheers,<br class="">
      Daniel<br class="">
    </p>
    <div class="moz-cite-prefix">On 21.08.20 23:47, Noah Mehl wrote:<br class="">
    </div>
    <blockquote type="cite" cite="mid:FAC7C655-9F93-4CA3-94AB-952346C8DF4F@gmail.com" class="">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
      Daniel/Henning,
      <div class=""><br class="">
      </div>
      <div class="">I have created a new branch that is much more
        CockroachDB compatible: <a href="https://github.com/reperio/kamailio/tree/cockroachdb-compat" class="" moz-do-not-send="true">https://github.com/reperio/kamailio/tree/cockroachdb-compat</a></div>
      <div class=""><br class="">
      </div>
      <div class="">So far, the only thing I’ve noticed that isn’t
        compatible is: <a href="https://github.com/reperio/kamailio/blob/62aad6591423e1f693397d33ddefd234938d1293/utils/kamctl/kamdbctl.pgsql#L137" class="" moz-do-not-send="true">https://github.com/reperio/kamailio/blob/62aad6591423e1f693397d33ddefd234938d1293/utils/kamctl/kamdbctl.pgsql#L137</a>,
        as the concat() function actually exists in PostgreSQL > 9ish
        and CockroachDB.  That being said, the only difference I can
        find between MySQL rand() and PostgreSQL random() is just the
        name.  Is this still an issue with the lcr module?  If so, can
        you point me to where it’s being used?</div>
      <div class=""><br class="">
      </div>
      <div class="">Otherwise, I have tested this update with PostgreSQL
        and CockroachDB.</div>
      <div class=""><br class="">
      </div>
      <div class="">Thanks!</div>
      <div class=""><br class="">
      </div>
      <div class="">~Noah</div>
      <div class="">
        <div class="">
          <div class=""><br class="">
            <blockquote type="cite" class="">
              <div class="">On Aug 21, 2020, at 2:38 PM, Noah Mehl <<a href="mailto:noahmehl@gmail.com" class="" moz-do-not-send="true">noahmehl@gmail.com</a>>
                wrote:</div>
              <br class="Apple-interchange-newline">
              <div class="">
                <meta http-equiv="Content-Type" content="text/html;
                  charset=UTF-8" class="">
                <div style="word-wrap: break-word; -webkit-nbsp-mode:
                  space; line-break: after-white-space;" class="">Daniel,
                  <div class=""><br class="">
                  </div>
                  <div class="">Thanks for the thoughtful reply.  I can,
                    at the very least, try and work on the stock pgsql
                    scripts to work OOTB with CockroachDB (minus the
                    create functions).</div>
                  <div class=""><br class="">
                  </div>
                  <div class="">The only table we really care about UUID
                    right now is subscriber, and we can just track that
                    ourselves.</div>
                  <div class=""><br class="">
                  </div>
                  <div class="">I will give kamcli a try, and hopefully
                    will be able to help in the future.</div>
                  <div class=""><br class="">
                  </div>
                  <div class="">Thanks!</div>
                  <div class=""><br class="">
                  </div>
                  <div class="">~Noah</div>
                  <div class=""><br class="">
                    <div class="">
                      <blockquote type="cite" class="">
                        <div class="">On Aug 21, 2020, at 4:34 AM,
                          Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" class="" moz-do-not-send="true">miconda@gmail.com</a>>
                          wrote:</div>
                        <br class="Apple-interchange-newline">
                        <div class="">
                          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
                          <div class=""><p class="">Hello,</p><p class="">the default kamailio.cfg is
                              aiming to offer a starting point for
                              building more complex configuration/SIP
                              routing policies, not to offer all the
                              options we support in Kamailio. MySQL is
                              provided there to show how to connect to
                              database, being chosen because it was the
                              first database connect module that was
                              developed and it is kept because it is
                              still very popular. You are more than
                              welcome to add a sample config of using
                              postgress, which can be placed somewhere
                              in the misc/examples/. Making the default
                              config too complex may result in "scaring"
                              the people trying to use Kamailio for
                              first time.<br class="">
                            </p><p class="">Using string UUID instead of the
                              auto-increment integer id it will break at
                              least lcr and msilo, iirc. Most of the
                              modules do not use id column, but some do
                              it. Siremis, the web management interface
                              is also using the id field, but it doesn't
                              support Postgres at this moment.</p><p class="">If you have some Python
                              knowledge (and spare time), maybe you can
                              help adding support for it in kamcli:</p><p class="">  * <a href="https://github.com/kamailio/kamcli" class="" moz-do-not-send="true">https://github.com/kamailio/kamcli</a></p><p class="">kamcli aims to be a more modern
                              alternative to kamctl/kamdbctl (e.g.,
                              better input validation, flexibility in
                              output formatting, internal interactive
                              shell with auto-completion, ...),
                              eventually replacing them in the future.
                              So far I was focusing on MySQL, being the
                              database type I use. Most of the commands
                              should just work for Postgres, because db
                              operations are done using SqlAlchemy
                              package, but a few commands (from the
                              kamcli db ... subcommand) use the cli tool
                              of the database system. At the end these
                              can be skipped, iirc, also for kamctl,
                              some of the corresponding subcommands are
                              only for mysql (like kamctl db connect),
                              but testing and seeing if it works or not
                              with Postgres or CockroachDB would be
                              appreciated.</p><p class="">Cheers,<br class="">
                              Daniel<br class="">
                            </p>
                            <div class="moz-cite-prefix">On 20.08.20
                              22:42, Noah Mehl wrote:<br class="">
                            </div>
                            <blockquote type="cite" cite="mid:8D33F74D-CA85-4FB1-A15C-A428A6FD3382@gmail.com" class="">
                              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
                              Henning,
                              <div class=""><br class="">
                              </div>
                              <div class="">So, for the default config,
                                it only has the option for: WITH_MYSQL.
                                 I was wondering if a WITH_PGSQL would
                                be accepted.</div>
                              <div class=""><br class="">
                              </div>
                              <div class="">As for the kamdbctl scripts,
                                there are a few things I’ve noticed:</div>
                              <div class=""><br class="">
                              </div>
                              <div class="">I would prefer UUID vs
                                SERIAL.  This actually is a little more
                                annoying when dealing with the SEQUENCE
                                entity in Postgres.  The only change
                                required, is to load the pgcrypto
                                extension and switch to uuid instead of
                                SERIAL.  I have a tracking branch here:</div>
                              <div class=""><br class="">
                              </div>
                              <div class=""><a href="https://github.com/reperio/kamailio/tree/postgres_uuid" class="" moz-do-not-send="true">https://github.com/reperio/kamailio/tree/postgres_uuid</a></div>
                              <div class=""><br class="">
                              </div>
                              <div class="">The other reason is that for
                                cockroachdb, using gen_random_uuid() is
                                documented to be more <a href="https://www.cockroachlabs.com/docs/stable/create-sequence.html" class="" moz-do-not-send="true">efficient</a> (in
                                addition to being a preference).</div>
                              <div class=""><br class="">
                              </div>
                              <div class="">As for cockroachdb, I have a
                                tracking branch (based on the uuid
                                branch) that seems to be working well:</div>
                              <div class=""><br class="">
                              </div>
                              <div class=""><a href="https://github.com/reperio/kamailio/tree/cockroach" class="" moz-do-not-send="true">https://github.com/reperio/kamailio/tree/cockroach</a></div>
                              <div class=""><br class="">
                              </div>
                              <div class="">So far, the only issue in
                                the creation/managment of the schema
                                is: CREATE FUNCTION.  But it looks like
                                maybe concat() and random() are already
                                supported by cockroackdb: <a href="https://www.cockroachlabs.com/docs/stable/functions-and-operators.html" class="" moz-do-not-send="true">https://www.cockroachlabs.com/docs/stable/functions-and-operators.html</a>.
                                 I will have to dig deeper into the lcr
                                module to see where/if this is an issue.</div>
                              <div class=""><br class="">
                              </div>
                              <div class="">Thanks!</div>
                              <div class=""><br class="">
                              </div>
                              <div class="">~Noah</div>
                              <div class="">
                                <div class=""><br class="">
                                  <blockquote type="cite" class="">
                                    <div class="">On Aug 20, 2020, at
                                      2:23 PM, Henning Westerholt <<a href="mailto:hw@skalatan.de" class="" moz-do-not-send="true">hw@skalatan.de</a>>
                                      wrote:</div>
                                    <br class="Apple-interchange-newline">
                                    <div class="">
                                      <div class="">Hi Noah,<br class="">
                                        <br class="">
                                        if you find something that does
                                        not work with the default
                                        PostgreSQL schema from kamdbctl,
                                        create an issue. It some cases
                                        it is just a matter of
                                        formatting and it can work for
                                        PostgreSQL and CockroachDB. This
                                        is probably the easier path,
                                        from an maintenance point of
                                        view.<br class="">
                                        <br class="">
                                        What do you mean by default
                                        configuration?<br class="">
                                        <br class="">
                                        Cheers,<br class="">
                                        <br class="">
                                        Henning<br class="">
                                        <br class="">
                                        -- <br class="">
                                        Henning Westerholt - <a href="https://skalatan.de/blog/" class="" moz-do-not-send="true">https://skalatan.de/blog/</a><br class="">
                                        Kamailio services - <a href="https://gilawa.com/" class="" moz-do-not-send="true">https://gilawa.com</a>
                                        <br class="">
                                        <br class="">
                                        -----Original Message-----<br class="">
                                        From: Noah Mehl <<a href="mailto:noahmehl@gmail.com" class="" moz-do-not-send="true">noahmehl@gmail.com</a>>
                                        <br class="">
                                        Sent: Thursday, August 20, 2020
                                        6:35 PM<br class="">
                                        To: Henning Westerholt <<a href="mailto:hw@skalatan.de" class="" moz-do-not-send="true">hw@skalatan.de</a>><br class="">
                                        Cc: Kamailio (SER) - Users
                                        Mailing List <<a href="mailto:sr-users@lists.kamailio.org" class="" moz-do-not-send="true">sr-users@lists.kamailio.org</a>><br class="">
                                        Subject: Re: [SR-Users]
                                        CockroachDB and Kamailio<br class="">
                                        <br class="">
                                        Henning,<br class="">
                                        <br class="">
                                        Thanks for the reply!  I am
                                        testing away.  I will update
                                        with my findings.<br class="">
                                        <br class="">
                                        That being said, some things
                                        might be slightly different.
                                         Should I add a cockroachdb
                                        option to the kamdbctl and
                                        default configs as a PR?<br class="">
                                        <br class="">
                                        ~Noah<br class="">
                                        <br class="">
                                        <blockquote type="cite" class="">On
                                          Aug 20, 2020, at 2:35 AM,
                                          Henning Westerholt <<a href="mailto:hw@skalatan.de" class="" moz-do-not-send="true">hw@skalatan.de</a>>
                                          wrote:<br class="">
                                          <br class="">
                                          Dear Noah,<br class="">
                                          <br class="">
                                          it was probably not discussed
                                          on the public list, at least I
                                          don't remember it. Cockroachdb
                                          claims to be compatible with
                                          PostgreSQL, so it should work
                                          with this DB Kamailio module.<br class="">
                                          <br class="">
                                          If you encounter issues,
                                          report on this list, or open a
                                          bug report if its something
                                          related to problems in the
                                          Kamailio db_postgres module.<br class="">
                                          <br class="">
                                          Cheers,<br class="">
                                          <br class="">
                                          Henning<br class="">
                                          <br class="">
                                          --<br class="">
                                          Henning Westerholt - <a href="https://skalatan.de/blog/" class="" moz-do-not-send="true">https://skalatan.de/blog/</a>
                                          Kamailio services - <br class="">
                                          <a href="https://gilawa.com/" class="" moz-do-not-send="true">https://gilawa.com</a><br class="">
                                          <br class="">
                                          -----Original Message-----<br class="">
                                          From: sr-users <a class="moz-txt-link-rfc2396E" href="mailto:sr-users-bounces@lists.kamailio.org" moz-do-not-send="true"><sr-users-bounces@lists.kamailio.org></a>
                                          On Behalf Of Noah <br class="">
                                          Mehl<br class="">
                                          Sent: Wednesday, August 19,
                                          2020 10:13 PM<br class="">
                                          To: <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org" moz-do-not-send="true">sr-users@lists.kamailio.org</a><br class="">
                                          Subject: [SR-Users]
                                          CockroachDB and Kamailio<br class="">
                                          <br class="">
                                          Has anyone been down this path
                                          before?  We are trying to test
                                          this out and the results are
                                          pretty promising so far.<br class="">
                                          <br class="">
                                          I realize the lack of Stored
                                          Procedures and Triggers make
                                          this untenable for many
                                          Postgres based
                                          implementations.<br class="">
                                          <br class="">
                                          Thanks!<br class="">
                                          <br class="">
                                          ~Noah<br class="">
_______________________________________________<br class="">
                                          Kamailio (SER) - Users Mailing
                                          List<br class="">
                                          <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org" moz-do-not-send="true">sr-users@lists.kamailio.org</a><br class="">
                                          <a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br class="">
                                        </blockquote>
                                        <br class="">
                                      </div>
                                    </div>
                                  </blockquote>
                                </div>
                                <br class="">
                              </div>
                              <br class="">
                              <fieldset class="mimeAttachmentHeader"></fieldset>
                              <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
                            </blockquote>
                            <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com/" moz-do-not-send="true">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Funding: <a class="moz-txt-link-freetext" href="https://www.paypal.me/dcmierla" moz-do-not-send="true">https://www.paypal.me/dcmierla</a></pre>
                          </div>
                        </div>
                      </blockquote>
                    </div>
                    <br class="">
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
          <br class="">
        </div>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com/">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Funding: <a class="moz-txt-link-freetext" href="https://www.paypal.me/dcmierla">https://www.paypal.me/dcmierla</a></pre>
  </div>

</div></blockquote></div><br class=""></div></body></html>