pg_ctl stop -m fast after -m smart

Started by Itagaki Takahiroover 16 years ago4 messages
#1Itagaki Takahiro
itagaki.takahiro@oss.ntt.co.jp

"pg_ctl stop -m smart" will wait for all connections are disconnected and
"pg_ctl stop -m fast" will disconnect all connections forcibly.
But "fast" after "smart" also wait for disconnections.

Can we change the behavior that "fast" overwrites "smart" mode?
I'd like to achieve the following sequence:
$ pg_ctl stop
$ (found some connections remain)
$ [Ctrl+C]
$ pg_ctl stop -m fast
$ (force disconnect and stop server safely)

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

#2Fujii Masao
masao.fujii@gmail.com
In reply to: Itagaki Takahiro (#1)
1 attachment(s)
Re: pg_ctl stop -m fast after -m smart

Hi,

On Fri, Aug 7, 2009 at 10:31 AM, Itagaki
Takahiro<itagaki.takahiro@oss.ntt.co.jp> wrote:

"pg_ctl stop -m smart" will wait for all connections are disconnected and
"pg_ctl stop -m fast" will disconnect all connections forcibly.
But "fast" after "smart" also wait for disconnections.

Can we change the behavior that "fast" overwrites "smart" mode?

+1. This behavior was supported in 8.2 or before, but broken in 8.3.
Here is the patch. This should be backported to 8.3 and 8.4.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachments:

fast_shutdown.patchapplication/octet-stream; name=fast_shutdown.patchDownload
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/postmaster/postmaster.c,v
retrieving revision 1.586
diff -c -r1.586 postmaster.c
*** src/backend/postmaster/postmaster.c	6 Aug 2009 09:50:22 -0000	1.586
--- src/backend/postmaster/postmaster.c	7 Aug 2009 03:25:54 -0000
***************
*** 2094,2099 ****
--- 2094,2100 ----
  			}
  			if (pmState == PM_RUN ||
  				pmState == PM_WAIT_BACKUP ||
+ 				pmState == PM_WAIT_BACKENDS ||
  				pmState == PM_RECOVERY_CONSISTENT)
  			{
  				ereport(LOG,
#3Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Fujii Masao (#2)
Re: pg_ctl stop -m fast after -m smart

Fujii Masao wrote:

On Fri, Aug 7, 2009 at 10:31 AM, Itagaki
Takahiro<itagaki.takahiro@oss.ntt.co.jp> wrote:

"pg_ctl stop -m smart" will wait for all connections are disconnected and
"pg_ctl stop -m fast" will disconnect all connections forcibly.
But "fast" after "smart" also wait for disconnections.

Can we change the behavior that "fast" overwrites "smart" mode?

+1. This behavior was supported in 8.2 or before, but broken in 8.3.
Here is the patch. This should be backported to 8.3 and 8.4.

Thanks, applied.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Fujii Masao (#2)
Re: pg_ctl stop -m fast after -m smart

Fujii Masao <masao.fujii@gmail.com> writes:

Takahiro<itagaki.takahiro@oss.ntt.co.jp> wrote:

Can we change the behavior that "fast" overwrites "smart" mode?

+1. This behavior was supported in 8.2 or before, but broken in 8.3.
Here is the patch. This should be backported to 8.3 and 8.4.

I think this was my fault :-(. Thanks for the fix.

regards, tom lane