Thread: Automatic recovery process
Hello, Here is what I see in log file: WARNING: terminating connection because of crash of another server process DETAIL: The postmaster has commanded this server process to roll back the curre nt transaction and exit, because another server process exited abnormally and po ssibly corrupted shared memory. HINT: In a moment you should be able to reconnect to the database and repeat yo ur command. FATAL: the database system is in recovery mode LOG: all server processes terminated; reinitializing LOG: database system was interrupted at 2005-12-10 23:28:04 CET FATAL: the database system is starting up (and the last line repeats on each connection generated by website backend). I'm almost sure that it is caused by httpd, but it is not the main problem ATM. My question is about the last line. Does those connections slow down database startup process? Now it looks like that they do, because when I shutdown backend then database starts immediatel, but I'm not sure, so I would like to hear clear answer :-) Second question: what is the fastest way to detect database start up process using JDBC? Thanks for help. -- Best regards, Grzegorz mailto:goliatus@polzone.pl
On Wed, Dec 28, 2005 at 01:03:16PM +0100, Grzegorz Ta?czyk wrote: > Hello, > > Here is what I see in log file: > > WARNING: terminating connection because of crash of another server process <snip> > FATAL: the database system is starting up > (and the last line repeats on each connection generated by website > backend). > > I'm almost sure that it is caused by httpd, but it is not the main > problem ATM. It's not directly involved. > My question is about the last line. Does those connections slow down > database startup process? Now it looks like that they do, because > when I shutdown backend then database starts immediatel, but I'm not > sure, so I would like to hear clear answer :-) The problem is that after an unclean shutdown the database server has to go through the transaction logs to recover the database. This can take time and during that time new connections are rejected. I don't think attempting to connect slows anything down materially. > Second question: what is the fastest way to detect database start up process using JDBC? Try to connect and check the error message if it fails? I think you're missing the point though. The backend should not be crashing. Unfortunatly you didn't show the actual log of when the backend crashed so we can only speculate. Look for something like "exited with error code" or "signal". Do you have any C backend functions you defined yourself? Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them.
Attachment
Hello Martijn, Wednesday, December 28, 2005, 1:17:54 PM, you wrote: MvO> > My question is about the last line. Does those connections slow down MvO> > database startup process? Now it looks like that they do, because MvO> > when I shutdown backend then database starts immediatel, but I'm not MvO> > sure, so I would like to hear clear answer :-) MvO> The problem is that after an unclean shutdown the database server has MvO> to go through the transaction logs to recover the database. This can MvO> take time and during that time new connections are rejected. I don't MvO> think attempting to connect slows anything down materially. So why after closing all connections database system starts up immediately? This problem also occurs when backend starts up before database system and there are connections pending. Always the best solution is to restart backend. I use Excalibur Datasource component on the backend for connection pooling. MvO> I think you're missing the point though. The backend should not be MvO> crashing. Unfortunatly you didn't show the actual log of when the MvO> backend crashed so we can only speculate. MvO> Look for something like MvO> "exited with error code" or "signal". LOG: server process (PID 22946) was terminated by signal 11 LOG: terminating any other active server processes MvO> Do you have any C backend MvO> "functions you defined yourself? No, I don't have. I use only JDBC and pgAdmin to connect to database. Thanks for answer. -- Best regards, Grzegorz mailto:goliatus@polzone.pl
On Wed, Dec 28, 2005 at 02:13:14PM +0100, Grzegorz Ta?czyk wrote: > So why after closing all connections database system starts up > immediately? This problem also occurs when backend starts up before > database system and there are connections pending. Always the best > solution is to restart backend. I use Excalibur Datasource component > on the backend for connection pooling. PostgreSQL uses a process per connection. If one of those processes dies unexpectedly (like your signal 11 below) the database has possibly been corrupted. So the postmaster closes all other connections and starts recovery. If you connect during the recovery phase you get rejected with "database starting up". I have know idea what how connection pooling component changes anything as I don't know how it works. > LOG: server process (PID 22946) was terminated by signal 11 > LOG: terminating any other active server processes See, this should not happen. You should find out what that process (PID 22946) was doing and why it crashed. Look through the logs to find out what query it was running. It may be a bug in PostgreSQL, it may be corrupted data. Anyway, trying to paper over it won't help, you need to stop the database server crashing. Solve that and everything will work again. Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them.