pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@2ndquadrant.com>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: Дмитрий Дегтярёв <degtyaryov@gmail.com>
Cc: postgres performance list <pgsql-performance@postgresql.org>
Subject: Re: Cpu usage 100% on slave. s_lock problem.
Date: Tue, 27 Aug 2013 17:55:56 +0200
Message-ID: <20130827155556.GA9061@awork2.anarazel.de> (raw)
In-Reply-To: <CAHyXU0z3BbK=-Qu342Nxr9EbLtASKWq7XH+9tyaq17MQd+YP0w@mail.gmail.com>
References: <CAFcrtwHH5r9x=w5_09HF2LCa4TEVOmjMOW5f=+p-Gc6k6joNzQ@mail.gmail.com>
	<CAHyXU0xAKkjRA03GXP71yqqqpdxepH5p5qZwddjPTOWQOkjoHQ@mail.gmail.com>
	<CAHyXU0wZZPDU5AfsnC_z_kg5LVLzC9cXr+T84N2n+u=GDxNi8w@mail.gmail.com>
	<CAHyXU0wavt2APZ89C7x9b3y-p-2trkdk6UpyQotiPXgPVKd_UQ@mail.gmail.com>
	<CAHyXU0z3BbK=-Qu342Nxr9EbLtASKWq7XH+9tyaq17MQd+YP0w@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

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



view thread (18+ messages)  latest in thread

Message-ID: <20130827155556.GA9061@awork2.anarazel.de>
Permalink:  ../20130827155556.GA9061@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20130827155556.GA9061@awork2.anarazel.de

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: andres@2ndquadrant.com, mmoncure@gmail.com, degtyaryov@gmail.com
  Subject: Re: Cpu usage 100% on slave. s_lock problem.
  In-Reply-To: <20130827155556.GA9061@awork2.anarazel.de>

* 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