Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VELch-0005ur-MC for pgsql-performance@arkaria.postgresql.org; Tue, 27 Aug 2013 15:56:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VELch-0008L3-0z for pgsql-performance@arkaria.postgresql.org; Tue, 27 Aug 2013 15:56:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VELce-0008Kb-Uw for pgsql-performance@postgresql.org; Tue, 27 Aug 2013 15:56:01 +0000 Received: from moutng.kundenserver.de ([212.227.126.187]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VELcc-0005qB-2i for pgsql-performance@postgresql.org; Tue, 27 Aug 2013 15:56:00 +0000 Received: from anarazel.de (p5DDC69EB.dip0.t-ipconnect.de [93.220.105.235]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0MbLRw-1VUm2j0Xa8-00J3kO; Tue, 27 Aug 2013 17:55:57 +0200 Received: by anarazel.de (Postfix, from userid 1000) id 6363F100C33; Tue, 27 Aug 2013 17:55:56 +0200 (CEST) Date: Tue, 27 Aug 2013 17:55:56 +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: <20130827155556.GA9061@awork2.anarazel.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Provags-ID: V02:K0:W6acEnXRWNG5hHg2rvwljel3H7naOLhcmR37l+eK3be OoxEa3isvNvu6QGkSo+mFZPhH+84XR9UvRjmyaFOhpzJNylagt lASIZ4UeTMsiHUwy3VUt99zAtmajoCN1HuGPMHzM/glExEASLj Ickj+BTzQSrz7FWPD2uhYAyesAyAKvi2tAI+OIvymMdoGqAFn7 uOJrG5TM4//eO9IRVlecLcVImk015BXQ88J7ihpyozbgocxXJ3 D0MoriLDS+8+ESoFSfBZDvC4QIRLJNDQQfH9K9pjNgsBDpbwi5 GuT5dboj8Grl5y4HXwushUKkSguK9YIWuh7+HBXPxEvFCvZPMp jbXHQvtSf/EFgA5Qdb0xBZvGudEaBIgmbaBJ1i9Tc 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 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. 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