<div dir="ltr"><div><div>Hi Steve,<br><br></div>As you said the deadlock was caused by process 15366 but I did not find it because I was looking in the wrong server. Once the process was identified I could stop it and run the commands successfully.<br><br></div>Thank you for your help!<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 17, 2014 at 1:22 PM, Steve Singer <span dir="ltr">&lt;<a href="mailto:ssinger@ca.afilias.info" target="_blank">ssinger@ca.afilias.info</a>&gt;</span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 12/17/2014 08:48 AM, Carlos Henrique Reimer wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; We are trying to upgrade our PG from 8.3 to 9.3 with slony 2.2.3.<br>
&gt;<br>
&gt; The complete database (21.000 tables) is now being sincronized with<br>
&gt; SLONY and I would like to terminate the replication processing in order<br>
&gt; to another team test the application with the new 9.3 replicated<br>
&gt; database. They will need several hours to test the application. Once I<br>
&gt; get they green light, will repeat the processing again and replicate the<br>
&gt; database from scratch.<br>
&gt;<br>
&gt; I&#39;m trying to unsubscribe a receiver from the master set but I&#39;m getting<br>
&gt; an out of shared memory message:<br>
&gt;<br>
</span>&gt; cat <a href="http://unsubscribe2.sl" target="_blank">unsubscribe2.sl</a> &lt;<a href="http://unsubscribe2.sl" target="_blank">http://unsubscribe2.sl</a>&gt;<br>
<span class="">&gt; cluster name = slcluster;<br>
&gt; node 1 admin conninfo = &#39;dbname=FiscalWeb host=192.168.23.10 user=slonyo&#39;;<br>
&gt; node 2 admin conninfo = &#39;dbname=FiscalWeb host=192.168.23.11 user=slonyn&#39;;<br>
&gt; unsubscribe set ( id = 1 , receiver = 2);<br>
&gt;<br>
</span>&gt; slonik &lt; <a href="http://unsubscribe2.sl" target="_blank">unsubscribe2.sl</a> &lt;<a href="http://unsubscribe2.sl" target="_blank">http://unsubscribe2.sl</a>&gt;<br>
<span class="">&gt; &lt;stdin&gt;:4: WARNING:  out of shared memory<br>
&gt; CONTEXT:  SQL statement &quot;drop trigger &quot;_slcluster_logtrigger&quot; on<br>
&gt; &quot;8359_wsn&quot;.&quot;tbpgdas01502&quot;&quot;<br>
&gt; PL/pgSQL function altertabledroptriggers(integer) line 47 at EXECUTE<br>
&gt; statement<br>
&gt; SQL statement &quot;SELECT &quot;_slcluster&quot;.alterTableDropTriggers(v_tab_row.tab_id)&quot;<br>
&gt; PL/pgSQL function unsubscribeset(integer,integer,boolean) line 49 at PERFORM<br>
&gt; &lt;stdin&gt;:4: PGRES_FATAL_ERROR lock table &quot;_slcluster&quot;.sl_event_lock,<br>
&gt; &quot;_slcluster&quot;.sl_config_lock;select &quot;_slcluster&quot;.unsubscribeSet(1,<br>
&gt; 2,false);  - ERROR:  out of shared memory<br>
&gt; HINT:  You might need to increase max_locks_per_transaction.<br>
&gt; CONTEXT:  SQL statement &quot;drop trigger &quot;_slcluster_logtrigger&quot; on<br>
&gt; &quot;8359_wsn&quot;.&quot;tbpgdas01502&quot;&quot;<br>
&gt; PL/pgSQL function altertabledroptriggers(integer) line 47 at EXECUTE<br>
&gt; statement<br>
&gt; SQL statement &quot;SELECT &quot;_slcluster&quot;.alterTableDropTriggers(v_tab_row.tab_id)&quot;<br>
&gt; PL/pgSQL function unsubscribeset(integer,integer,boolean) line 49 at PERFORM<br>
&gt; [postgres@00002-NfseNet-SGDB reimer]$ ^C<br>
&gt;<br>
&gt; max_locks_per_transaction is set to 255. Changed to 4096 and will<br>
&gt; restart the database during the night change window.<br>
&gt;<br>
&gt; Tried to repeat the process again and now I&#39;m getting always the same error:<br>
&gt; [postgres@00002-NfseNet-SGDB reimer]$ slonik &lt; <a href="http://unsubscribe2.sl" target="_blank">unsubscribe2.sl</a><br>
</span>&gt; &lt;<a href="http://unsubscribe2.sl" target="_blank">http://unsubscribe2.sl</a>&gt;<br>
<span class="">&gt; &lt;stdin&gt;:4: PGRES_FATAL_ERROR lock table &quot;_slcluster&quot;.sl_event_lock,<br>
&gt; &quot;_slcluster&quot;.sl_config_lock;select &quot;_slcluster&quot;.unsubscribeSet(1,<br>
&gt; 2,false);  - ERROR:  deadlock detected<br>
&gt; DETAIL:  Process 15366 waits for AccessExclusiveLock on relation 29564<br>
&gt; of database 16384; blocked by process 14994.<br>
&gt; Process 14994 waits for RowExclusiveLock on relation 84222 of database<br>
&gt; 16384; blocked by process 15366.<br>
&gt; HINT:  See server log for query details.<br>
&gt; CONTEXT:  SQL statement &quot;lock table &quot;7481_spunico&quot;.&quot;sincdc&quot; in access<br>
&gt; exclusive mode&quot;<br>
&gt; PL/pgSQL function altertabledroptriggers(integer) line 42 at EXECUTE<br>
&gt; statement<br>
&gt; SQL statement &quot;SELECT &quot;_slcluster&quot;.alterTableDropTriggers(v_tab_row.tab_id)&quot;<br>
&gt; PL/pgSQL function unsubscribeset(integer,integer,boolean) line 49 at PERFORM<br>
&gt; [postgres@00002-NfseNet-SGDB reimer]$<br>
&gt;<br>
&gt; The two pids reported by the deadlock message are probably temporary<br>
&gt; processed created by SLONY as I did not find them in the system.<br>
&gt;<br>
&gt; The increase in the max_locks_per_transactions and the server restart<br>
&gt; will fix this issue?<br>
&gt;<br>
<br>
<br>
</span>If you have 27,000 tables in your replication set then I think<br>
max_locks_per_transaction might needs to be at least that big.  The<br>
alterTableDropTriggers function  will take a lock on each table in the set.<br>
<br>
As for your deadlock you should figure out what process 15366 is<br>
Since this operation takes an exclusive lock on all tables in the set on<br>
the replica you probably don&#39;t want any other processes accessing those<br>
tables at that point in time.<br>
<span class=""><br>
<br>
<br>
<br>
<br>
&gt; Thank you!<br>
&gt;<br>
&gt; --<br>
&gt; Reimer<br>
&gt; 47-3347-1724 47-9183-0547 msn: <a href="mailto:carlos.reimer@opendb.com.br">carlos.reimer@opendb.com.br</a><br>
</span>&gt; &lt;mailto:<a href="mailto:carlos.reimer@opendb.com.br">carlos.reimer@opendb.com.br</a>&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Slony1-general mailing list<br>
&gt; <a href="mailto:Slony1-general@lists.slony.info">Slony1-general@lists.slony.info</a><br>
&gt; <a href="http://lists.slony.info/mailman/listinfo/slony1-general" target="_blank">http://lists.slony.info/mailman/listinfo/slony1-general</a><br>
&gt;<br>
<br>
_______________________________________________<br>
Slony1-general mailing list<br>
<a href="mailto:Slony1-general@lists.slony.info">Slony1-general@lists.slony.info</a><br>
<a href="http://lists.slony.info/mailman/listinfo/slony1-general" target="_blank">http://lists.slony.info/mailman/listinfo/slony1-general</a><br>
</blockquote></div><br clear="all"><br>-- <br><div class="gmail_signature">Reimer<br>47-3347-1724 47-9183-0547 msn: <a href="mailto:carlos.reimer@opendb.com.br">carlos.reimer@opendb.com.br</a><br></div>
</div>