pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
replication_timeout does not seem to be working
8+ messages / 4 participants
[nested] [flat]

* replication_timeout does not seem to be working
@ 2011-07-21 20:14 A J <s5aly@yahoo.com>
  2011-07-22 13:19 ` Re: replication_timeout does not seem to be working Fujii Masao <masao.fujii@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: A J @ 2011-07-21 20:14 UTC (permalink / raw)
  To: pgsql-admin

On 9.1, Beta3 I set the following on master
replication_timeout = 10s       # in milliseconds; 0 disables

With no slaves running, I expect a failure in about 10s. But any Insert just hangs. Any idea ?

Thanks.

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: replication_timeout does not seem to be working
  2011-07-21 20:14 replication_timeout does not seem to be working A J <s5aly@yahoo.com>
@ 2011-07-22 13:19 ` Fujii Masao <masao.fujii@gmail.com>
  2011-07-22 16:11   ` Re: replication_timeout does not seem to be working A J <s5aly@yahoo.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Fujii Masao @ 2011-07-22 13:19 UTC (permalink / raw)
  To: A J <s5aly@yahoo.com>; +Cc: pgsql-admin

On Fri, Jul 22, 2011 at 5:14 AM, A J <s5aly@yahoo.com> wrote:
> On 9.1, Beta3 I set the following on master
> replication_timeout = 10s       # in milliseconds; 0 disables
> With no slaves running, I expect a failure in about 10s. But any Insert just
> hangs. Any idea ?

If you set up synchronous replication but there is no standby server,
all the write transactions are blocked infinitely whether replication_timeout
is enabled or not. If you want to cause those transactions to end, you need
to disable synchronous replication by, for example, emptying
synchronous_standby_names or need to set up new standby.

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: replication_timeout does not seem to be working
  2011-07-21 20:14 replication_timeout does not seem to be working A J <s5aly@yahoo.com>
  2011-07-22 13:19 ` Re: replication_timeout does not seem to be working Fujii Masao <masao.fujii@gmail.com>
@ 2011-07-22 16:11   ` A J <s5aly@yahoo.com>
  2011-07-25 02:24     ` Re: replication_timeout does not seem to be working Fujii Masao <masao.fujii@gmail.com>
  2011-07-27 06:47     ` Re: replication_timeout does not seem to be working Greg Smith <greg@2ndQuadrant.com>
  0 siblings, 2 replies; 8+ messages in thread

From: A J @ 2011-07-22 16:11 UTC (permalink / raw)
  To: Fujii Masao <masao.fujii@gmail.com>; +Cc: pgsql-admin

I am still not clear. Can you explain what replication_timeout parameter accomplishes and when ?

Basically I wish my synchronous write transaction to not wait indefinitely when the synchronous standby servers are not available. But rather a response returned back to client that write could not be successful, after trying for 'n' seconds. How can that be accomplished ?

Thanks.




________________________________
From: Fujii Masao <masao.fujii@gmail.com>
To: A J <s5aly@yahoo.com>
Cc: PG Admin <pgsql-admin@postgresql.org>
Sent: Friday, July 22, 2011 9:19 AM
Subject: Re: [ADMIN] replication_timeout does not seem to be working

On Fri, Jul 22, 2011 at 5:14 AM, A J <s5aly@yahoo.com> wrote:
> On 9.1, Beta3 I set the following on master
> replication_timeout = 10s       # in milliseconds; 0 disables
> With no slaves running, I expect a failure in about 10s. But any Insert just
> hangs. Any idea ?

If you set up synchronous replication but there is no standby server,
all the write transactions are blocked infinitely whether replication_timeout
is enabled or not. If you want to cause those transactions to end, you need
to disable synchronous replication by, for example, emptying
synchronous_standby_names or need to set up new standby.

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: replication_timeout does not seem to be working
  2011-07-21 20:14 replication_timeout does not seem to be working A J <s5aly@yahoo.com>
  2011-07-22 13:19 ` Re: replication_timeout does not seem to be working Fujii Masao <masao.fujii@gmail.com>
  2011-07-22 16:11   ` Re: replication_timeout does not seem to be working A J <s5aly@yahoo.com>
@ 2011-07-25 02:24     ` Fujii Masao <masao.fujii@gmail.com>
  2011-08-23 08:49       ` Re: replication_timeout does not seem to be working alexondi <alexondi@rambler.ru>
  1 sibling, 1 reply; 8+ messages in thread

From: Fujii Masao @ 2011-07-25 02:24 UTC (permalink / raw)
  To: A J <s5aly@yahoo.com>; +Cc: pgsql-admin

On Sat, Jul 23, 2011 at 1:11 AM, A J <s5aly@yahoo.com> wrote:
> I am still not clear. Can you explain what replication_timeout parameter
> accomplishes and when ?

If no reply is returned from the standby in replication_timeout, the
master thinks
that the connected standby is inactive, and terminates the replication
connection.
This is useful for the master to detect a standby crash or network outage.

> Basically I wish my synchronous write transaction to not wait indefinitely
> when the synchronous standby servers are not available. But rather a
> response returned back to client that write could not be successful, after
> trying for 'n' seconds. How can that be accomplished ?

There is no parameter for that purpose. You would need to implement
something like the monitor daemon which disable synchronous replication
when it detects a standby crash or network outage.

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: replication_timeout does not seem to be working
  2011-07-21 20:14 replication_timeout does not seem to be working A J <s5aly@yahoo.com>
  2011-07-22 13:19 ` Re: replication_timeout does not seem to be working Fujii Masao <masao.fujii@gmail.com>
  2011-07-22 16:11   ` Re: replication_timeout does not seem to be working A J <s5aly@yahoo.com>
  2011-07-25 02:24     ` Re: replication_timeout does not seem to be working Fujii Masao <masao.fujii@gmail.com>
@ 2011-08-23 08:49       ` alexondi <alexondi@rambler.ru>
  2011-08-24 04:22         ` Re: replication_timeout does not seem to be working Fujii Masao <masao.fujii@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: alexondi @ 2011-08-23 08:49 UTC (permalink / raw)
  To: pgsql-admin

>If no reply is returned from the standby in replication_timeout, the master
thinks
>that the connected standby is inactive, and terminates the replication
connection.
>This is useful for the master to detect a standby crash or network outage. 

After that master commit current transaction with "local" synchronous_commit
or rollback?

And why I setup this parameter replication_timeout = 2s and my wal's thread
(on master and server are restarted within 2s)?

--
View this message in context: http://postgresql.1045698.n5.nabble.com/replication-timeout-does-not-seem-to-be-working-tp4620827p47...
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: replication_timeout does not seem to be working
  2011-07-21 20:14 replication_timeout does not seem to be working A J <s5aly@yahoo.com>
  2011-07-22 13:19 ` Re: replication_timeout does not seem to be working Fujii Masao <masao.fujii@gmail.com>
  2011-07-22 16:11   ` Re: replication_timeout does not seem to be working A J <s5aly@yahoo.com>
  2011-07-25 02:24     ` Re: replication_timeout does not seem to be working Fujii Masao <masao.fujii@gmail.com>
  2011-08-23 08:49       ` Re: replication_timeout does not seem to be working alexondi <alexondi@rambler.ru>
@ 2011-08-24 04:22         ` Fujii Masao <masao.fujii@gmail.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Fujii Masao @ 2011-08-24 04:22 UTC (permalink / raw)
  To: alexondi <alexondi@rambler.ru>; +Cc: pgsql-admin

On Tue, Aug 23, 2011 at 5:49 PM, alexondi <alexondi@rambler.ru> wrote:
>>If no reply is returned from the standby in replication_timeout, the master
> thinks
>>that the connected standby is inactive, and terminates the replication
> connection.
>>This is useful for the master to detect a standby crash or network outage.
>
> After that master commit current transaction with "local" synchronous_commit
> or rollback?

Even after the timeout terminates replication connection, a transaction on the
master waits for its WAL to be replicated to at least one standby. If you want
to finish such a transaction, you have to disable synchronous replication (by
changing synchronous_commit or synchronous_standby_names), or start new
standby and wait for WAL to be replicated to that new standby.

> And why I setup this parameter replication_timeout = 2s and my wal's thread
> (on master and server are restarted within 2s)?

You are asking whether the master and standby are automatically restarted
within 2s after they crash? If so, No.

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: replication_timeout does not seem to be working
  2011-07-21 20:14 replication_timeout does not seem to be working A J <s5aly@yahoo.com>
  2011-07-22 13:19 ` Re: replication_timeout does not seem to be working Fujii Masao <masao.fujii@gmail.com>
  2011-07-22 16:11   ` Re: replication_timeout does not seem to be working A J <s5aly@yahoo.com>
@ 2011-07-27 06:47     ` Greg Smith <greg@2ndQuadrant.com>
  2011-07-27 09:16       ` Re: replication_timeout does not seem to be working Fujii Masao <masao.fujii@gmail.com>
  1 sibling, 1 reply; 8+ messages in thread

From: Greg Smith @ 2011-07-27 06:47 UTC (permalink / raw)
  To: pgsql-admin

On 07/22/2011 12:11 PM, A J wrote:
> Basically I wish my synchronous write transaction to not wait 
> indefinitely when the synchronous standby servers are not available. 
> But rather a response returned back to client that write could not be 
> successful, after trying for 'n' seconds. How can that be accomplished ?

You might be able to get what you want here by setting statement_timeout 
to 'n' seconds when doing a write transaction.

-- 
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: replication_timeout does not seem to be working
  2011-07-21 20:14 replication_timeout does not seem to be working A J <s5aly@yahoo.com>
  2011-07-22 13:19 ` Re: replication_timeout does not seem to be working Fujii Masao <masao.fujii@gmail.com>
  2011-07-22 16:11   ` Re: replication_timeout does not seem to be working A J <s5aly@yahoo.com>
  2011-07-27 06:47     ` Re: replication_timeout does not seem to be working Greg Smith <greg@2ndQuadrant.com>
@ 2011-07-27 09:16       ` Fujii Masao <masao.fujii@gmail.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Fujii Masao @ 2011-07-27 09:16 UTC (permalink / raw)
  To: Greg Smith <greg@2ndquadrant.com>; +Cc: pgsql-admin

On Wed, Jul 27, 2011 at 3:47 PM, Greg Smith <greg@2ndquadrant.com> wrote:
> On 07/22/2011 12:11 PM, A J wrote:
>
> Basically I wish my synchronous write transaction to not wait indefinitely
> when the synchronous standby servers are not available. But rather a
> response returned back to client that write could not be successful, after
> trying for 'n' seconds. How can that be accomplished ?
>
> You might be able to get what you want here by setting statement_timeout to
> 'n' seconds when doing a write transaction.

No. statement_timeout cannot cancel the transaction whose commit record has
already been written to local disk.

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center



^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2011-08-24 04:22 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-07-21 20:14 replication_timeout does not seem to be working A J <s5aly@yahoo.com>
2011-07-22 13:19 ` Fujii Masao <masao.fujii@gmail.com>
2011-07-22 16:11   ` A J <s5aly@yahoo.com>
2011-07-25 02:24     ` Fujii Masao <masao.fujii@gmail.com>
2011-08-23 08:49       ` alexondi <alexondi@rambler.ru>
2011-08-24 04:22         ` Fujii Masao <masao.fujii@gmail.com>
2011-07-27 06:47     ` Greg Smith <greg@2ndQuadrant.com>
2011-07-27 09:16       ` Fujii Masao <masao.fujii@gmail.com>

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