pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: david@lang.hm
Cc: Scott Marlowe <scott.marlowe@gmail.com>
Cc: Matthew Dennis <mdennis@merfer.net>
Cc: Matthew Wakeling <matthew@flymine.org>
Cc: PostgreSQL Performance <pgsql-performance@postgresql.org>
Subject: Re: select on 22 GB table causes "An I/O error occured while sending to the backend." exception
Date: Thu, 28 Aug 2008 22:49:39 -0400
Message-ID: <20080829024939.GN8424@alvh.no-ip.org> (raw)
In-Reply-To: <alpine.DEB.1.10.0808281936090.2713@asgard.lang.hm>
References: <EADBB336-A14E-492C-A8CA-105C8F77A43A@blighty.com>
	<alpine.DEB.1.10.0808281702450.4454@aragorn.flymine.org>
	<48B6EA7E.2090707@emolecules.com>
	<alpine.DEB.1.10.0808282110140.4454@aragorn.flymine.org>
	<dcc563d10808281542u383808bci4874713a31bd1cc6@mail.gmail.com>
	<alpine.DEB.1.10.0808281602460.2713@asgard.lang.hm>
	<dcc563d10808281811t5c98dcaexd98c5cfe679f428d@mail.gmail.com>
	<e94d85500808281853g22f67274pc9b4c5e3b30bb05a@mail.gmail.com>
	<dcc563d10808281901w6d449f52t50e5da7938f1fb25@mail.gmail.com>
	<alpine.DEB.1.10.0808281936090.2713@asgard.lang.hm>

david@lang.hm escribió:
> On Thu, 28 Aug 2008, Scott Marlowe wrote:

>> scenario 1:  There's a postmaster, it owns all the child processes.
>> It gets killed.  The Postmaster gets restarted.  Since there isn't one
>
> when the postmaster gets killed doesn't that kill all it's children as  
> well?

Of course not.  The postmaster gets a SIGKILL, which is instant death.
There's no way to signal the children.  If they were killed too then
this wouldn't be much of a problem.

>> running, it comes up.  starts new child processes.  Meanwhile, the old
>> child processes that don't belong to it are busy writing to the data
>> store.  Instant corruption.
>
> if so then the postmaster should not only check if there is an existing  
> postmaster running, it should check for the presense of the child  
> processes as well.

See my other followup.  There's limited things it can check, but against
sysadmin stupidity there's no silver bullet.

> well, if you aren't going through the postmaster, what process is  
> recieving network messages? it can't be a group of processes, only one 
> can be listening to a socket at one time.

Huh?  Each backend has its own socket.

> and if the postmaster isn't needed for the child processes to write to 
> the datastore, how are multiple child processes prevented from writing to 
> the datastore normally? and why doesn't that mechanism continue to work?

They use locks.  Those locks are implemented using shared memory.  If a
new postmaster starts, it gets a new shared memory, and a new set of
locks, that do not conflict with the ones already held by the first gang
of backends.  This is what causes the corruption.


> so are you saying that the only possible thing that can kill the  
> postmaster is the OOM killer? it can't possilby exit in any other  
> situation without the children being shutdown first?
>
> I would be surprised if that was really true.

If the sysadmin sends a SIGKILL then obviously the same thing happens.

Any other signal gives it the chance to signal the children before
dying.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.



view thread (65+ messages)  latest in thread

Message-ID: <20080829024939.GN8424@alvh.no-ip.org>
Permalink:  ../20080829024939.GN8424@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20080829024939.GN8424@alvh.no-ip.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: alvherre@commandprompt.com, david@lang.hm, scott.marlowe@gmail.com, mdennis@merfer.net, matthew@flymine.org
  Subject: Re: select on 22 GB table causes "An I/O error occured while sending to the backend." exception
  In-Reply-To: <20080829024939.GN8424@alvh.no-ip.org>
  References: <EADBB336-A14E-492C-A8CA-105C8F77A43A@blighty.com> <alpine.DEB.1.10.0808281702450.4454@aragorn.flymine.org> <48B6EA7E.2090707@emolecules.com> <alpine.DEB.1.10.0808282110140.4454@aragorn.flymine.org> <dcc563d10808281542u383808bci4874713a31bd1cc6@mail.gmail.com> <alpine.DEB.1.10.0808281602460.2713@asgard.lang.hm> <dcc563d10808281811t5c98dcaexd98c5cfe679f428d@mail.gmail.com> <e94d85500808281853g22f67274pc9b4c5e3b30bb05a@mail.gmail.com> <dcc563d10808281901w6d449f52t50e5da7938f1fb25@mail.gmail.com> <alpine.DEB.1.10.0808281936090.2713@asgard.lang.hm> <20080829024939.GN8424@alvh.no-ip.org>

* 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