Re: [HACKERS] Shutting down a warm standby database in 8.2beta3 - Mailing list pgsql-general

From Gregory Stark
Subject Re: [HACKERS] Shutting down a warm standby database in 8.2beta3
Date
Msg-id 87u00xuxkt.fsf@enterprisedb.com
Whole thread Raw
In response to Re: [HACKERS] Shutting down a warm standby database in 8.2beta3  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> Gregory Stark <stark@enterprisedb.com> writes:
>> Sure, but it might be getting delivered to, say, your "sleep" command. You
>> haven't checked the return value of sleep to handle any errors that may occur.
>> As it stands you have to check for errors from every single command executed
>> by your script.
>
> The expectation is that something like SIGINT or SIGQUIT would be
> delivered to both the sleep command and the shell process running the
> script.  So the shell should fail anyway.  (Of course, a nontrivial
> archive or recovery script had better be checking for failures at each
> step, but this is not very relevant to the immediate problem.)

Hm, I tried to test that before I sent that. But I guess my test was faulty
since I was really testing what process the terminal handling delivered the
signal to:


$ cat /tmp/test.sh
#!/bin/sh

echo before
sleep 5 || echo sleep failed
echo after

$ sh /tmp/test.sh ; echo $?
before
^\
/tmp/test.sh: line 4: 23407 Quit                    sleep 5
sleep failed
after
0


--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Shutting down a warm standby database in 8.2beta3
Next
From: "J. Greg Davidson"
Date:
Subject: User-defined-type in C crashing PostgreSQL server: What am I doing wrong?