Hello.<div><br></div><div>Sorry for the delay. I&#39;ll correct what you said and I&#39;m going to write a document with implementation details.</div><div>But I need time, maybe a week or two.</div><div><br></div><div>Best regards,</div>
<div>Alexey Fedonin.<br><br><div class="gmail_quote">2013/2/10 Tatsuo Ishii <span dir="ltr">&lt;<a href="mailto:ishii@postgresql.org" target="_blank">ishii@postgresql.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im HOEnZb">On more thing. pcp/md.c and pcp/md5.h is a symlink to upper directory<br>
and shound not be included in the patch.<br>
</div><div class="HOEnZb"><div class="h5">--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
<br>
&gt; Thanks.<br>
&gt;<br>
&gt; I have tested a little bit your patches and now I would like to hear<br>
&gt; more details of implementation because your changes are big and hard<br>
&gt; to follow implementation details for me(especially<br>
&gt; pool_process_query.c).<br>
&gt;<br>
&gt; Also here are some requests:<br>
&gt;<br>
&gt; 1) please include doc changes. (i.e. doc/pgpool-en.html)<br>
&gt;<br>
&gt; 2) we do not use C++ style codings (we follow the PostgreSQL coding<br>
&gt;    style). So please do not use &#39;//&#39; comments. Also please do not<br>
&gt;    declare variable in the middle of blocks. I mean:<br>
&gt;<br>
&gt;    if (a &lt; b)<br>
&gt;    {<br>
&gt;               int d;<br>
&gt;<br>
&gt;               a = 1;<br>
&gt;               b = 2;<br>
&gt;               c = 3;<br>
&gt;               :<br>
&gt;               :<br>
&gt;       }<br>
&gt;<br>
&gt;       is ok but this is not ok:<br>
&gt;<br>
&gt;    if (a &lt; b)<br>
&gt;    {<br>
&gt;               a = 1;<br>
&gt;               b = 2;<br>
&gt;               int c  = 3;<br>
&gt;               :<br>
&gt;               :<br>
&gt;       }<br>
&gt; --<br>
&gt; Tatsuo Ishii<br>
&gt; SRA OSS, Inc. Japan<br>
&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;<br>
&gt;&gt; Sure.<br>
&gt;&gt;<br>
&gt;&gt; Best regards,<br>
&gt;&gt; Alexey Fedonin.<br>
&gt;&gt;<br>
&gt;&gt; 2013/2/1 Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt; Alexey,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I tried to make a diff between current git repo master and you repo in<br>
&gt;&gt;&gt; github and found yoursis based on a little bit older version of<br>
&gt;&gt;&gt; repo. Can you please rebase it? Or even better, could you send diff<br>
&gt;&gt;&gt; against current git repo master?<br>
&gt;&gt;&gt; --<br>
&gt;&gt;&gt; Tatsuo Ishii<br>
&gt;&gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt; Hello, everyone!<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; I&#39;ve added new features and improvements to pgpool (for parallel mode)<br>
&gt;&gt;&gt; &gt; which I would like to contribute as well as get feedback from the<br>
&gt;&gt;&gt; community.<br>
&gt;&gt;&gt; &gt; Features:<br>
&gt;&gt;&gt; &gt;  - Transaction support added (for SELECT * FROM distributed_table);<br>
&gt;&gt;&gt; &gt;  - CURSORS support added (for distributed tables);<br>
&gt;&gt;&gt; &gt;  - Dynamic connections to System DB (optional);<br>
&gt;&gt;&gt; &gt;  - SELECT rewriting fixes (some improvements and some bugfixes).<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; 1) Transactions.<br>
&gt;&gt;&gt; &gt; When client sends &#39;BEGIN&#39; statement, pgpool child connects to another<br>
&gt;&gt;&gt; child<br>
&gt;&gt;&gt; &gt; and resend all client statements to it, except for &#39;SELECT ... FROM<br>
&gt;&gt;&gt; &gt; distributed_table&#39;, which executes in usual way. In this case, &#39;SELECT<br>
&gt;&gt;&gt; ...<br>
&gt;&gt;&gt; &gt; FROM distributed_table&#39; executes inside the same transaction block as<br>
&gt;&gt;&gt; well<br>
&gt;&gt;&gt; &gt; as other statements.<br>
&gt;&gt;&gt; &gt; The better way would be to use the same child&#39;s connections as it uses<br>
&gt;&gt;&gt; for<br>
&gt;&gt;&gt; &gt; non-distributed SELECTs, but I haven&#39;t found the means of doing it.<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; 2) Cursors.<br>
&gt;&gt;&gt; &gt; For example, we have two nodes and distributed table:<br>
&gt;&gt;&gt; &gt;  Node 0             Node 1<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;  value              value<br>
&gt;&gt;&gt; &gt; -------            -------<br>
&gt;&gt;&gt; &gt;  4                  3<br>
&gt;&gt;&gt; &gt;  6                  1<br>
&gt;&gt;&gt; &gt;  8                  7<br>
&gt;&gt;&gt; &gt;  2                  9<br>
&gt;&gt;&gt; &gt;  0                  5<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;  a. BEGIN;<br>
&gt;&gt;&gt; &gt;  b. DECLARE cursor_name CURSOR FOR SELECT value FROM distributed_table<br>
&gt;&gt;&gt; &gt; ORDER BY value;<br>
&gt;&gt;&gt; &gt;  c. MOVE FORWARD 2 IN cursor_name;<br>
&gt;&gt;&gt; &gt;  d. FETCH FORWARD 3 IN cursor_name:<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;  value<br>
&gt;&gt;&gt; &gt; -------<br>
&gt;&gt;&gt; &gt;  2<br>
&gt;&gt;&gt; &gt;  3<br>
&gt;&gt;&gt; &gt;  4<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;  CURSORS work for FORWARD/BACKWARD ALL/(positive number).<br>
&gt;&gt;&gt; &gt;  Cursors work for any type of distribution, e.g. round-robin.<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;  3) Dynamic connections (optional).<br>
&gt;&gt;&gt; &gt;  If number of clients is not usually too high, it is not necessary to<br>
&gt;&gt;&gt; have<br>
&gt;&gt;&gt; &gt; connections to System DB for free childs.<br>
&gt;&gt;&gt; &gt;  New parameter &#39;system_db_dynamic_connection&#39; added to config.<br>
&gt;&gt;&gt; &gt;  If value of parameter is 0, child works as usual.<br>
&gt;&gt;&gt; &gt;  If value &gt; 0, child connects to System DB when client connects. Also,<br>
&gt;&gt;&gt; &gt; child without System DB connections sleeps for<br>
&gt;&gt;&gt; &gt; &#39;system_db_dynamic_connection&#39; mcs before accepting new client. So new<br>
&gt;&gt;&gt; &gt; client will be accepted by child, which already has connections to System<br>
&gt;&gt;&gt; &gt; DB.<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;  4) SELECT.<br>
&gt;&gt;&gt; &gt;  SELECT rewriting logic was changed a little, and now more complex<br>
&gt;&gt;&gt; queries<br>
&gt;&gt;&gt; &gt; work correctly, such as:<br>
&gt;&gt;&gt; &gt;   a. SELECT field_1, (SELECT field_2 FROM replicated_table WHERE<br>
&gt;&gt;&gt; &gt; field_3=S1.field_3) AS field_2 FROM distributed_table S1;<br>
&gt;&gt;&gt; &gt;   b. (SELECT field_1, (SELECT field_2 FROM replicated_table_1) AS field_2<br>
&gt;&gt;&gt; &gt; FROM distributed_table_1 S1) UNION ALL (SELECT field_1, (SELECT field_3<br>
&gt;&gt;&gt; &gt; FROM replicated_table_2) AS field_3 FROM distributed_table_2 S2) ORDER BY<br>
&gt;&gt;&gt; &gt; field_1;<br>
&gt;&gt;&gt; &gt;   c. Also, &#39;ORDER BY + LIMIT + OFFSET&#39; optimization added:<br>
&gt;&gt;&gt; &gt; SELECT field FROM distributed_table ORDER BY field LIMIT 10 OFFSET 100;<br>
&gt;&gt;&gt; &gt; rewrites into:<br>
&gt;&gt;&gt; &gt; SELECT &quot;pool_c$1&quot; AS field FROM dblink(&#39;host=localhost.localdomain<br>
&gt;&gt;&gt; &gt; dbname=dbname port=9999 user=username&#39;,&#39;SELECT pool_parallel(&quot;SELECT<br>
&gt;&gt;&gt; &gt; distributed_table.time FROM distributed_table ORDER BY field LIMIT 10 +<br>
&gt;&gt;&gt; &gt; 100&quot;)&#39;,false) AS pool_t$0(&quot;pool_c$1&quot; field_type) ORDER BY &quot;pool_c$1&quot;<br>
&gt;&gt;&gt; OFFSET<br>
&gt;&gt;&gt; &gt; 100 LIMIT 10;<br>
&gt;&gt;&gt; &gt;   d. some bugfixes.<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; If you are interested in, I could explain each change in detail.<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; Source code is available at <a href="https://github.com/afedonin/repo-test.git" target="_blank">https://github.com/afedonin/repo-test.git</a><br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; P.S. All changes was made and tested for parallel_mode.<br>
&gt;&gt;&gt; &gt; P.P.S. I don&#39;t know pgpool as good as you, so I appreciate any feedback.<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; Best regards,<br>
&gt;&gt;&gt; &gt; Alexey Fedonin.<br>
&gt;&gt;&gt;<br>
</div></div><div class="HOEnZb"><div class="h5">&gt; _______________________________________________<br>
&gt; pgpool-hackers mailing list<br>
&gt; <a href="mailto:pgpool-hackers@pgpool.net">pgpool-hackers@pgpool.net</a><br>
&gt; <a href="http://www.pgpool.net/mailman/listinfo/pgpool-hackers" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-hackers</a><br>
</div></div></blockquote></div><br></div>