Re: [GENERAL] Postgres goes to auto recovery mode after system restart(check this draft)
On Mon, 20 Mar 2017 12:05:01 +0100, Karsten Hilbertwrote: >On Mon, Mar 20, 2017 at 06:48:36AM -0400, George Neuner wrote: > >> Windows informs all processes that it is shutting down (or entering >> sleep, or waking up, etc.), but the notifications take different forms >> depending on whether the process is a service or a normal application. >> Services receive commands from the service manager, whereas >> applications receive environment control messages sent to their main >> window. >> >> pg_ctl is a command-line program that can run as a service. But since >> it creates no window, when run as an application it cannot receive any >> environment messages. > >Would it make sense to have pg_ctl create a non-visible >window when run as an application in order to receive >environment control messages ? > > > http://stackoverflow.com/questions/2122506/how-to-create-a-hidden-window-in-c > >Just wondering, >Karsten I'm afraid I have to agree with Tom. That stackoverflow page is a bit misleading as the examples presume MFC and wizard generated message maps. I have no idea whether pg_ctl currently even uses MFC. Creating a window and message loop in pure C is a good page of code. Not a lot, to be sure, but it would add a whole new mode of operation because handling ordinary (window) messages is different from handling service control messages. George -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Postgres goes to auto recovery mode after system restart(check this draft)
Karsten Hilbertwrites: > On Mon, Mar 20, 2017 at 06:48:36AM -0400, George Neuner wrote: >> pg_ctl is a command-line program that can run as a service. But since >> it creates no window, when run as an application it cannot receive any >> environment messages. > Would it make sense to have pg_ctl create a non-visible > window when run as an application in order to receive > environment control messages ? -1 ... we'd just be adding extra code and maintenance effort to support an inferior method of running the server. If you want to have it up all the time, as the OP seemingly does, you ought to be running it as a service. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Postgres goes to auto recovery mode after system restart(check this draft)
On Mon, Mar 20, 2017 at 06:48:36AM -0400, George Neuner wrote: > Windows informs all processes that it is shutting down (or entering > sleep, or waking up, etc.), but the notifications take different forms > depending on whether the process is a service or a normal application. > Services receive commands from the service manager, whereas > applications receive environment control messages sent to their main > window. > > pg_ctl is a command-line program that can run as a service. But since > it creates no window, when run as an application it cannot receive any > environment messages. Would it make sense to have pg_ctl create a non-visible window when run as an application in order to receive environment control messages ? http://stackoverflow.com/questions/2122506/how-to-create-a-hidden-window-in-c Just wondering, Karsten -- GPG key ID E4071346 @ eu.pool.sks-keyservers.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Postgres goes to auto recovery mode after system restart(check this draft)
On Mon, 20 Mar 2017 11:04:35 +0100, Francisco Olartewrote: >Manoj: > >On Mon, Mar 20, 2017 at 10:55 AM, Manojkumar S > wrote: >> I started Postgres from command line using pg_ctl.exe and restarted my >> windows machine. Whenever I start postgres again after machine restart, >> postgres goes to auto recovery mode. What is the reason for this behavior? > >Unclean shutdown (of postgres) -> recovery on start. > >> Is there a way to overcome this? . The same behavior is being reproduced >> every time with any version of postgres and even if I start postgres with >> postgres.exe. >> PS: This behavior does not occur if I start postgres as a windows service > >Then start it as a service. My guess is when started as a service it >manages to get informed of (system) shutdowns and does a clean >(postgres) shutdown, but when started as a normal program windows just >kills it on shutdown ( this happens in other OS too depending on how >you manage it ). IIRC windows had infraestructure to do that with >services, but haven't used it since they launched XP so I'm really >rusty and outdated. Windows informs all processes that it is shutting down (or entering sleep, or waking up, etc.), but the notifications take different forms depending on whether the process is a service or a normal application. Services receive commands from the service manager, whereas applications receive environment control messages sent to their main window. pg_ctl is a command-line program that can run as a service. But since it creates no window, when run as an application it cannot receive any environment messages. If you run postgresql as an application, you need to stop the cluster manually before shutting down, or sleeping, etc. George -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Postgres goes to auto recovery mode after system restart(check this draft)
Manoj: On Mon, Mar 20, 2017 at 10:55 AM, Manojkumar Swrote: > I started Postgres from command line using pg_ctl.exe and restarted my > windows machine. Whenever I start postgres again after machine restart, > postgres goes to auto recovery mode. What is the reason for this behavior? Unclean shutdown (of postgres) -> recovery on start. > Is there a way to overcome this? . The same behavior is being reproduced > every time with any version of postgres and even if I start postgres with > postgres.exe. > PS: This behavior does not occur if I start postgres as a windows service Then start it as a service. My guess is when started as a service it manages to get informed of (system) shutdowns and does a clean (postgres) shutdown, but when started as a normal program windows just kills it on shutdown ( this happens in other OS too depending on how you manage it ). IIRC windows had infraestructure to do that with services, but haven't used it since they launched XP so I'm really rusty and outdated. Francisco Olarte -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] Postgres goes to auto recovery mode after system restart(check this draft)
Hello, I started Postgres from command line using pg_ctl.exe and restarted my windows machine. Whenever I start postgres again after machine restart, postgres goes to auto recovery mode. What is the reason for this behavior? Is there a way to overcome this? . The same behavior is being reproduced every time with any version of postgres and even if I start postgres with postgres.exe. PS: This behavior does not occur if I start postgres as a windows service Thanks Regards: Manoj.