<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Tatsuo,</p>
<p><br>
</p>
<p>we continue attempts to reproduce the problem in a self contained test.</p>
<p><br>
</p>
<p>BTW plese see the attached log file of pgpool. Probably it can help.</p>
<p><br>
</p>
<p><br>
</p>
<p><span style="font-size: 10pt;">Sergey.</span></p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block; width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Sergey Kim<br>
<b>Sent:</b> Thursday, March 16, 2017 11:31 AM<br>
<b>To:</b> Tatsuo Ishii<br>
<b>Cc:</b> pgpool-hackers@pgpool.net; Boris Voskanov<br>
<b>Subject:</b> Re: [pgpool-committers: 3836] pgpool: Branch refs/heads/bug271 was created</font>
<div>&nbsp;</div>
</div>
<div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi Tatsuo,</p>
<p><br>
</p>
<p>the verification failed again (((</p>
<p><br>
</p>
<p>Though test created tests could pass smoothly the system failed to start with error (<i style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><span style="font-size:11pt"><b><span style="color:rgb(255,0,0)">kind mismatch among backends.
 Possible last query was: &quot;select current_schema()&quot; kind details are: 0[Z] 1[1]</span></b></span></i>)&nbsp;which is detected in pgpool logs. Now we are fighting to create the artificial test.</p>
<p><br>
</p>
<p>See the pgpool logs:</p>
<p></p>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.401312&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25442-1] 2017-03-16 11:20:56: pid 1213:LOG: &nbsp;DB node id: 0 backend pid: 1708 statement: B message</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.401450&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25442-2] 2017-03-16 11:20:56: pid 1213:LOCATION: &nbsp;pool_proto_modules.c:3211</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.401586&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25443-1] 2017-03-16 11:20:56: pid 1213:LOG: &nbsp;DB node id: 0 backend pid: 1708 statement: Execute: SELECT typinput='array_in'::regproc, typtype &nbsp; FROM pg_catalog.pg_type
 &nbsp; LEFT &nbsp; JOIN (select ns.oid as nspoid, ns.nspname, r.r &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from pg_namespace as ns &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; join ( select s.r, (current_schemas(false))[s.r] as nspname &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;from generate_series(1, array_upper(current_schemas(false), 1)) as s(r) ) as
 r &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;using ( nspname ) &nbsp; &nbsp; &nbsp; &nbsp;) as sp &nbsp; &nbsp; ON sp.nspoid = typnamespace &nbsp;WHERE typname = $1 &nbsp;ORDER BY sp.r, pg_type.oid DESC LIMIT 1</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.402316&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25443-2] 2017-03-16 11:20:56: pid 1213:LOCATION: &nbsp;pool_proto_modules.c:3211</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.402462&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25444-1] 2017-03-16 11:20:56: pid 1213:LOG: &nbsp;DB node id: 0 backend pid: 1708 statement: B message</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.402608&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25444-2] 2017-03-16 11:20:56: pid 1213:LOCATION: &nbsp;pool_proto_modules.c:3211</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.402745&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25445-1] 2017-03-16 11:20:56: pid 1213:LOG: &nbsp;DB node id: 0 backend pid: 1708 statement: Execute: SELECT typinput='array_in'::regproc, typtype &nbsp; FROM pg_catalog.pg_type
 &nbsp; LEFT &nbsp; JOIN (select ns.oid as nspoid, ns.nspname, r.r &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from pg_namespace as ns &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; join ( select s.r, (current_schemas(false))[s.r] as nspname &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;from generate_series(1, array_upper(current_schemas(false), 1)) as s(r) ) as
 r &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;using ( nspname ) &nbsp; &nbsp; &nbsp; &nbsp;) as sp &nbsp; &nbsp; ON sp.nspoid = typnamespace &nbsp;WHERE typname = $1 &nbsp;ORDER BY sp.r, pg_type.oid DESC LIMIT 1</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.403474&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25445-2] 2017-03-16 11:20:56: pid 1213:LOCATION: &nbsp;pool_proto_modules.c:3211</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.403614&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25446-1] 2017-03-16 11:20:56: pid 1213:LOG: &nbsp;DB node id: 0 backend pid: 1708 statement: B message</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.403748&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25446-2] 2017-03-16 11:20:56: pid 1213:LOCATION: &nbsp;pool_proto_modules.c:3211</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.403884&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25447-1] 2017-03-16 11:20:56: pid 1213:LOG: &nbsp;DB node id: 0 backend pid: 1708 statement: Execute: SELECT typinput='array_in'::regproc, typtype &nbsp; FROM pg_catalog.pg_type
 &nbsp; LEFT &nbsp; JOIN (select ns.oid as nspoid, ns.nspname, r.r &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from pg_namespace as ns &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; join ( select s.r, (current_schemas(false))[s.r] as nspname &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;from generate_series(1, array_upper(current_schemas(false), 1)) as s(r) ) as
 r &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;using ( nspname ) &nbsp; &nbsp; &nbsp; &nbsp;) as sp &nbsp; &nbsp; ON sp.nspoid = typnamespace &nbsp;WHERE typname = $1 &nbsp;ORDER BY sp.r, pg_type.oid DESC LIMIT 1</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.404543&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25447-2] 2017-03-16 11:20:56: pid 1213:LOCATION: &nbsp;pool_proto_modules.c:3211</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.404612&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25448-1] 2017-03-16 11:20:56: pid 1213:LOG:
<span style="color:rgb(255,0,0)">&nbsp;DB node id: 1 backend pid: 12520 statement: Parse: select current_schema()</span></span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.404678&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25448-2] 2017-03-16 11:20:56: pid 1213:LOCATION: &nbsp;pool_proto_modules.c:3211</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.404736&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25449-1] 2017-03-16 11:20:56: pid 1213:LOG:
<span style="color:rgb(255,0,0)">&nbsp;DB node id: 0 backend pid: 1708 statement: Parse: select current_schema()</span></span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.404839&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25449-2] 2017-03-16 11:20:56: pid 1213:LOCATION: &nbsp;pool_proto_modules.c:3211</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.404899&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25450-1] 2017-03-16 11:20:56: pid 1213:LOG: &nbsp;DB node id: 0 backend pid: 1708 statement: B message</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.404957&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25450-2] 2017-03-16 11:20:56: pid 1213:LOCATION: &nbsp;pool_proto_modules.c:3211</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.405013&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25451-1] 2017-03-16 11:20:56: pid 1213:LOG: &nbsp;DB node id: 0 backend pid: 1708 statement: D message</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.405069&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25451-2] 2017-03-16 11:20:56: pid 1213:LOCATION: &nbsp;pool_proto_modules.c:3211</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.405144&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25452-1] 2017-03-16 11:20:56: pid 1213:LOG: &nbsp;DB node id: 0 backend pid: 1708 statement: Execute: select current_schema()</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.405219&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25452-2] 2017-03-16 11:20:56: pid 1213:LOCATION: &nbsp;pool_proto_modules.c:3211</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.405282&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25453-1] 2017-03-16 11:20:56: pid 1213:FATAL: &nbsp;failed to read kind from backend</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.405346&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25453-2] 2017-03-16 11:20:56: pid 1213:DETAIL: &nbsp;<b><span style="color:rgb(255,0,0)">kind mismatch among backends. Possible last query was: &quot;select current_schema()&quot;
 kind details are: 0[Z] 1[1]</span></b></span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.405400&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25453-3] 2017-03-16 11:20:56: pid 1213:HINT: &nbsp;check data consistency among db nodes</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.405483&#43;03:00 OAA-54999c4d7735 pgpool[1213]: [25453-4] 2017-03-16 11:20:56: pid 1213:LOCATION: &nbsp;pool_process_query.c:3731</span></i></div>
<div><i><span style="font-size:11pt">2017-03-16T11:20:56.405643&#43;03:00 OAA-54999c4d7735 pgpool[10877]: [22781-1] 2017-03-16 11:20:56: pid 10877:LOG: &nbsp;child process with pid: 1213 exits with status 512</span></i></div>
<div><br>
</div>
<br>
<p></p>
<br>
<span style="font-size:11pt">Sergey.</span><br>
<div style="color:rgb(0,0,0)">
<div>
<hr style="display:inline-block; width:98%" tabindex="-1">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Tatsuo Ishii &lt;ishii@sraoss.co.jp&gt;<br>
<b>Sent:</b> Thursday, March 16, 2017 8:29 AM<br>
<b>To:</b> Sergey Kim<br>
<b>Cc:</b> pgpool-hackers@pgpool.net; Boris Voskanov<br>
<b>Subject:</b> Re: [pgpool-committers: 3836] pgpool: Branch refs/heads/bug271 was created</font>
<div>&nbsp;</div>
</div>
</div>
<font size="2"><span style="font-size:10pt">
<div class="PlainText">Hi Sergey,<br>
<br>
Attached is a patch against master branch as usual.<br>
I also push the changes to the git repository.<br>
<br>
<a href="https://git.postgresql.org/gitweb/?p=pgpool2.git;a=shortlog;h=refs/heads/bug271" id="LPlnk855225" previewremoved="true">https://git.postgresql.org/gitweb/?p=pgpool2.git;a=shortlog;h=refs/heads/bug271</a><br>
<br>
When an INSERT is executed in a transaction, a &quot;writing_transaction&quot;<br>
is set. The flag is checked by a succeeding SELECT to decide if<br>
parse_before_bind (which resend the parse message to primary node if<br>
it is executed on the standby) needs to be executed.&nbsp; The flag is<br>
reset when a command complete message for BEGIN is arrived.&nbsp; Problem<br>
is, it is possible that the command complete message could arrive<br>
before the bind for the SELECT is executed, and at this point the flag<br>
is already cleared.<br>
<br>
Solution is, do not reset the flag when the command complete message<br>
arrives if in streaming replication mode.<br>
<br>
I tested using your tool and the test case #231 and #271 have been<br>
passed here.<br>
<br>
Best regards,<br>
--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" id="LPlnk880626" previewremoved="true">
http://www.sraoss.co.jp/index_en.php</a><br>
Japanese:http://www.sraoss.co.jp<br>
<br>
&gt; Tatsuo,<br>
&gt; <br>
&gt; I have updated the test tool:<br>
&gt; <br>
&gt; <br>
&gt; There is the 'target' folder in the attached tarball (and source codes). The folder contains jar file that implements tests for #231 &amp; #271&nbsp; issues.<br>
&gt; <br>
&gt; please run it as:<br>
&gt; # java -jar target/tests-1.0-SNAPSHOT-jar-with-dependencies.jar PGPOOL_HOST PGPOOL_PORT DB_NAME DB_USER DB_PASSWORD 271<br>
&gt; <br>
&gt; '271' here means the ID of the test to run, currently there are 2 IDs possible - 231 &amp; 271. Each test launched for 1000 times. This is the code level constant so far.<br>
&gt; <br>
&gt; For example launch for the test 271 on the HEAD of bug271 git branch ends with error:<br>
&gt; [skim@localhost pgpool]$ java -jar target/tests-1.0-SNAPSHOT-jar-with-dependencies.jar 10.28.64.176 5432 oss oss WfovD22ufP78Wq 271<br>
&gt; Test iteration '0'<br>
&gt; Test iteration '1'<br>
&gt; Exception in thread &quot;main&quot; java.lang.RuntimeException: Balanced<br>
&gt; at com.pgpool.tests.Issue271_SingleThread.runTest(Issue271_SingleThread.java:52)<br>
&gt; at com.pgpool.tests.TestStarter.main(TestStarter.java:44)<br>
&gt; [skim@localhost pgpool]$ echo $?<br>
&gt; 1<br>
&gt; <br>
&gt; And the following pgpool log is generated (syslog):<br>
&gt; <br>
&gt; 2017-03-14T20:44:09.859057&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129385-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 0 backend pid: 1513 statement: Parse: BEGIN<br>
&gt; 2017-03-14T20:44:09.859206&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129385-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.859385&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129386-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 1 backend pid: 28847 statement: Parse: BEGIN<br>
&gt; 2017-03-14T20:44:09.859558&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129386-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.859702&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129387-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 0 backend pid: 1513 statement: B message<br>
&gt; 2017-03-14T20:44:09.859856&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129387-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.860000&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129388-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 1 backend pid: 28847 statement: B message<br>
&gt; 2017-03-14T20:44:09.860158&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129388-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.860323&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129389-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 0 backend pid: 1513 statement: Execute: BEGIN<br>
&gt; 2017-03-14T20:44:09.860557&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129389-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.860778&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129390-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 1 backend pid: 28847 statement: Execute: BEGIN<br>
&gt; 2017-03-14T20:44:09.860992&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129390-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.861217&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129391-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 0 backend pid: 1513 statement: Parse: insert into write_table(id) values($1)<br>
&gt; 2017-03-14T20:44:09.861423&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129391-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.861686&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129392-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 0 backend pid: 1513 statement: B message<br>
&gt; 2017-03-14T20:44:09.861904&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129392-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.862148&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129393-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 0 backend pid: 1513 statement: D message<br>
&gt; 2017-03-14T20:44:09.862360&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129393-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.862592&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129394-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 0 backend pid: 1513 statement: Execute: insert into write_table(id) values($1)<br>
&gt; 2017-03-14T20:44:09.862826&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129394-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.863058&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129395-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 1 backend pid: 28847 statement: B message<br>
&gt; 2017-03-14T20:44:09.863306&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129395-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.863502&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129396-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 1 backend pid: 28847 statement: Execute: select id from write_table where id = $1<br>
&gt; 2017-03-14T20:44:09.863665&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129396-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.864601&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129397-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 1 backend pid: 28847 statement: ABORT<br>
&gt; 2017-03-14T20:44:09.864761&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129397-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.864914&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129398-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 0 backend pid: 1513 statement: ABORT<br>
&gt; 2017-03-14T20:44:09.865097&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129398-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.865322&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129399-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 0 backend pid: 1513 statement: DISCARD ALL<br>
&gt; 2017-03-14T20:44:09.865606&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129399-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.865844&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129400-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; DB node id: 1 backend pid: 28847 statement: DISCARD ALL<br>
&gt; 2017-03-14T20:44:09.866101&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129400-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T20:44:09.866976&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129401-1] 2017-03-14 20:44:09: pid 1041:LOG:&nbsp; child exiting, 1 connections reached<br>
&gt; 2017-03-14T20:44:09.867095&#43;03:00 OAA-54999c4d7735 pgpool[1041]: [129401-2] 2017-03-14 20:44:09: pid 1041:LOCATION:&nbsp; child.c:406<br>
&gt; <br>
&gt; <br>
&gt; If you wish I can put the source codes into some git repository.<br>
&gt; <br>
&gt; <br>
&gt; Sergey.<br>
&gt; ________________________________<br>
&gt; From: Sergey Kim<br>
&gt; Sent: Tuesday, March 14, 2017 4:19 PM<br>
&gt; To: Tatsuo Ishii<br>
&gt; Cc: pgpool-hackers@pgpool.net; Boris Voskanov<br>
&gt; Subject: Re: [pgpool-committers: 3836] pgpool: Branch refs/heads/bug271 was created<br>
&gt; <br>
&gt; <br>
&gt; Tatsuo,<br>
&gt; <br>
&gt; <br>
&gt; this time all previously created tests succeeded but out application failed to start. So we started searching for the problem and could reproduce &quot;balanced select problem&quot;. The test can run for minutes before reproduction of the problem (((<br>
&gt; <br>
&gt; I'm not sure if it can help but please pay attention that time lag between insert is select requests is very small.<br>
&gt; <br>
&gt; <br>
&gt; Please see the pgpool logs:<br>
&gt; <br>
&gt; 2017-03-14T16:06:37.889485&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [79-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 0 backend pid: 25885 statement: B message<br>
&gt; 2017-03-14T16:06:37.889702&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [79-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.889924&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [80-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 1 backend pid: 27691 statement: B message<br>
&gt; 2017-03-14T16:06:37.890090&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [80-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.890248&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [81-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 0 backend pid: 25885 statement: Execute: BEGIN<br>
&gt; 2017-03-14T16:06:37.890378&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [81-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.890535&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [82-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 1 backend pid: 27691 statement: Execute: BEGIN<br>
&gt; 2017-03-14T16:06:37.890693&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [82-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.890863&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [83-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 0 backend pid: 25885 statement: Parse: insert into write_table(id) values($1)<br>
&gt; 2017-03-14T16:06:37.891144&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [83-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.891390&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [84-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 0 backend pid: 25885 statement: B message<br>
&gt; 2017-03-14T16:06:37.891637&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [84-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.891895&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [85-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 0 backend pid: 25885 statement: D message<br>
&gt; 2017-03-14T16:06:37.892091&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [85-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.892272&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [86-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 0 backend pid: 25885 statement: Execute: insert into write_table(id) values($1)<br>
&gt; 2017-03-14T16:06:37.892442&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [86-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.892642&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [87-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 1 backend pid: 27691 statement: B message<br>
&gt; 2017-03-14T16:06:37.892828&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [87-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.892998&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [88-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 1 backend pid: 27691 statement: Execute: select id from write_table where id = $1<br>
&gt; 2017-03-14T16:06:37.893187&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [88-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.893359&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [89-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 1 backend pid: 27691 statement: ABORT<br>
&gt; 2017-03-14T16:06:37.893584&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [89-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.893839&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [90-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 0 backend pid: 25885 statement: ABORT<br>
&gt; 2017-03-14T16:06:37.894039&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [90-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.894220&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [91-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 0 backend pid: 25885 statement: DISCARD ALL<br>
&gt; 2017-03-14T16:06:37.894403&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [91-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.894587&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [92-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; DB node id: 1 backend pid: 27691 statement: DISCARD ALL<br>
&gt; 2017-03-14T16:06:37.894753&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [92-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; pool_proto_modules.c:3208<br>
&gt; 2017-03-14T16:06:37.894944&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [93-1] 2017-03-14 16:06:37: pid 25595:LOG:&nbsp; child exiting, 1 connections reached<br>
&gt; 2017-03-14T16:06:37.895079&#43;03:00 OAA-54999c4d7735 pgpool[25595]: [93-2] 2017-03-14 16:06:37: pid 25595:LOCATION:&nbsp; child.c:406<br>
&gt; 2017-03-14T16:06:37.895371&#43;03:00 OAA-54999c4d7735 pgpool[25566]: [47-1] 2017-03-14 16:06:37: pid 25566:LOG:&nbsp; child process with pid: 25595 exits with status 256<br>
&gt; 2017-03-14T16:06:37.895635&#43;03:00 OAA-54999c4d7735 pgpool[25566]: [47-2] 2017-03-14 16:06:37: pid 25566:LOCATION:&nbsp; pgpool_main.c:2380<br>
&gt; 2017-03-14T16:06:37.895943&#43;03:00 OAA-54999c4d7735 pgpool[25566]: [48-1] 2017-03-14 16:06:37: pid 25566:LOG:&nbsp; fork a new child process with pid: 25887<br>
&gt; 2017-03-14T16:06:37.896174&#43;03:00 OAA-54999c4d7735 pgpool[25566]: [48-2] 2017-03-14 16:06:37: pid 25566:LOCATION:&nbsp; pgpool_main.c:2466<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; And java client logs:<br>
&gt; 16:06:37.890 (2) simple execute, handler=org.postgresql.jdbc.PgStatement$StatementResultHandler@689604d9, maxRows=0, fetchSize=0, flags=1<br>
&gt; 16:06:37.890 (2)&nbsp; FE=&gt; Parse(stmt=null,query=&quot;BEGIN&quot;,oids={})<br>
&gt; 16:06:37.890 (2)&nbsp; FE=&gt; Bind(stmt=null,portal=null)<br>
&gt; 16:06:37.890 (2)&nbsp; FE=&gt; Execute(portal=null,limit=0)<br>
&gt; 16:06:37.890 (2)&nbsp; FE=&gt; Parse(stmt=null,query=&quot;insert into write_table(id) values($1)&quot;,oids={23})<br>
&gt; 16:06:37.890 (2)&nbsp; FE=&gt; Bind(stmt=null,portal=null,$1=&lt;-613120604&gt;)<br>
&gt; 16:06:37.890 (2)&nbsp; FE=&gt; Describe(portal=null)<br>
&gt; 16:06:37.890 (2)&nbsp; FE=&gt; Execute(portal=null,limit=0)<br>
&gt; 16:06:37.890 (2)&nbsp; FE=&gt; Sync<br>
&gt; 16:06:37.892 (2)&nbsp; &lt;=BE ParseComplete [null]<br>
&gt; 16:06:37.892 (2)&nbsp; &lt;=BE BindComplete [unnamed]<br>
&gt; 16:06:37.892 (2)&nbsp; &lt;=BE CommandStatus(BEGIN)<br>
&gt; 16:06:37.892 (2)&nbsp; &lt;=BE ParseComplete [null]<br>
&gt; 16:06:37.892 (2)&nbsp; &lt;=BE BindComplete [unnamed]<br>
&gt; 16:06:37.892 (2)&nbsp; &lt;=BE NoData<br>
&gt; 16:06:37.892 (2)&nbsp; &lt;=BE CommandStatus(INSERT 0 1)<br>
&gt; 16:06:37.893 (2)&nbsp; &lt;=BE ReadyForQuery(T)<br>
&gt; 16:06:37.893 (2) simple execute, handler=org.postgresql.jdbc.PgStatement$StatementResultHandler@18078bef, maxRows=0, fetchSize=0, flags=0<br>
&gt; 16:06:37.893 (2)&nbsp; FE=&gt; Bind(stmt=S_1,portal=null,$1=&lt;-613120604&gt;)<br>
&gt; 16:06:37.893 (2)&nbsp; FE=&gt; Execute(portal=null,limit=0)<br>
&gt; 16:06:37.893 (2)&nbsp; FE=&gt; Sync<br>
&gt; 16:06:37.895 (2)&nbsp; &lt;=BE BindComplete [unnamed]<br>
&gt; 16:06:37.895 (2)&nbsp; &lt;=BE CommandStatus(SELECT 0)<br>
&gt; 16:06:37.895 (2)&nbsp; &lt;=BE ReadyForQuery(T)<br>
&gt; 16:06:37.895 (2)&nbsp; FE=&gt; Terminate<br>
&gt; Exception in thread &quot;main&quot; java.lang.RuntimeException: Balanced<br>
&gt; at com.pgpool.tests.Issue271_SingleThread.runTest(Issue271_SingleThread.java:57)<br>
&gt; at com.pgpool.tests.TestStarter.main(TestStarter.java:37)<br>
&gt; <br>
&gt; <br>
&gt; The java test is attached:<br>
&gt; <br>
&gt; P/S:<br>
&gt; Pgpool was build from branch bug271:<br>
&gt; [root@OAA-54999c4d7735 pgpool2]# git log -2<br>
&gt; commit 0955a22fb7f30c5b9c1fabe2873c09246453ee50<br>
&gt; Author: Tatsuo Ishii &lt;ishii@postgresql.org&gt;<br>
&gt; Date:&nbsp;&nbsp; Tue Mar 14 19:03:02 2017 &#43;0900<br>
&gt; <br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; Fix problem described in [pgpool-hackers: 2125].<br>
&gt; <br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; Two problems are fixed:<br>
&gt; <br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; - The writing_transaction flag is not reset at transaction<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; committed/aborted. Before it was done in CommandComplete but now it<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is possible that we need to check the flag before a command complete<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; message arrives. So at Execute, it is taken care by<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; handle_query_context() which used to be a static function in<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CommandComplete.c. Also the session context memory is always cleared<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; before start a session context.<br>
&gt; <br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; - Ready for query Re-sync code path in read_kind_from_backend did not<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; work. The pending message corresponding to the ready for query<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; message could be a sync message, which does not have query<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; context. But before we checked if there's a query context<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exists. The check is bogus and removed.<br>
&gt; <br>
&gt; commit 7c955b2a2dfb77623055b5eae9afe041de3105ee<br>
&gt; Author: Tatsuo Ishii &lt;ishii@postgresql.org&gt;<br>
&gt; Date:&nbsp;&nbsp; Sun Mar 12 10:19:34 2017 &#43;0900<br>
&gt; <br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; Downgrade 1 more ereport from LOG to DEBUG1.<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; Sergey<br>
&gt; ________________________________<br>
&gt; From: Tatsuo Ishii &lt;ishii@sraoss.co.jp&gt;<br>
&gt; Sent: Tuesday, March 14, 2017 1:28 PM<br>
&gt; To: Sergey Kim<br>
&gt; Cc: pgpool-hackers@pgpool.net<br>
&gt; Subject: Re: [pgpool-committers: 3836] pgpool: Branch refs/heads/bug271 was created<br>
&gt; <br>
&gt; Hi Sergey,<br>
&gt; <br>
&gt; I have created a new branch named &quot;bug271&quot; which has been used to<br>
&gt; develop the patch for bug 271 on private git repository. Now you could<br>
&gt; use either the email attached patches or the branch if it's<br>
&gt; convieninet for you. The branch was created against the master<br>
&gt; branch. I will occasionaly rebase it with the master branch. In the<br>
&gt; near future the branch will be merged into the master branch (and I<br>
&gt; plan to back-patch it to 3.6 stable tree).<br>
&gt; <br>
&gt; Best regards,<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" id="LPlnk156334" previewremoved="true">
http://www.sraoss.co.jp/index_en.php</a><br>
&gt; Japanese:http://www.sraoss.co.jp<br>
&gt; <br>
&gt; From: pgpool-committers-bounces@pgpool.net<br>
&gt; Subject: [pgpool-committers: 3836] pgpool: Branch refs/heads/bug271 was created<br>
&gt; Date: Tue, 14 Mar 2017 10:19:33 &#43;0000<br>
&gt; Message-ID: &lt;E1cnjYD-0005zz-GZ@gothos.postgresql.org&gt;<br>
&gt; <br>
&gt;&gt; Branch refs/heads/bug271 was created.<br>
&gt;&gt;<br>
&gt;&gt; View: <a href="http://git.postgresql.org/gitweb?p=pgpool2.git;a=shortlog;h=refs/heads/bug271" id="LPlnk767581" previewremoved="true">
http://git.postgresql.org/gitweb?p=pgpool2.git;a=shortlog;h=refs/heads/bug271</a><br>
</div>
</span></font></div>
</div>
</div>
</div>
</div>
</body>
</html>