Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id C20BB1337BB4 for ; Tue, 15 Feb 2011 12:29:42 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 96143-05-2 for ; Tue, 15 Feb 2011 16:29:35 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail149056.authsmtp.com (outmail149056.authsmtp.com [62.13.149.56]) by mail.postgresql.org (Postfix) with ESMTP id C22BD1337B81 for ; Tue, 15 Feb 2011 12:29:33 -0400 (AST) Received: from mail-c194.authsmtp.com (mail-c194.authsmtp.com [62.13.128.121]) by punt10.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id p1FGTVqn095508; Tue, 15 Feb 2011 16:29:31 GMT Received: from [192.168.0.4] ([81.5.146.37]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2) with ESMTP id p1FGTTAT043821; Tue, 15 Feb 2011 16:29:29 GMT Subject: Re: Sync Rep for 2011CF1 From: Simon Riggs To: Jaime Casanova Cc: pgsql-hackers@postgresql.org In-Reply-To: References: <1295127631.3282.100.camel@ebony> Content-Type: text/plain; charset="UTF-8" Date: Tue, 15 Feb 2011 16:29:28 +0000 Message-ID: <1297787368.1747.21355.camel@ebony> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit X-Server-Quench: c3a48d68-3920-11e0-80b9-0022640b883e X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZOTQEd DAteCiN5VAwpPBRK HVkIKg5MJUcNSQVJ NksadBtFaQBba1xT HGQLWlVEUVt7W2p/ aAofZQRDZ1RPWwN0 U09WR1pVCwUmQR13 cXp6I31ycwZOen8+ YEdnVj4IXxV+fRJ7 SlNXHG8GeGZhPWAC WEAKfh5UcAFIeBtF OFh3VyZDAzANdhEY NiQQEgoKCH1kOSJe CjsANRocRlxDRGZl HjssRF1/ X-Authentic-SMTP: 61633235383639.1015:706 X-AuthFastPath: 0 (Was 255) X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201102/1408 X-Sequence-Number: 182197 On Tue, 2011-02-15 at 01:45 -0500, Jaime Casanova wrote: > On Sat, Jan 15, 2011 at 4:40 PM, Simon Riggs wrote: > > > > Here's the latest patch for sync rep. > > > > I was looking at this code and found something in SyncRepWaitOnQueue > we declare a timeout variable that is a long and another that is a > boolean (this last one in the else part of the "if > (!IsOnSyncRepQueue())"), and then use the boolean one as if it were > the long one OK, thanks. > + else > + { > + bool release = false; > + bool timeout = false; > + > + SpinLockAcquire(&queue->qlock); > + > + /* > + * Check the LSN on our queue and if its moved far enough then > + * remove us from the queue. First time through this is > + * unlikely to be far enough, yet is possible. Next time we are > + * woken we should be more lucky. > + */ > + if (XLByteLE(XactCommitLSN, queue->lsn)) > + release = true; > + else if (timeout > 0 && > + TimestampDifferenceExceeds(GetCurrentTransactionStopTimestamp(), > + now, > + timeout)) > + { > + release = true; > + timeout = true; > + } > > the other two things are on postgresql.conf.sample: > - we have two replication_timeout_client, obviously one of them should > be replication_timeout_server > - synchronous_replication_feedback is off by default, but docs says otherwise > > i also have been testing this, until now the only issue i have found > is that if i set allow_standalone_primary to off and there isn't a > standby connected i need to stop the server with -m immediate which is > at least surprising I think that code is being ripped out, so will check again later. -- Simon Riggs http://www.2ndQuadrant.com/books/ PostgreSQL Development, 24x7 Support, Training and Services