Thread: Re: Issue in PG start

Re: Issue in PG start

From
"sivapostgres@yahoo.com"
Date:
Hello,

PG 11.8 in Windows 10 and currently PG 11.11

Yesterday [07th May] morning when we switched on the computer and subsequently PGAdmin, we got the message following message
FATAL: the database system is starting up

I uninstalled PG and installed [v 11.11] PG with the same data directory.  Fortunately it worked even when we switched off /on the computer for lunch.   NO issues yesterday.

But today morning [08th May], again we have the same issue and same message.   The log file is with the following message only

2021-05-08 10:26:20.783 IST [7360] LOG:  database system was interrupted; last known up at 2021-05-07 18:46:00 IST
2021-05-08 10:28:36.159 IST [7048] FATAL:  the database system is starting up
2021-05-08 10:28:46.199 IST [15240] FATAL:  the database system is starting up
2021-05-08 10:28:56.233 IST [7036] FATAL:  the database system is starting up
2021-05-08 10:29:06.266 IST [5656] FATAL:  the database system is starting up
2021-05-08 10:29:16.299 IST [4464] FATAL:  the database system is starting up
2021-05-08 10:29:26.327 IST [11764] FATAL:  the database system is starting up
2021-05-08 10:29:36.365 IST [4248] FATAL:  the database system is starting up
2021-05-08 10:29:46.406 IST [14920] FATAL:  the database system is starting up
2021-05-08 10:29:56.429 IST [6364] FATAL:  the database system is starting up
2021-05-08 10:30:06.458 IST [14472] FATAL:  the database system is starting up
2021-05-08 10:30:16.489 IST [1372] FATAL:  the database system is starting up
2021-05-08 10:30:26.521 IST [4232] FATAL:  the database system is starting up
2021-05-08 10:30:36.547 IST [14832] FATAL:  the database system is starting up
2021-05-08 10:30:46.578 IST [13852] FATAL:  the database system is starting up
2021-05-08 10:30:56.607 IST [9720] FATAL:  the database system is starting up
2021-05-08 10:31:06.634 IST [12396] FATAL:  the database system is starting up
2021-05-08 10:31:16.693 IST [8] FATAL:  the database system is starting up
2021-05-08 10:31:26.722 IST [12492] FATAL:  the database system is starting up
2021-05-08 10:31:36.750 IST [15020] FATAL:  the database system is starting up
2021-05-08 10:31:46.778 IST [9684] FATAL:  the database system is starting up
2021-05-08 10:31:56.924 IST [15356] FATAL:  the database system is starting up
2021-05-08 10:32:06.946 IST [1060] FATAL:  the database system is starting up
2021-05-08 10:32:16.968 IST [14828] FATAL:  the database system is starting up
2021-05-08 10:32:27.025 IST [10544] FATAL:  the database system is starting up
2021-05-08 10:32:37.054 IST [816] FATAL:  the database system is starting up
2021-05-08 10:32:47.087 IST [14676] FATAL:  the database system is starting up
2021-05-08 10:32:57.141 IST [13116] FATAL:  the database system is starting up
2021-05-08 10:33:07.171 IST [15280] FATAL:  the database system is starting up
2021-05-08 10:33:17.202 IST [12972] FATAL:  the database system is starting up
2021-05-08 10:33:27.229 IST [4476] FATAL:  the database system is starting up
2021-05-08 10:33:37.259 IST [1992] FATAL:  the database system is starting up
2021-05-08 10:33:47.291 IST [5260] FATAL:  the database system is starting up
2021-05-08 10:33:57.425 IST [15040] FATAL:  the database system is starting up
2021-05-08 10:34:07.459 IST [5780] FATAL:  the database system is starting up
2021-05-08 10:34:17.487 IST [5052] FATAL:  the database system is starting up
2021-05-08 10:34:25.047 IST [15396] FATAL:  the database system is starting up
2021-05-08 10:34:25.071 IST [15424] FATAL:  the database system is starting up
2021-05-08 10:34:25.094 IST [15452] FATAL:  the database system is starting up
2021-05-08 10:34:25.118 IST [15480] FATAL:  the database system is starting up
2021-05-08 10:34:25.142 IST [15508] FATAL:  the database system is starting up
2021-05-08 10:34:25.318 IST [15548] FATAL:  the database system is starting up
2021-05-08 10:34:27.514 IST [15588] FATAL:  the database system is starting up
2021-05-08 10:34:37.534 IST [15668] FATAL:  the database system is starting up
2021-05-08 10:34:47.559 IST [15868] FATAL:  the database system is starting up
2021-05-08 10:34:57.592 IST [16256] FATAL:  the database system is starting up
2021-05-08 10:35:01.668 IST [16332] FATAL:  the database system is starting up
2021-05-08 10:35:07.623 IST [1332] FATAL:  the database system is starting up
2021-05-08 10:35:08.079 IST [15396] FATAL:  the database system is starting up
2021-05-08 10:35:17.653 IST [7316] FATAL:  the database system is starting up
2021-05-08 10:35:27.783 IST [16376] FATAL:  the database system is starting up
2021-05-08 10:35:37.825 IST [15596] FATAL:  the database system is starting up
2021-05-08 10:35:47.859 IST [15928] FATAL:  the database system is starting up
2021-05-08 10:35:57.887 IST [5544] FATAL:  the database system is starting up
2021-05-08 10:36:07.912 IST [2988] FATAL:  the database system is starting up
2021-05-08 10:36:17.946 IST [7532] FATAL:  the database system is starting up
2021-05-08 10:36:27.975 IST [13672] FATAL:  the database system is starting up
2021-05-08 10:36:38.117 IST [11640] FATAL:  the database system is starting up
2021-05-08 10:36:48.261 IST [16568] FATAL:  the database system is starting up
2021-05-08 10:36:58.295 IST [16816] FATAL:  the database system is starting up
2021-05-08 10:37:08.328 IST [16904] FATAL:  the database system is starting up
2021-05-08 10:37:18.356 IST [16840] FATAL:  the database system is starting up
2021-05-08 10:37:28.384 IST [16648] FATAL:  the database system is starting up
2021-05-08 10:37:38.420 IST [3180] FATAL:  the database system is starting up
2021-05-08 10:37:48.468 IST [5012] FATAL:  the database system is starting up
2021-05-08 10:37:58.504 IST [16464] FATAL:  the database system is starting up
2021-05-08 10:38:08.535 IST [3140] FATAL:  the database system is starting up
2021-05-08 10:38:18.570 IST [2444] FATAL:  the database system is starting up
2021-05-08 10:38:28.606 IST [16768] FATAL:  the database system is starting up
2021-05-08 10:38:38.654 IST [16908] FATAL:  the database system is starting up
2021-05-08 10:38:48.702 IST [16952] FATAL:  the database system is starting up
2021-05-08 10:38:58.747 IST [12636] FATAL:  the database system is starting up
2021-05-08 10:39:08.888 IST [15352] FATAL:  the database system is starting up
2021-05-08 10:39:18.929 IST [17392] FATAL:  the database system is starting up
2021-05-08 10:39:21.835 IST [14112] FATAL:  the database system is starting up
2021-05-08 10:39:28.964 IST [7316] FATAL:  the database system is starting up
2021-05-08 10:39:39.010 IST [14784] FATAL:  the database system is starting up
2021-05-08 10:39:49.052 IST [732] FATAL:  the database system is starting up

How / where to debug the issue and correct it ?

Happiness Always
BKR Sivaprakash

Re: Issue in PG start

From
"David G. Johnston"
Date:

On Friday, May 7, 2021, sivapostgres@yahoo.com <sivapostgres@yahoo.com> wrote:
Hello,

PG 11.8 in Windows 10 and currently PG 11.11

Yesterday [07th May] morning when we switched on the computer and subsequently PGAdmin, we got the message following message
FATAL: the database system is starting up

I uninstalled PG and installed [v 11.11] PG with the same data directory.  Fortunately it worked even when we switched off /on the computer for lunch.   NO issues yesterday.

But today morning [08th May], again we have the same issue and same message.   The log file is with the following message only

2021-05-08 10:26:20.783 IST [7360] LOG:  database system was interrupted; last known up at 2021-05-07 18:46:00 IST


How / where to debug the issue and correct it ?

To see why the server is not completing its startup cycle you need to look at the server’s log file.  All you’ve shown is a client failing to establish a connection every ten seconds.

David J. 

Re: Issue in PG start

From
"sivapostgres@yahoo.com"
Date:
The above is the contents of the log file from 'data' folder of PG.   

Message in Windows Application Event
2021-05-08 10:26:19.425 IST [5588] LOG:  listening on IPv4 address "0.0.0.0", port 5433

On Saturday, 8 May, 2021, 11:02:06 am IST, David G. Johnston <david.g.johnston@gmail.com> wrote:



On Friday, May 7, 2021, sivapostgres@yahoo.com <sivapostgres@yahoo.com> wrote:
Hello,

PG 11.8 in Windows 10 and currently PG 11.11

Yesterday [07th May] morning when we switched on the computer and subsequently PGAdmin, we got the message following message
FATAL: the database system is starting up

I uninstalled PG and installed [v 11.11] PG with the same data directory.  Fortunately it worked even when we switched off /on the computer for lunch.   NO issues yesterday.

But today morning [08th May], again we have the same issue and same message.   The log file is with the following message only

2021-05-08 10:26:20.783 IST [7360] LOG:  database system was interrupted; last known up at 2021-05-07 18:46:00 IST


How / where to debug the issue and correct it ?

To see why the server is not completing its startup cycle you need to look at the server’s log file.  All you’ve shown is a client failing to establish a connection every ten seconds.

David J. 

Re: Issue in PG start

From
"sivapostgres@yahoo.com"
Date:
Or server’s log file is available elsewhere ?  

On Saturday, 8 May, 2021, 01:24:50 pm IST, sivapostgres@yahoo.com <sivapostgres@yahoo.com> wrote:


The above is the contents of the log file from 'data' folder of PG.   

Message in Windows Application Event
2021-05-08 10:26:19.425 IST [5588] LOG:  listening on IPv4 address "0.0.0.0", port 5433

On Saturday, 8 May, 2021, 11:02:06 am IST, David G. Johnston <david.g.johnston@gmail.com> wrote:



On Friday, May 7, 2021, sivapostgres@yahoo.com <sivapostgres@yahoo.com> wrote:
Hello,

PG 11.8 in Windows 10 and currently PG 11.11

Yesterday [07th May] morning when we switched on the computer and subsequently PGAdmin, we got the message following message
FATAL: the database system is starting up

I uninstalled PG and installed [v 11.11] PG with the same data directory.  Fortunately it worked even when we switched off /on the computer for lunch.   NO issues yesterday.

But today morning [08th May], again we have the same issue and same message.   The log file is with the following message only

2021-05-08 10:26:20.783 IST [7360] LOG:  database system was interrupted; last known up at 2021-05-07 18:46:00 IST


How / where to debug the issue and correct it ?

To see why the server is not completing its startup cycle you need to look at the server’s log file.  All you’ve shown is a client failing to establish a connection every ten seconds.

David J. 

Re: Issue in PG start

From
Adrian Klaver
Date:
On 5/7/21 10:14 PM, sivapostgres@yahoo.com wrote:
> Hello,
> 
> PG 11.8 in Windows 10 and currently PG 11.11
> 
> Yesterday [07th May] morning when we switched on the computer and 
> subsequently PGAdmin, we got the message following message
> FATAL: the database system is starting up
> 
> I uninstalled PG and installed [v 11.11] PG with the same data 
> directory.  Fortunately it worked even when we switched off /on the 
> computer for lunch.   NO issues yesterday.

First why switch the computer off for lunch?

Second did you stop the Postgres server before shutting down the machine?

> 
> But today morning [08th May], again we have the same issue and same 
> message. The log file is with the following message only


In postgresql.conf what is log_min_messages set to?

See here:

https://www.postgresql.org/docs/11/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHEN

Table 19.2. Message Severity Levels

for more information on what the levels represent.

Do you have replication set up with this server?

> 
> 2021-05-08 10:26:20.783 IST [7360] LOG:  database system was 
> interrupted; last known up at 2021-05-07 18:46:00 IST
> 2021-05-08 10:28:36.159 IST [7048] FATAL:  the database system is 
> starting up

> Happiness Always
> BKR Sivaprakash
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: Issue in PG start

From
Ron
Date:
On 5/8/21 10:53 AM, Adrian Klaver wrote:
> On 5/7/21 10:14 PM, sivapostgres@yahoo.com wrote:
>> Hello,
>>
>> PG 11.8 in Windows 10 and currently PG 11.11
>>
>> Yesterday [07th May] morning when we switched on the computer and 
>> subsequently PGAdmin, we got the message following message
>> FATAL: the database system is starting up
>>
>> I uninstalled PG and installed [v 11.11] PG with the same data 
>> directory.  Fortunately it worked even when we switched off /on the 
>> computer for lunch.   NO issues yesterday.
>
> First why switch the computer off for lunch?

If it's a desktop and he's a developer, then that's reasonable.

>
> Second did you stop the Postgres server before shutting down the machine?

Is Windows Postgresql a service?  If so then Windows "should" shut it down 
cleanly when you cleanly power off the machine.

-- 
Angular momentum makes the world go 'round.



Re: Issue in PG start

From
Adrian Klaver
Date:
On 5/8/21 9:23 AM, Ron wrote:
> On 5/8/21 10:53 AM, Adrian Klaver wrote:
>> On 5/7/21 10:14 PM, sivapostgres@yahoo.com wrote:
>>> Hello,
>>>
>>> PG 11.8 in Windows 10 and currently PG 11.11
>>>
>>> Yesterday [07th May] morning when we switched on the computer and 
>>> subsequently PGAdmin, we got the message following message
>>> FATAL: the database system is starting up
>>>
>>> I uninstalled PG and installed [v 11.11] PG with the same data 
>>> directory.  Fortunately it worked even when we switched off /on the 
>>> computer for lunch.   NO issues yesterday.
>>
>> First why switch the computer off for lunch?
> 
> If it's a desktop and he's a developer, then that's reasonable.
> 
>>
>> Second did you stop the Postgres server before shutting down the machine?
> 
> Is Windows Postgresql a service?  If so then Windows "should" shut it 
> down cleanly when you cleanly power off the machine.
> 

The log would indicate otherwise:

2021-05-08 10:26:20.783 IST [7360] LOG:  database system was 
interrupted; last known up at 2021-05-07 18:46:00 IST

So something is not working as it should.


-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: Issue in PG start

From
Tom Lane
Date:
Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 5/8/21 9:23 AM, Ron wrote:
>> Is Windows Postgresql a service?  If so then Windows "should" shut it 
>> down cleanly when you cleanly power off the machine.

> The log would indicate otherwise:
>
>>> 2021-05-08 10:26:20.783 IST [7360] LOG:  database system was 
>>> interrupted; last known up at 2021-05-07 18:46:00 IST
>
> So something is not working as it should.

Yeah, that's bad news.  In theory, as long as you didn't set
fsync = off, Postgres should be able to recover from an unclean
shutdown.  In practice, that requires all the levels of the
hardware and software stack to pay strict attention to write
ordering requirements.  It is, um, pretty common for inexpensive
Windows gear to not be very careful about that.  I'd say this
particular machine has clearly failed the plug-pull test [1].

If the OP is in the habit of just hitting the power switch
at lunchtime, I'd say he's got to stop doing that.  Telling
Windows to shut down will add a few seconds, but greatly
reduce the risk of problems (and not only for Postgres).
If he *did* tell Windows to shut down, then there's something
else that needs adjustment.

            regards, tom lane

[1] https://wiki.postgresql.org/wiki/Reliable_Writes



Re: Issue in PG start

From
"sivapostgres@yahoo.com"
Date:
1.  First why switch the computer off for lunch?  
        It's a development machine and I'm a developer.   We used to shut down every computer for lunch.  We shut down the windows and not just hit the power switch.   We advice and follow every users and client to shut down the windows properly and we follow it.

2.  In postgresql.conf what is log_min_messages set to?
        Warning

3.  Do you have replication set up with this server?
        No

4.   Is Windows Postgresql a service?  If so then Windows "should" shut it down cleanly when you cleanly power off the 
        machine.
        Yes, Postgresql is a service and windows is shut down properly.    We do shut down computers during lunch and when closing office, regularly and properly for the past 6 months [ since PG was installed ] without any issue.   This is the first time that we face this issue.  

Need to find a solution that will be helpful if that happens in a production machine.  

Happiness Always
BKR Sivaprakash




On Saturday, 8 May, 2021, 10:24:03 pm IST, Tom Lane <tgl@sss.pgh.pa.us> wrote:


Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 5/8/21 9:23 AM, Ron wrote:
>> Is Windows Postgresql a service?  If so then Windows "should" shut it
>> down cleanly when you cleanly power off the machine.

> The log would indicate otherwise:
>
>>> 2021-05-08 10:26:20.783 IST [7360] LOG:  database system was
>>> interrupted; last known up at 2021-05-07 18:46:00 IST
>
> So something is not working as it should.

Yeah, that's bad news.  In theory, as long as you didn't set
fsync = off, Postgres should be able to recover from an unclean
shutdown.  In practice, that requires all the levels of the
hardware and software stack to pay strict attention to write
ordering requirements.  It is, um, pretty common for inexpensive
Windows gear to not be very careful about that.  I'd say this
particular machine has clearly failed the plug-pull test [1].

If the OP is in the habit of just hitting the power switch
at lunchtime, I'd say he's got to stop doing that.  Telling
Windows to shut down will add a few seconds, but greatly
reduce the risk of problems (and not only for Postgres).
If he *did* tell Windows to shut down, then there's something
else that needs adjustment.

            regards, tom lane


[1]
https://wiki.postgresql.org/wiki/Reliable_Writes



Re: Issue in PG start

From
"sivapostgres@yahoo.com"
Date:
Yesterday's log file.   Till we shut down the windows the message was:
2021-05-08 19:03:32.151 IST [10376] FATAL:  the database system is starting up
2021-05-08 19:03:42.210 IST [7568] FATAL:  the database system is starting up


Today morning log file, I tried to start the service [ after setting the startup type to Manual ] twice
***********************************
2021-05-09 07:43:02.122 IST [16776] LOG:  test message did not get through on socket for statistics collector
2021-05-09 07:43:02.122 IST [16776] LOG:  trying another address for the statistics collector
2021-05-09 07:43:02.624 IST [16776] LOG:  test message did not get through on socket for statistics collector
2021-05-09 07:43:02.624 IST [16776] LOG:  disabling statistics collector for lack of working socket
2021-05-09 07:43:02.624 IST [16776] WARNING:  autovacuum not started because of misconfiguration
2021-05-09 07:43:02.624 IST [16776] HINT:  Enable the "track_counts" option.
2021-05-09 07:43:02.685 IST [17144] LOG:  database system was interrupted; last known up at 2021-05-07 18:46:00 IST
2021-05-09 07:43:04.489 IST [17196] FATAL:  the database system is starting up
2021-05-09 07:43:14.538 IST [17332] FATAL:  the database system is starting up
2021-05-09 07:43:24.577 IST [2716] FATAL:  the database system is starting up
2021-05-09 07:43:34.638 IST [12840] FATAL:  the database system is starting up
2021-05-09 07:43:44.782 IST [6472] FATAL:  the database system is starting up
2021-05-09 07:43:54.852 IST [5288] FATAL:  the database system is starting up
2021-05-09 07:44:04.885 IST [17292] FATAL:  the database system is starting up
2021-05-09 07:44:14.949 IST [17304] FATAL:  the database system is starting up
2021-05-09 07:44:25.021 IST [15816] FATAL:  the database system is starting up
2021-05-09 07:44:35.216 IST [15892] FATAL:  the database system is starting up
2021-05-09 07:44:45.251 IST [7704] FATAL:  the database system is starting up
2021-05-09 07:44:55.432 IST [15644] FATAL:  the database system is starting up
2021-05-09 07:45:05.549 IST [3188] FATAL:  the database system is starting up
2021-05-09 07:45:14.796 IST [17144] LOG:  database system was not properly shut down; automatic recovery in progress
2021-05-09 07:45:14.864 IST [17144] LOG:  redo starts at 2/88985C80
2021-05-09 07:45:14.866 IST [17144] LOG:  invalid record length at 2/889872B8: wanted 24, got 0
2021-05-09 07:45:14.866 IST [17144] LOG:  redo done at 2/88987280
2021-05-09 07:45:14.866 IST [17144] LOG:  last completed transaction was at log time 2021-05-07 18:48:44.227574+05:30
2021-05-09 07:45:15.046 IST [16776] LOG:  database system is ready to accept connections
2021-05-09 07:50:17.295 IST [17204] ERROR:  canceling statement due to user request
2021-05-09 07:50:17.300 IST [16776] LOG:  received fast shutdown request
2021-05-09 07:50:17.322 IST [4408] LOG:  could not receive data from client: An existing connection was forcibly closed by the remote host.

2021-05-09 07:50:17.322 IST [11700] LOG:  could not receive data from client: An existing connection was forcibly closed by the remote host.

2021-05-09 07:50:17.322 IST [16744] LOG:  could not receive data from client: An existing connection was forcibly closed by the remote host.

2021-05-09 07:50:17.322 IST [16960] LOG:  could not receive data from client: An existing connection was forcibly closed by the remote host.

2021-05-09 07:50:17.322 IST [14856] LOG:  could not receive data from client: An existing connection was forcibly closed by the remote host.

2021-05-09 07:50:17.412 IST [16776] LOG:  aborting any active transactions
2021-05-09 07:50:17.419 IST [16776] LOG:  background worker "logical replication launcher" (PID 17204) exited with exit code 1
2021-05-09 07:50:17.548 IST [11032] LOG:  shutting down
2021-05-09 07:50:17.607 IST [16776] LOG:  database system is shut down
**********************************************

Log file after a re-start 
***************************************
2021-05-09 07:52:40.341 IST [13220] LOG:  test message did not get through on socket for statistics collector
2021-05-09 07:52:40.342 IST [13220] LOG:  trying another address for the statistics collector
2021-05-09 07:52:40.844 IST [13220] LOG:  test message did not get through on socket for statistics collector
2021-05-09 07:52:40.844 IST [13220] LOG:  disabling statistics collector for lack of working socket
2021-05-09 07:52:40.845 IST [13220] WARNING:  autovacuum not started because of misconfiguration
2021-05-09 07:52:40.845 IST [13220] HINT:  Enable the "track_counts" option.
2021-05-09 07:52:40.904 IST [13860] LOG:  database system was shut down at 2021-05-09 07:50:17 IST
2021-05-09 07:52:41.122 IST [13220] LOG:  database system is ready to accept connections
2021-05-09 07:55:23.628 IST [11188] LOG:  using stale statistics instead of current ones because stats collector is not responding
*****************************************

Not sure what happened, it's working now.  Any idea of what happened and what should we do to prevent re-occurance ?

Happiness Always
BKR Sivaprakash

On Sunday, 9 May, 2021, 07:49:57 am IST, sivapostgres@yahoo.com <sivapostgres@yahoo.com> wrote:


1.  First why switch the computer off for lunch?  
        It's a development machine and I'm a developer.   We used to shut down every computer for lunch.  We shut down the windows and not just hit the power switch.   We advice and follow every users and client to shut down the windows properly and we follow it.

2.  In postgresql.conf what is log_min_messages set to?
        Warning

3.  Do you have replication set up with this server?
        No

4.   Is Windows Postgresql a service?  If so then Windows "should" shut it down cleanly when you cleanly power off the 
        machine.
        Yes, Postgresql is a service and windows is shut down properly.    We do shut down computers during lunch and when closing office, regularly and properly for the past 6 months [ since PG was installed ] without any issue.   This is the first time that we face this issue.  

Need to find a solution that will be helpful if that happens in a production machine.  

Happiness Always
BKR Sivaprakash




On Saturday, 8 May, 2021, 10:24:03 pm IST, Tom Lane <tgl@sss.pgh.pa.us> wrote:


Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 5/8/21 9:23 AM, Ron wrote:
>> Is Windows Postgresql a service?  If so then Windows "should" shut it
>> down cleanly when you cleanly power off the machine.

> The log would indicate otherwise:
>
>>> 2021-05-08 10:26:20.783 IST [7360] LOG:  database system was
>>> interrupted; last known up at 2021-05-07 18:46:00 IST
>
> So something is not working as it should.

Yeah, that's bad news.  In theory, as long as you didn't set
fsync = off, Postgres should be able to recover from an unclean
shutdown.  In practice, that requires all the levels of the
hardware and software stack to pay strict attention to write
ordering requirements.  It is, um, pretty common for inexpensive
Windows gear to not be very careful about that.  I'd say this
particular machine has clearly failed the plug-pull test [1].

If the OP is in the habit of just hitting the power switch
at lunchtime, I'd say he's got to stop doing that.  Telling
Windows to shut down will add a few seconds, but greatly
reduce the risk of problems (and not only for Postgres).
If he *did* tell Windows to shut down, then there's something
else that needs adjustment.

            regards, tom lane


[1]
https://wiki.postgresql.org/wiki/Reliable_Writes



Re: Issue in PG start

From
Ron
Date:
On 5/8/21 9:19 PM, sivapostgres@yahoo.com wrote:
1.  First why switch the computer off for lunch?  
        It's a development machine and I'm a developer.   We used to shut down every computer for lunch.  We shut down the windows and not just hit the power switch.   We advice and follow every users and client to shut down the windows properly and we follow it.

2.  In postgresql.conf what is log_min_messages set to?
        Warning

3.  Do you have replication set up with this server?
        No

4.   Is Windows Postgresql a service?  If so then Windows "should" shut it down cleanly when you cleanly power off the 
        machine.
        Yes, Postgresql is a service and windows is shut down properly.    We do shut down computers during lunch and when closing office, regularly and properly for the past 6 months [ since PG was installed ] without any issue.   This is the first time that we face this issue.  

Need to find a solution that will be helpful if that happens in a production machine. 

I suggest that you manually stop postgresql before shutting down your PC.  If that solves the problem, then you've discovered that there's a problem in how the service stops Postgresql.

pg_ctl stop -D X:\path\to\data -mfast


--
Angular momentum makes the world go 'round.

Re: Issue in PG start

From
Adrian Klaver
Date:
On 5/8/21 7:32 PM, sivapostgres@yahoo.com wrote:
> Yesterday's log file.   Till we shut down the windows the message was:
> 2021-05-08 19:03:32.151 IST [10376] FATAL:  the database system is 
> starting up
> 2021-05-08 19:03:42.210 IST [7568] FATAL:  the database system is 
> starting up


Comments in line below.

> 
> 
> Today morning log file, I tried to start the service [ after setting the 
> startup type to Manual ] twice
> ***********************************
> 2021-05-09 07:43:02.122 IST [16776] LOG:  test message did not get 
> through on socket for statistics collector

Something is blocking the socket.
Do you have anti-virus software on this machine?

> 2021-05-09 07:43:02.122 IST [16776] LOG:  trying another address for the 
> statistics collector
> 2021-05-09 07:43:02.624 IST [16776] LOG:  test message did not get 
> through on socket for statistics collector
> 2021-05-09 07:43:02.624 IST [16776] LOG:  disabling statistics collector 
> for lack of working socket
> 2021-05-09 07:43:02.624 IST [16776] WARNING:  autovacuum not started 
> because of misconfiguration
> 2021-05-09 07:43:02.624 IST [16776] HINT:  Enable the "track_counts" option.

You should take care of this by following the HINT.

> 2021-05-09 07:43:02.685 IST [17144] LOG:  database system was 
> interrupted; last known up at 2021-05-07 18:46:00 IST
> 2021-05-09 07:43:04.489 IST [17196] FATAL:  the database system is 
> starting up

...

> 2021-05-09 07:45:14.796 IST [17144] LOG:  database system was not 
> properly shut down; automatic recovery in progress
> 2021-05-09 07:45:14.864 IST [17144] LOG:  redo starts at 2/88985C80
> 2021-05-09 07:45:14.866 IST [17144] LOG:  invalid record length at 
> 2/889872B8: wanted 24, got 0
> 2021-05-09 07:45:14.866 IST [17144] LOG:  redo done at 2/88987280
> 2021-05-09 07:45:14.866 IST [17144] LOG:  last completed transaction was 
> at log time 2021-05-07 18:48:44.227574+05:30
> 2021-05-09 07:45:15.046 IST [16776] LOG:  database system is ready to 
> accept connections
> 2021-05-09 07:50:17.295 IST [17204] ERROR:  canceling statement due to 
> user request

So did you or someone else do the above and the below manually or was 
this coming from the system?

> 2021-05-09 07:50:17.300 IST [16776] LOG:  received fast shutdown request
> 2021-05-09 07:50:17.322 IST [4408] LOG:  could not receive data from 
> client: An existing connection was forcibly closed by the remote host.

Are you connecting to database from outside the machine and if so is 
that from a local network or a remote one?
> 
> 2021-05-09 07:50:17.412 IST [16776] LOG:  aborting any active transactions
> 2021-05-09 07:50:17.419 IST [16776] LOG:  background worker "logical 
> replication launcher" (PID 17204) exited with exit code 1
> 2021-05-09 07:50:17.548 IST [11032] LOG:  shutting down
> 2021-05-09 07:50:17.607 IST [16776] LOG:  database system is shut down
> **********************************************

See more below.

> 
> Log file after a re-start
> ***************************************
> 2021-05-09 07:52:40.341 IST [13220] LOG:  test message did not get 
> through on socket for statistics collector
> 2021-05-09 07:52:40.342 IST [13220] LOG:  trying another address for the 
> statistics collector
> 2021-05-09 07:52:40.844 IST [13220] LOG:  test message did not get 
> through on socket for statistics collector
> 2021-05-09 07:52:40.844 IST [13220] LOG:  disabling statistics collector 
> for lack of working socket
> 2021-05-09 07:52:40.845 IST [13220] WARNING:  autovacuum not started 
> because of misconfiguration
> 2021-05-09 07:52:40.845 IST [13220] HINT:  Enable the "track_counts" option.
> 2021-05-09 07:52:40.904 IST [13860] LOG:  database system was shut down 
> at 2021-05-09 07:50:17 IST
> 2021-05-09 07:52:41.122 IST [13220] LOG:  database system is ready to 
> accept connections
> 2021-05-09 07:55:23.628 IST [11188] LOG:  using stale statistics instead 
> of current ones because stats collector is not responding
> *****************************************
> 
> Not sure what happened, it's working now.  Any idea of what happened and 
> what should we do to prevent re-occurance ?

It's up but not really working. Both the statistics collector and the 
autovacuum processes are down. They are both important for the operation 
of the database.

> 
> Happiness Always
> BKR Sivaprakash
> 



-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: Issue in PG start

From
Laurenz Albe
Date:
On Sat, 2021-05-08 at 05:14 +0000, sivapostgres@yahoo.com wrote:
> Yesterday [07th May] morning when we switched on the computer and subsequently PGAdmin, we got the message following
message
> FATAL: the database system is starting up

You will have to wait until startup is completed.

Either you didn't shut down PostgreSQL cleanly, or some server process
crashed.  The log should tell you which of the two happened.

Did you set "checkpoint_timeout" to a high value?  That will make the
startup process potentially take longer to recover.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com