Re: How to simulate crashes of PostgreSQL? - Mailing list pgsql-general

From Craig Ringer
Subject Re: How to simulate crashes of PostgreSQL?
Date
Msg-id 1251096557.13118.48.camel@wallace.localnet
Whole thread Raw
In response to How to simulate crashes of PostgreSQL?  (Sergey Samokhin <prikrutil@gmail.com>)
Responses Re: How to simulate crashes of PostgreSQL?  (Scott Marlowe <scott.marlowe@gmail.com>)
Re: How to simulate crashes of PostgreSQL?  (Sergey Samokhin <prikrutil@gmail.com>)
Re: How to simulate crashes of PostgreSQL?  (Sergey Samokhin <prikrutil@gmail.com>)
List pgsql-general
On Sat, 2009-08-22 at 13:03 -0700, Sergey Samokhin wrote:
> Hello!
>
> To make my client application tolerant of PostgreSQL failures I first
> need to be able to simulate them in a safe manner (hard reset isn't a
> solution I'm looking for :)
>
> Is there a way to disconnect all the clients as if the server has
> crashed? It should look like a real crash from the client's point of
> view.

If you mean a PostgreSQL server crash: write a C extension function that
de-references a null pointer or calls abort() . Instant crash on demand.
`kill -9' on a backend should have much the same effect, though, and is
easier - it's just not something a client can trigger through an SQL
query.

Remember to keep backups - Pg's designed to be fault tolerant, but it's
still good to be careful just in case.


If, however, you mean a crash of the server machine PostgreSQL is
runnning on, which is MUCH more likely and will have different
effects/behaviour, then Ray Stell's advice to bring the interface down
is probably pretty good. The machine should stop responding to ARP
requests or to any packets directed to its MAC address and will stop
sending packets, so it'll look to the client like it's a hard server
crash.

You should also test your client's response to the Pg server remaining
up but becoming non-responsive (eg: failed disk array causes Pg backends
to remain in uninterruptable disk I/O system calls in the kernel). A
possibly good way to do this is to SIGSTOP the backend(s).

--
Craig Ringer


pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Install from Source On Windows - University of Sydney Research
Next
From: Scott Marlowe
Date:
Subject: Re: Install from Source On Windows - University of Sydney Research