Josh Kupershmidt wrote:
> On Wed, Dec 15, 2010 at 10:11 AM, Alvaro Herrera
> <alvherre@commandprompt.com> wrote:
> > It occurs to me that we may need a new mode, which disconnects sessions
> > that are not in a transaction (or as soon as they are) but leaves
> > in-progress transactions alone; this could be the new default. ?Of
> > course, this is much more difficult to implement than the current modes.
>
> I like this idea, if it's feasible. Might I also suggest that the
> smart-mode shutdown give a HINT to the user that he can forcibly kill
> off existing sessions using -m fast. Right now, we show something
> like this:
>
> $ pg_ctl -D PGDATA stop
> waiting for server to shut down....
> ........................................................... failed
> pg_ctl: server does not shut down
>
> And it's not immediately obvious to the user why the server didn't
> shut down, or how to fix things.
I have applied the attached patch to mention -m fast when a smart
shutdown or restart fails.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
new file mode 100644
index 2fab5c9..4b9fb84
*** a/src/bin/pg_ctl/pg_ctl.c
--- b/src/bin/pg_ctl/pg_ctl.c
*************** do_stop(void)
*** 865,870 ****
--- 865,873 ----
print_msg(_(" failed\n"));
write_stderr(_("%s: server does not shut down\n"), progname);
+ if (shutdown_mode == SMART_MODE)
+ write_stderr(_("TIP: the \"-m fast\" option immediately disconnects sessions rather than\n"
+ "waiting for session-initiated disconnection.\n"));
exit(1);
}
print_msg(_(" done\n"));
*************** do_restart(void)
*** 952,957 ****
--- 955,963 ----
print_msg(_(" failed\n"));
write_stderr(_("%s: server does not shut down\n"), progname);
+ if (shutdown_mode == SMART_MODE)
+ write_stderr(_("TIP: the \"-m fast\" option immediately disconnects sessions rather than\n"
+ "waiting for session-initiated disconnection.\n"));
exit(1);
}