<div dir="ltr">Oh sure, thank you very much for helping here!<div><br></div><div>Table definition:</div><div><br></div><div><font face="courier new, monospace">CREATE TABLE my_table (<br></font></div><div><font face="courier new, monospace">    id BIGINT NOT NULL, </font></div>


<div><font face="courier new, monospace">    character_id BIGINT NOT NULL, </font></div><div><font face="courier new, monospace">    </font><span style="font-family:&#39;courier new&#39;,monospace;font-size:13px">my_col_one</span><font face="courier new, monospace"> BOOLEAN NOT NULL, </font></div>


<div><font face="courier new, monospace">    </font><span style="font-family:&#39;courier new&#39;,monospace;font-size:13px">my_col_two</span><font face="courier new, monospace"> INTEGER NOT NULL, </font></div><div><font face="courier new, monospace">    quality INTEGER NOT NULL, </font></div>


<div><font face="courier new, monospace">    properties BYTEA, </font></div><div><font face="courier new, monospace">    PRIMARY KEY (id)</font></div><div><font face="courier new, monospace">);</font></div><div><br></div>


dist_def for this table:<div><br></div><div><div><font face="courier new, monospace">INSERT INTO pgpool_catalog.dist_def VALUES (</font></div><div><font face="courier new, monospace">    &#39;my_db&#39;,</font></div><div>

<font face="courier new, monospace">    &#39;public&#39;,</font></div>
<div><font face="courier new, monospace">    &#39;my_table&#39;,</font></div><div><font face="courier new, monospace">    &#39;character_id&#39;,</font></div><div><font face="courier new, monospace">    ARRAY[&#39;id&#39;, &#39;character_id&#39;, &#39;</font><span style="font-family:&#39;courier new&#39;,monospace;font-size:13px">my_col_one</span><font face="courier new, monospace">&#39;, &#39;</font><span style="font-family:&#39;courier new&#39;,monospace;font-size:13px">my_col_two</span><font face="courier new, monospace">&#39;, &#39;quality&#39;, &#39;properties&#39;],</font></div>


<div><font face="courier new, monospace">    ARRAY[&#39;bigint&#39;, &#39;bigint&#39;, &#39;boolean&#39;, &#39;integer&#39;, &#39;integer&#39;, &#39;bytea&#39;],</font></div><div><font face="courier new, monospace">    &#39;pgpool_catalog.dist_def_demo&#39;</font></div>


<div><font face="courier new, monospace">);</font></div><div><div><font face="courier new, monospace">CREATE OR REPLACE FUNCTION pgpool_catalog.dist_def_demo(anyelement)</font></div><div><font face="courier new, monospace">RETURNS integer AS $$</font></div>


<div><font face="courier new, monospace">    SELECT CASE WHEN $1 % 2 = 0 THEN 0</font></div><div><font face="courier new, monospace">        ELSE 1</font></div><div><font face="courier new, monospace">    END;</font></div>


<div><font face="courier new, monospace">$$ LANGUAGE sql;</font></div></div><div><br></div><div>There&#39;re also some other irrelevant definitions in dist_def and replicate_def, but they have nothing to do with this table at all (no foreign key, no constraints, etc.). Please let me know if you need the full file. :)</div>


</div><div><br></div><div><br></div><div>BR,</div><div>Fantix</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 15, 2013 at 1:33 PM, Yugo Nagata <span dir="ltr">&lt;<a href="mailto:nagata@sraoss.co.jp" target="_blank">nagata@sraoss.co.jp</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Thanks for your reporting and analyzing. I&#39;ll handle the problem. However, it may<br>
take some time for me to resoleve sinse I have other issues now.<br>
<br>
For analysis, could you please tell me the definition of table &quot;my_table&quot;,<br>
and contents of dist_def, replicate_def ?<br>
<div><div><br>
On Mon, 14 Oct 2013 20:08:07 +0800<br>
Fantix King &lt;<a href="mailto:fantix.king@gmail.com" target="_blank">fantix.king@gmail.com</a>&gt; wrote:<br>
<br>
&gt; Hi,<br>
&gt;<br>
&gt; I met a pretty weird issue in our production use of pgpool-II 3.3.1.<br>
&gt; Executing SELECT through pgpool on some certain rows of a dist_def-ed table<br>
&gt; always hang - you have to kill the &quot;psql&quot;.<br>
&gt;<br>
&gt; It keeps reproducing in our production system while I cannot find a similar<br>
&gt; report anywhere else. I&#39;m still trying to reproduce this issue individually.<br>
&gt;<br>
&gt; My setup is like this:<br>
&gt;<br>
&gt;  * 1 pgpool in parallel mode<br>
&gt;  * 2 PostgreSQL 9.1.9 backends<br>
&gt;  * 1 PostgreSQL 9.1.9 system db<br>
&gt;<br>
&gt; The table &quot;my_table&quot; is partitioned with &quot;character_id&quot; key column, where<br>
&gt; even number characters are on node #0, and odd number characters are on<br>
&gt; node #1. This query hangs:<br>
&gt;<br>
&gt; statement: SELECT <a href="http://my_table.id" target="_blank">my_table.id</a>, my_table.character_id, my_table.my_col_one,<br>
&gt; my_table.my_col_two, my_table.quality, my_table.properties FROM my_table<br>
&gt; WHERE  my_table.character_id = 100;<br>
&gt;<br>
&gt; I found that:<br>
&gt;<br>
&gt;  * All other hanging queries (the same table) are on node #0 - even numbers<br>
&gt;  * If I reduce any column from the SELECT list, the query works<br>
&gt;  * Not all of the queries are hanging, e.g. character_id = 102 works fine<br>
&gt;<br>
&gt; Then I diff-ed the pgpool log querying row 100(-) and 102(+):<br>
&gt;<br>
&gt;   1  : ProcessFrontendResponse: kind from frontend Q(51)<br>
&gt;   2  : pool_unset_doing_extended_query_message: done<br>
&gt;   3 -: statement: SELECT <a href="http://my_table.id" target="_blank">my_table.id</a>, my_table.character_id,<br>
&gt; my_table.my_col_one, my_table.my_col_two, my_table.quality,<br>
&gt; my_table.properties FROM my_table WHERE  my_table.character_id = 100;<br>
&gt;   4  : pool_set_query_in_progress: done<br>
&gt;   5  : initSelectStmt: ANALYZE now(0)<br>
&gt;   6  : inside build_range_info num= 1 current_select=0<br>
&gt;   7  : inside build_range_info dist 0<br>
&gt;   8  : inside build_virtual_info dist state=P  my_table<br>
&gt;   9  : append_virtual_table select=0,<br>
&gt; no=0,col=id,type=bigint,table=my_table,state=P,valid=-1<br>
&gt;  10  : append_virtual_table select=0,<br>
&gt; no=1,col=character_id,type=bigint,table=my_table,state=P,valid=-1<br>
&gt;  11  : append_virtual_table select=0,<br>
&gt; no=2,col=my_col_one,type=boolean,table=my_table,state=P,valid=-1<br>
&gt;  12  : append_virtual_table select=0,<br>
&gt; no=3,col=my_col_two,type=integer,table=my_table,state=P,valid=-1<br>
&gt;  13  : append_virtual_table select=0,<br>
&gt; no=4,col=quality,type=integer,table=my_table,state=P,valid=-1<br>
&gt;  14  : append_virtual_table select=0,<br>
&gt; no=5,col=properties,type=bytea,table=my_table,state=P,valid=-1<br>
&gt; ...<br>
&gt;  17  : pool_parallel_query:  0 th FD_SET: 19<br>
&gt;  18  : pool_parallel_query:  1 th FD_SET: 21<br>
&gt;  19  : pool_parallel_query: num_fds: 22<br>
&gt;  20  : read_kind_from_one_backend: read kind from 0 th backend T<br>
&gt;  21  : pool_parallel_exec: kind from backend: T<br>
&gt;  22  : pool_parallel_exec: dummy from backend: C<br>
&gt;  23 +: pool_parallel_query:  1 th FD_SET: 21<br>
&gt;  24 +: pool_parallel_query: num_fds: 22<br>
&gt;  25  : read_kind_from_one_backend: read kind from 1 th backend T<br>
&gt;  26  : pool_parallel_exec: dummy kind from backend: T<br>
&gt;  27 -: pool_parallel_exec: kind from backend: D 3<br>
&gt;  28 +: pool_parallel_exec: kind from backend: D 4<br>
&gt;  29  : pool_parallel_exec: kind from backend: C<br>
&gt;  30  : pool_unset_query_in_progress: done<br>
&gt;  31  : pool_unset_query_in_progress: done<br>
</div></div>&gt; * 32 -: pool_process_query: discard Z packet from backend 1*<br>
<div><div>&gt;  33 -: detect_error: kind: Z<br>
&gt;  34 -: detect_error: kind: Z<br>
&gt;  35 -: detect_error: kind: Z<br>
&gt;  36  : read_kind_from_backend: kind: Z from 0 th backend<br>
&gt;  37  : read_kind_from_backend: read kind from 0 th backend Z NUM_BACKENDS: 2<br>
&gt;  38 +: read_kind_from_backend: kind: Z from 1 th backend<br>
&gt;  39 +: read_kind_from_backend: read kind from 1 th backend Z NUM_BACKENDS: 2<br>
&gt;  40 +: ProcessBackendResponse: kind from backend: Z<br>
&gt;  41 +: pool_read_message_length: slot: 0 length: 5<br>
&gt;  42 +: pool_read_message_length: slot: 1 length: 5<br>
&gt;  43 +: ReadyForQuery: transaction state:I<br>
&gt;  44 +: ReadyForQuery: transaction state:I<br>
&gt;  45 +: ProcessBackendResponse: Ready For Query<br>
&gt;<br>
&gt; FYI some of the pgpool.conf:<br>
&gt;<br>
&gt; backend_weight0 = 1<br>
&gt; backend_weight1 = 1<br>
&gt; load_balance_mode = on<br>
&gt; replication_mode = on<br>
&gt; parallel_mode = on<br>
&gt;<br>
&gt; Please advice or let me know if I&#39;m missing any info, thank you!<br>
&gt;<br>
&gt;<br>
&gt; BR,<br>
&gt; Fantix<br>
<br>
<br>
</div></div><span><font color="#888888">--<br>
Yugo Nagata &lt;<a href="mailto:nagata@sraoss.co.jp" target="_blank">nagata@sraoss.co.jp</a>&gt;<br>
</font></span></blockquote></div><br></div></div>