<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Thanks for your help.</p>
    <p>I have found this to remove DDL locks and it works. I don't know
      if it is a good way:</p>
    <p>SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE
      datname = 'freeswitch';</p>
    <p>ALTER ROLE $db_user SET bdr.permit_ddl_locking = false;</p>
    <p>I will check to disable schema management features.<br>
    </p>
    <div class="moz-cite-prefix">Le 19-05-10 à 16 h 26, Mike Jerris a
      écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:DAD904D1-3029-4993-A024-F806C80AFA72@freeswitch.org">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      If you are using shared db you should be disabling the features
      for managing the schema.  The issue is you will need to manually
      maintain your schema.  Almost always we manage schema it a way
      that is backwards compatible so you can do staged upgrades if you
      manually add to the tables.<br class="">
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">On May 10, 2019, at 5:45 AM, Praveen Chourasia
            <<a href="mailto:praveen.chourasia@outlook.com" class=""
              moz-do-not-send="true">praveen.chourasia@outlook.com</a>>
            wrote:</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Helvetica, sans-serif; font-size:
              10pt;" class="">Hi Frédérick,</div>
            <div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Helvetica, sans-serif; font-size:
              10pt;" class=""><br class="">
            </div>
            <div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Helvetica, sans-serif; font-size:
              10pt;" class="">PostgreSQL BDR uses 'Master-Master'
              replication and requires locking if any of the PostgreSQL
              BDR nodes (that are in replication cluster)  executes DDL
              SQL queries. It causes the whole cluster to lock as far as
              I remember.</div>
            <div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Helvetica, sans-serif; font-size:
              10pt;" class=""><br class="">
            </div>
            <div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Helvetica, sans-serif; font-size:
              10pt;" class="">The reason you may be experiencing the
              database getting locked when you restart one of the
              FreeSWITCH nodes is that FreeSWITCH upon its start/restart
              executes DDL queries. </div>
            <div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Helvetica, sans-serif; font-size:
              10pt;" class=""><br class="">
            </div>
            <div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Helvetica, sans-serif; font-size:
              10pt;" class="">FreeSWITCH AFAIK unconditionally executes
              'DROP TABLE/VIEW...' and 'CREATE TABLE/VIEW ...' for
              tables like 'channels', 'calls', 'interfaces', 'tasks'
              (TABLES) & 'detailed_calls', 'basic_calls' (VIEWS)
              that ultimately leads to PostgreSQL BDR getting locked.</div>
            <div style="font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              font-family: Calibri, Helvetica, sans-serif; font-size:
              10pt;" class=""><br class="">
            </div>
            <div id="Signature" style="caret-color: rgb(0, 0, 0);
              font-family: Helvetica; font-size: 12px; font-style:
              normal; font-variant-caps: normal; font-weight: normal;
              letter-spacing: normal; text-align: start; text-indent:
              0px; text-transform: none; white-space: normal;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;
              text-decoration: none;" class="">
              <div id="divtagdefaultwrapper" dir="ltr" style="font-size:
                10pt; font-family: Calibri, Arial, Helvetica,
                sans-serif;" class=""><font style="font-size: 10pt;"
                  class="" size="2" face="Calibri" color="#5133ab">--</font>
                <div class=""><font style="font-size: 10pt;" class=""
                    size="2" face="Calibri" color="#5133ab"><font
                      style="font-size: 10pt;" class="" face="Calibri"
                      color="#5133ab"><b class="">Praveen Chourasia</b><br
                        class="">
                    </font><span style="font-family: Calibri, Arial,
                      Helvetica, sans-serif; font-size: 13.3333px;"
                      class=""></span>
                    <div style="font-family: Calibri, Arial, Helvetica,
                      sans-serif; font-size: 13.3333px;" class=""><br
                        class="">
                    </div>
                  </font>
                  <div class=""><span style="font-family: Calibri;
                      font-size: 10pt;" class=""></span></div>
                </div>
              </div>
            </div>
            <hr tabindex="-1" style="caret-color: rgb(0, 0, 0);
              font-family: Helvetica; font-size: 12px; font-style:
              normal; font-variant-caps: normal; font-weight: normal;
              letter-spacing: normal; text-align: start; text-indent:
              0px; text-transform: none; white-space: normal;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;
              text-decoration: none; display: inline-block; width:
              842.796875px;" class=""><span style="caret-color: rgb(0,
              0, 0); font-family: Helvetica; font-size: 12px;
              font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;
              float: none; display: inline !important;" class=""></span>
            <div id="divRplyFwdMsg" dir="ltr" style="caret-color: rgb(0,
              0, 0); font-family: Helvetica; font-size: 12px;
              font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; text-align:
              start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;"
              class=""><font style="font-size: 11pt;" class=""
                face="Calibri, sans-serif"><b class="">From:</b><span
                  class="Apple-converted-space"> </span>FreeSWITCH-users
                <<a
                  href="mailto:freeswitch-users-bounces@lists.freeswitch.org"
                  class="" moz-do-not-send="true">freeswitch-users-bounces@lists.freeswitch.org</a>>
                on behalf of Frédérick Pruneau <<a
                  href="mailto:frederick@targointernet.com" class=""
                  moz-do-not-send="true">frederick@targointernet.com</a>><br
                  class="">
                <b class="">Sent:</b><span class="Apple-converted-space"> </span>Monday,
                May 6, 2019 7:38 PM<br class="">
                <b class="">To:</b><span class="Apple-converted-space"> </span><a
                  href="mailto:freeswitch-users@lists.freeswitch.org"
                  class="" moz-do-not-send="true">freeswitch-users@lists.freeswitch.org</a><br
                  class="">
                <b class="">Subject:</b><span
                  class="Apple-converted-space"> </span>[Freeswitch-users]
                FS can't reconnect to PostgreSQL database</font>
              <div class=""> </div>
            </div>
            <div class="BodyFragment" style="caret-color: rgb(0, 0, 0);
              font-family: Helvetica; font-size: 12px; font-style:
              normal; font-variant-caps: normal; font-weight: normal;
              letter-spacing: normal; text-align: start; text-indent:
              0px; text-transform: none; white-space: normal;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;
              text-decoration: none;"><font class="" size="2"><span
                  style="font-size: 11pt;" class="">
                  <div class="PlainText">Hi guys,<br class="">
                    <br class="">
                    I have an issue with FS unable to reconnect to
                    postgresql database. Here<span
                      class="Apple-converted-space"> </span><br class="">
                    is the setup: 2 FreeSWITCH servers with 2 postgresql
                    servers. Each<span class="Apple-converted-space"> </span><br
                      class="">
                    freeswitch is connected to 1 postgresql server. DB
                    servers are synced<span
                      class="Apple-converted-space"> </span><br class="">
                    with BDR. It was working very well until I restarted
                    freeswitch service<span
                      class="Apple-converted-space"> </span><br class="">
                    on one of the servers. Then, I got theses errors
                    showing up on<span class="Apple-converted-space"> </span><br
                      class="">
                    freeswitch console:<br class="">
                    <br class="">
                    switch_pgsql.c:384 Query X took too long to complete
                    or database not<span class="Apple-converted-space"> </span><br
                      class="">
                    responding.<br class="">
                    <br class="">
                    database is locked against ddl by another node<br
                      class="">
                    <br class="">
                    I followed some guides to remove locks with these
                    commands:<br class="">
                    <br class="">
                    SELECT * FROM pg_stat_activity;<br class="">
                    SELECT pg_terminate_backend(${pid});<br class="">
                    <br class="">
                    But the issue is still there. Do you have an idea
                    how to fix this issue?<br class="">
                    <br class="">
                    Thanks.<br class="">
                    <br class="">
                  </div>
                </span></font></div>
          </div>
        </blockquote>
      </div>
      <br class="">
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire <a class="moz-txt-link-freetext" href="https://signalwire.com">https://signalwire.com</a>
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time <a class="moz-txt-link-freetext" href="https://signalwire.community">https://signalwire.community</a>

Professional FreeSWITCH Services
<a class="moz-txt-link-abbreviated" href="mailto:sales@freeswitch.com">sales@freeswitch.com</a>
<a class="moz-txt-link-freetext" href="https://freeswitch.com">https://freeswitch.com</a>

Official FreeSWITCH Sites
<a class="moz-txt-link-freetext" href="https://freeswitch.com/oss">https://freeswitch.com/oss</a>
<a class="moz-txt-link-freetext" href="https://freeswitch.org/confluence">https://freeswitch.org/confluence</a>
<a class="moz-txt-link-freetext" href="https://cluecon.com">https://cluecon.com</a>

FreeSWITCH-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a class="moz-txt-link-freetext" href="https://freeswitch.com">https://freeswitch.com</a></pre>
    </blockquote>
    <div class="moz-signature">-- <br>
      <table style="width: 550px" cellspacing="0" cellpadding="0"
        border="0">
        <tbody>
          <tr>
            <td>
              <table style="border-collapse: collapse;" cellspacing="0"
                cellpadding="0" border="0">
                <tbody>
                  <tr>
                    <td style="width: 237px;"><img
                        src="http://www.targo.ca/signatures/signature-targo-2019_04.gif"
                        alt="" border="0"></td>
                    <td><font face="arial" color="#339933"><b>Frédérick
                          Pruneau </b></font><font face="arial"
                        color="#333333">| Spécialiste VoIP<br>
                        <br>
                        <b>T </b> 514.448.0773 <b> #</b> 121<br>
                        <b>E </b> <a class="moz-txt-link-abbreviated" href="mailto:frederick@targointernet.com">frederick@targointernet.com</a><br>
                      </font></td>
                  </tr>
                </tbody>
              </table>
            </td>
          </tr>
          <tr>
            <td height="28">
              <table style="border-collapse: collapse;" cellspacing="0"
                cellpadding="0" border="0">
                <tbody>
                  <tr>
                    <td style="width: 510px;height: 28px" padding:=""
                      0;="" line-height:="" 28px;="" align="right">
                      <div style="font-size:2px">
                        <a href="http://www.targo.ca"><img
                            style="”display:block”"
                            src="http://www.targo.ca/signatures/signature-targo-2019_06.gif"
                            alt="" border="0"></a></div>
                    </td>
                    <td style="width: 39px;" align="left">
                      <div style="font-size:2px"><a
href="https://fr-ca.facebook.com/pages/category/Local-Business/Targo-Communications-176964412324634/"><img
                            style="”display:block”"
                            src="http://www.targo.ca/signatures/signature-targo-2019_07.gif"
                            alt="" border="0"></a></div>
                    </td>
                  </tr>
                </tbody>
              </table>
            </td>
          </tr>
          <tr>
            <td line-height:="" 127px;="" style="width: 550px;height:
              127px" width="549" height="127"><a
                href="https://goo.gl/maps/MQtJ4S3rYLP537ss7"><img
                  style="”display:block”"
                  src="http://www.targo.ca/signatures/signature-targo-2019_08.gif"
                  alt="" border="0" align="top"></a>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </body>
</html>