From: Michael P. <mic...@gm...> - 2014-07-18 07:05:19
|
On Fri, Jul 18, 2014 at 3:26 PM, Pavan Deolasee <pav...@gm...> wrote: > I think its a bad idea to use killall to terminate existing processes. I > noticed this for GTM, but the same may apply to other kinds of processes > too. In my case, I was setting up GTM master and standby on the same > machine. pgxc_ctl was failing to start up GTM correctly. Upon investigation, > I figured out that while initialising/starting GTM slave, it first kills any > existing GTM processes using "killall gtm". This kills the GTM master as > well. > > There are several issues with using killall > > 1. It may kill unrelated processes e.g. I'd a vim session on gtm_cmd.c and > it got killed too That's actually kind of funny, just laughed lonely in front of my screen. > 2. It may kill processes belonging to another instance, if user is running > multiple database clusters on the same machine This one is less funny :( > 3. killall -9 It doesn't do a clean shutdown which may cause issues > I wonder why can't we just rely on -m immediate? If the process fails to > respond to that, either we have a bug to fix or worst administrator can > manually kill the processes he wants. Even if we have to use kill command, > can we not read PID from the .pid file and send signal to that particular > process only? Clearly. Partially written WAL record is an example of a bad thing that could happen for Postgres. For GTM there are for sure similar race conditions with a standby. The same applies to Postgres as well. The usual, recommended, way is to use pg_ctl stop -m immediate in the worst case. Isn't XC bundled with gtm_ctl that could be used instead of killall? That's the same as sending a SIGQUIT after scanning the GTM PID though.. Regards, -- Michael |