Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VPKfW-0002pK-2r for pgsql-performance@arkaria.postgresql.org; Thu, 26 Sep 2013 23:08:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VPKfV-0002eC-JU for pgsql-performance@arkaria.postgresql.org; Thu, 26 Sep 2013 23:08:21 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VPKfU-0002e6-MA for pgsql-performance@postgresql.org; Thu, 26 Sep 2013 23:08:20 +0000 Received: from moutng.kundenserver.de ([212.227.126.186]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VPKfN-0000ym-VI for pgsql-performance@postgresql.org; Thu, 26 Sep 2013 23:08:20 +0000 Received: from anarazel.de (p54AF4067.dip0.t-ipconnect.de [84.175.64.103]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0MLOsc-1VPsdC1jHu-000Zmr; Fri, 27 Sep 2013 01:08:12 +0200 Received: by anarazel.de (Postfix, from userid 1000) id AAB68101FD6; Fri, 27 Sep 2013 01:08:11 +0200 (CEST) Date: Fri, 27 Sep 2013 01:08:11 +0200 From: Andres Freund To: Merlin Moncure Cc: =?utf-8?B?0JTQvNC40YLRgNC40Lkg0JTQtdCz0YLRj9GA0ZHQsg==?= , postgres performance list Subject: Re: Cpu usage 100% on slave. s_lock problem. Message-ID: <20130926230811.GA29658@awork2.anarazel.de> References: <20130827155556.GA9061@awork2.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Provags-ID: V02:K0:N403HbgVFYeIJh6dikVt1dwtNB8c0ZbBjXSM9jEklHz Kai6pcQC8RSWW7K3t4KqnOzuz7LbTR/sv/TwqAeYBp3HPfZfoP uf9yJu28iVuKDRbEOFmkBbccP0wLjsRGayHtoue0CdG21nmLKo sQBoPpMKJDil0EvWpZj2/45GjF3UZBdWnspPzipZaiIelsOhQr fQAmTY2Y+qzsIMRrUBzzHnDrovBc24ws5W+LauOShNbzmE3ydw PU38x2WgG/P+LaXWqBMFH/21kqrj52hufQcKzAM42p6XvofQup 8SwzEvZ1aQ9i9CoRiz+ijmezFQ/vTgZEfN7kvwX5cRBVFjhmgZ O4WFU7R07bpZqN09XH4rSE5LHNyJlV5CkN1pK+OaJ X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 2013-08-27 12:17:55 -0500, Merlin Moncure wrote: > On Tue, Aug 27, 2013 at 10:55 AM, Andres Freund wrote: > > On 2013-08-27 09:57:38 -0500, Merlin Moncure wrote: > >> + bool > >> + RecoveryMightBeInProgress(void) > >> + { > >> + /* > >> + * We check shared state each time only until we leave recovery mode. We > >> + * can't re-enter recovery, so there's no need to keep checking after the > >> + * shared variable has once been seen false. > >> + */ > >> + if (!LocalRecoveryInProgress) > >> + return false; > >> + else > >> + { > >> + /* use volatile pointer to prevent code rearrangement */ > >> + volatile XLogCtlData *xlogctl = XLogCtl; > >> + > >> + /* Intentionally query xlogctl without spinlocking! */ > >> + LocalRecoveryInProgress = xlogctl->SharedRecoveryInProgress; > >> + > >> + return LocalRecoveryInProgress; > >> + } > >> + } > > > > I don't think it's acceptable to *set* LocalRecoveryInProgress > > here. That should only be done in the normal routine. > > quite right -- that was a major error -- you could bypass the > initialization call to the xlog with some bad luck. I've seen this in profiles since, so I'd appreciate pushing this forward. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance