<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 490: message missing in handle_response</title><link>https://sourceforge.net/p/postgres-xc/bugs/490/</link><description>Recent changes to 490: message missing in handle_response</description><atom:link href="https://sourceforge.net/p/postgres-xc/bugs/490/feed.rss" rel="self"/><language>en</language><lastBuildDate>Fri, 26 Sep 2014 03:04:37 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/postgres-xc/bugs/490/feed.rss" rel="self" type="application/rss+xml"/><item><title>#490 message missing in handle_response</title><link>https://sourceforge.net/p/postgres-xc/bugs/490/?limit=25#518f/04d9/b2b4/8d9d</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks for your explanation, I will do as you say&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">peace zone</dc:creator><pubDate>Fri, 26 Sep 2014 03:04:37 -0000</pubDate><guid>https://sourceforge.netbc5755ccbf2794d28abee2338d7fd89ca6fff0d1</guid></item><item><title>#490 message missing in handle_response</title><link>https://sourceforge.net/p/postgres-xc/bugs/490/?limit=25#518f/04d9</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks for your response!&lt;br /&gt;
1. I found this condition during doing the make check.&lt;br /&gt;
2. Do we have a plan to adding this feature?&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">peace zone</dc:creator><pubDate>Fri, 26 Sep 2014 02:29:56 -0000</pubDate><guid>https://sourceforge.net7cfea48ed487262645b5d718ca2ac8e603a67cf9</guid></item><item><title>message missing in handle_response</title><link>https://sourceforge.net/p/postgres-xc/bugs/490/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;I execute a user define function and get two different results. Both the two results appear randomly, the result2 is expected.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Results&lt;br /&gt;
results1:&lt;br /&gt;
    postgres=# select trap_foreign_key(2);&lt;br /&gt;
    NOTICE:  caught foreign_key_violation&lt;br /&gt;
    ERROR:  failed to send COMMIT command to node&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;results2:&lt;br /&gt;
    postgres=# select trap_foreign_key(2);&lt;br /&gt;
    NOTICE:  caught foreign_key_violation&lt;br /&gt;
     trap_foreign_key &lt;br /&gt;
    ------------------&lt;br /&gt;
                    0&lt;br /&gt;
    (1 row)&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Object definition&lt;br /&gt;
CREATE TABLE master(f1 int primary key);&lt;br /&gt;
CREATE TABLE slave(f1 int references master deferrable);&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;CREATE FUNCTION trap_foreign_key(int) RETURNS INT AS $$&lt;br /&gt;
BEGIN&lt;br /&gt;
    begin -- start transaction&lt;br /&gt;
        insert into slave values($1);&lt;br /&gt;
    exception&lt;br /&gt;
        when foreign_key_violation then&lt;br /&gt;
            raise notice 'caught foreign_key_violation';&lt;br /&gt;
            return 0;&lt;br /&gt;
    end;&lt;br /&gt;
    return 1;&lt;br /&gt;
end$$ language plpgsql;&lt;/p&gt;
&lt;p&gt;select trap_foreign_key(2); – detects FK violation&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Debug output&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I add a elog in handle_reponse() of coordinator:&lt;/p&gt;
&lt;p&gt;msg_type = get_message(conn, &amp;amp;msg_len, &amp;amp;msg);&lt;br /&gt;
elog(WARNING, "Received message type: %c", msg_type);&lt;/p&gt;
&lt;p&gt;The debug output is in the attachment.&lt;br /&gt;
As the debug output shows, the result1 misses the N, Z messages from datanode.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Reason&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The reason is when the coordinator in justifing message buffer, &lt;br /&gt;
the datanode has not yet send the messages.The coordinator thinks &lt;br /&gt;
there is no message now, and return, the later messages from datanode is missed.&lt;/p&gt;
&lt;p&gt;The coordinator code:&lt;br /&gt;
if (!HAS_MESSAGE_BUFFERED(conn))&lt;br /&gt;
    return RESPONSE_EOF;&lt;/p&gt;
&lt;p&gt;The N,Z messages comes later than the check above.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">peace zone</dc:creator><pubDate>Mon, 22 Sep 2014 09:41:32 -0000</pubDate><guid>https://sourceforge.net032e195ead9703751d35cb76653883bdbda32606</guid></item></channel></rss>