pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
To: pgsql-hackers@postgresql.org
Subject: Wrong defeinition of pq_putmessage_noblock since 9.5
Date: Thu, 28 Jul 2016 18:52:28 +0900 (Tokyo Standard Time)
Message-ID: <20160728.185228.58375982.horiguchi.kyotaro@lab.ntt.co.jp> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Hello,

While testing replication for 9.5, we found that repl-master can
ignore wal_sender_timeout and seemingly waits for TCP
retransmission timeout for the case of sudden power-off of a
standby.

My investigation told me that the immediate cause could be that
secure_write() is called with *blocking mode* (that is,
port->noblock = false) under *pq_putmessage_noblock* macro called
from XLogSendPhysical().

libpq.h of 9.5 and newer defines it as the following,

> #define pq_putmessage(msgtype, s, len) \
> 	(PqCommMethods->putmessage(msgtype, s, len))
> #define pq_putmessage_noblock(msgtype, s, len) \
> 	(PqCommMethods->putmessage(msgtype, s, len))

which is apparently should be the following.

> #define pq_putmessage_noblock(msgtype, s, len) \
> 	(PqCommMethods->putmessage_noblock(msgtype, s, len))

The attached patch fixes it.

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

0001-Fix-the-defeinition-of-pq_putmessage_noblock-macro.patch (text/x-patch, 1.0K) download From b15db80734215b7e3b4bbae849cf89ffd990e8be Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp> Date: Thu, 28 Jul 2016 18:28:57 +0900 Subject: [PATCH] Fix the defeinition of pq_putmessage_noblock macro. pq_putmessage_noblock marcro is mistakenly defined as the same with pg_putmessage. Fix it. --- src/include/libpq/libpq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h index 547d3b8..18052cb 100644 --- a/src/include/libpq/libpq.h +++ b/src/include/libpq/libpq.h @@ -43,7 +43,7 @@ extern PGDLLIMPORT PQcommMethods *PqCommMethods; #define pq_putmessage(msgtype, s, len) \ (PqCommMethods->putmessage(msgtype, s, len)) #define pq_putmessage_noblock(msgtype, s, len) \ - (PqCommMethods->putmessage(msgtype, s, len)) + (PqCommMethods->putmessage_noblock(msgtype, s, len)) #define pq_startcopyout() (PqCommMethods->startcopyout()) #define pq_endcopyout(errorAbort) (PqCommMethods->endcopyout(errorAbort)) -- 1.8.3.1

view thread (12+ messages)  latest in thread

Message-ID: <20160728.185228.58375982.horiguchi.kyotaro@lab.ntt.co.jp>
Permalink:  ../20160728.185228.58375982.horiguchi.kyotaro@lab.ntt.co.jp/
Also on:    postgresql.org/message-id/20160728.185228.58375982.horiguchi.kyotaro@lab.ntt.co.jp

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: horiguchi.kyotaro@lab.ntt.co.jp
  Subject: Re: Wrong defeinition of pq_putmessage_noblock since 9.5
  In-Reply-To: <20160728.185228.58375982.horiguchi.kyotaro@lab.ntt.co.jp>
  References: <20160728.185228.58375982.horiguchi.kyotaro@lab.ntt.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox