From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Amit kapila <amit.kapila@huawei.com>
Cc: Fujii Masao <masao.fujii@gmail.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: BUG #7534: walreceiver takes long time to detect n/w breakdown
Date: Tue, 02 Oct 2012 11:26:24 +0300
Message-ID: <506AA530.30106@vmware.com> (raw)
In-Reply-To: <6C0B27F7206C9E4CA54AE035729E9C38285358F7@szxeml509-mbs>
References: <E1TBlX1-0003OA-SB@wrigleys.postgresql.org>
<CAHGQGwE+vpwh6JteEggpgk5Pq45w+-os5T9OQ5vGUhbO9L8iQw@mail.gmail.com>
<50515fcd.c32f320a.4297.ffffb186SMTPIN_ADDED@mx.google.com>
<CAHGQGwFhcg0BwOTNzWwk8cABOCKGwFdV9e=szJK+33PDFS8yUg@mail.gmail.com>
<6C0B27F7206C9E4CA54AE035729E9C382853264E@szxeml509-mbs>
<CAHGQGwGG=UxNOJX0V966CftRm4C_54XDfaR2TRzWXysFFQcJSw@mail.gmail.com>
<6C0B27F7206C9E4CA54AE035729E9C382853288B@szxeml509-mbs>
<CAHGQGwGWMOc-hKTyjjswzYLykAsA2+t+xpcybi6c+DkN+5dA+A@mail.gmail.com>
<5056cb6b.29f2440a.7bd9.1633SMTPIN_ADDED@mx.google.com>
<CAHGQGwG2cWJ+Fr+AroXEA3=26Yrc_C4yMW6HJ8rhX9nKm7Z0NA@mail.gmail.com>
<6C0B27F7206C9E4CA54AE035729E9C38285337FF@szxeml509-mbs>
<506972B9.6060104@vmware.com>
<6C0B27F7206C9E4CA54AE035729E9C38285358F7@szxeml509-mbs>
On 02.10.2012 10:36, Amit kapila wrote:
> On Monday, October 01, 2012 4:08 PM Heikki Linnakangas wrote:
>> So let's think how this should ideally work from a user's point of view.
>> I think there should be just two settings: walsender_timeout and
>> walreceiver_timeout. walsender_timeout specifies how long a walsender
>> will keep a connection open if it doesn't hear from the walreceiver, and
>> walreceiver_timeout is the same for walreceiver. The system should
>> figure out itself how often to send keepalive messages so that those
>> timeouts are not reached.
>
> By this it implies that we should remove wal_receiver_status_interval. Currently it is also used
> incase of reply message of data sent by sender which contains till what point receiver has flushed. So if we remove this variable
> receiver might start sending that message sonner than required.
> Is that okay behavior?
I guess we should keep that setting, then, so that you can get status
updates more often than would be required for heartbeat purposes.
>> In walsender, after half of walsender_timeout has elapsed and we haven't
>> received anything from the client, the walsender process should send a
>> "ping" message to the client. Whenever the client receives a Ping, it
>> replies. The walreceiver does the same; when half of walreceiver_timeout
>> has elapsed, send a Ping message to the server. Each Ping-Pong roundtrip
>> resets the timer in both ends, regardless of which side initiated it, so
>> if e.g walsender_timeout< walreceiver_timeout, the client will never
>> have to initiate a Ping message, because walsender will always reach the
>> walsender_timeout/2 point first and initiate the heartbeat message.
>
> Just to clarify, walsender should reset timer after it gets reply from receiver of the message it sent.
Right.
> walreceiver should reset timer after sending reply for heartbeat message.
> Similar to above timers will be reset when receiver sent the
heartbeat message.
walreceiver should reset the timer when it *receives* any message from
walsender. If it sends the reply right away, I guess that's the same
thing, but I'd phrase it so that it's the reception of a message from
the other end that resets the timer.
>> The Ping/Pong messages don't necessarily need to be new message types,
>> we can use the message types we currently have, perhaps with an
>> additional flag attached to them, to request the other side to reply
>> immediately.
>
> Can't we make the decision to send reply immediately based on message type, because these message types will be unique.
>
> To clarify my understanding,
> 1. the heartbeat message from walsender side will be keepalive message ('k') and from walreceiver side it will be Hot Standby feedback message ('h').
> 2. the reply message from walreceiver side will be current reply message ('r').
Yep. I wonder why need separate message types for Hot Standby Feedback
'h' and Reply 'r', though. Seems it would be simpler to have just one
messasge type that includes all the fields from both messages.
> 3. currently there is no reply kind of message from walsender, so do we need to introduce one new message for it or can use some existing message only?
> if new, do we need to send any additional information along with it, for existing messages can we use keepalive message it self as reply message but with an additional byte
> to indicate it is reply?
Hmm, I think I'd prefer to use the existing Keepalive message 'k', with
an additional flag.
- Heikki
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-bugs@postgresql.org
Cc: hlinnakangas@vmware.com, amit.kapila@huawei.com, masao.fujii@gmail.com, pgsql-hackers@postgresql.org
Subject: Re: BUG #7534: walreceiver takes long time to detect n/w breakdown
In-Reply-To: <506AA530.30106@vmware.com>
References: <E1TBlX1-0003OA-SB@wrigleys.postgresql.org> <CAHGQGwE+vpwh6JteEggpgk5Pq45w+-os5T9OQ5vGUhbO9L8iQw@mail.gmail.com> <50515fcd.c32f320a.4297.ffffb186SMTPIN_ADDED@mx.google.com> <CAHGQGwFhcg0BwOTNzWwk8cABOCKGwFdV9e=szJK+33PDFS8yUg@mail.gmail.com> <6C0B27F7206C9E4CA54AE035729E9C382853264E@szxeml509-mbs> <CAHGQGwGG=UxNOJX0V966CftRm4C_54XDfaR2TRzWXysFFQcJSw@mail.gmail.com> <6C0B27F7206C9E4CA54AE035729E9C382853288B@szxeml509-mbs> <CAHGQGwGWMOc-hKTyjjswzYLykAsA2+t+xpcybi6c+DkN+5dA+A@mail.gmail.com> <5056cb6b.29f2440a.7bd9.1633SMTPIN_ADDED@mx.google.com> <CAHGQGwG2cWJ+Fr+AroXEA3=26Yrc_C4yMW6HJ8rhX9nKm7Z0NA@mail.gmail.com> <6C0B27F7206C9E4CA54AE035729E9C38285337FF@szxeml509-mbs> <506972B9.6060104@vmware.com> <6C0B27F7206C9E4CA54AE035729E9C38285358F7@szxeml509-mbs> <506AA530.30106@vmware.com>
* 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