Обсуждение: In which catalog postgres Instance Crash time recorded ?

Поиск
Список
Период
Сортировка

In which catalog postgres Instance Crash time recorded ?

От
Raghavendra
Дата:
Respected All,

Today on my local box, I observed crash and when I started Instance my beginning line of new pg_log's look like this.

2011-11-23 17:18:14 IST [2958]: [1-1]   LOG:  database system was interrupted; last known up at 2011-11-23 00:45:43 IST
2011-11-23 17:18:14 IST [2958]: [2-1]   LOG:  database system was not properly shut down; automatic recovery in progress
2011-11-23 17:18:14 IST [2958]: [3-1]   LOG:  redo starts at 16/C260C028
2011-11-23 17:18:15 IST [2958]: [4-1]   LOG:  record with zero length at 16/C3609308
2011-11-23 17:18:15 IST [2958]: [5-1]   LOG:  redo done at 16/C36092D8
2011-11-23 17:18:15 IST [2958]: [6-1]   LOG:  last completed transaction was at log time 2011-11-23 00:49:21.225383+05:30

Its always there very much information in log's about the crash, and what went wrong etc., 
But my question is, where that crash time is recorded by Postgres, is it in any catalog or in any file ?

Please assist me on this.
Thanks in advance. 

---
Regards,
Raghavendra
EnterpriseDB Corporation

Re: In which catalog postgres Instance Crash time recorded ?

От
Raghavendra
Дата:
On Wed, Nov 23, 2011 at 7:35 PM, Raghavendra <raghavendra.rao@enterprisedb.com> wrote:
Respected All,

Today on my local box, I observed crash and when I started Instance my beginning line of new pg_log's look like this.

2011-11-23 17:18:14 IST [2958]: [1-1]   LOG:  database system was interrupted; last known up at 2011-11-23 00:45:43 IST
2011-11-23 17:18:14 IST [2958]: [2-1]   LOG:  database system was not properly shut down; automatic recovery in progress
2011-11-23 17:18:14 IST [2958]: [3-1]   LOG:  redo starts at 16/C260C028
2011-11-23 17:18:15 IST [2958]: [4-1]   LOG:  record with zero length at 16/C3609308
2011-11-23 17:18:15 IST [2958]: [5-1]   LOG:  redo done at 16/C36092D8
2011-11-23 17:18:15 IST [2958]: [6-1]   LOG:  last completed transaction was at log time 2011-11-23 00:49:21.225383+05:30

Its always there very much information in log's about the crash, and what went wrong etc., 
But my question is, where that crash time is recorded by Postgres, is it in any catalog or in any file ?

Please assist me on this.
Thanks in advance. 

---
Regards,
Raghavendra
EnterpriseDB Corporation


2011-11-23 17:18:14 IST [2958]: [1-1]   LOG:  database system was interrupted; last known up at 2011-11-23 00:45:43 IST

Just to clear my question, am looking for this  "last known up at 2011-11-23 00:45:43 IST" line information recorded in any pg_catalogs ?

--Raghav

Re: In which catalog postgres Instance Crash time recorded ?

От
Alex Shulgin
Дата:
On Wed, Nov 23, 2011 at 16:59, Raghavendra
<raghavendra.rao@enterprisedb.com> wrote:
>
> Just to clear my question, am looking for this  "last known up at 2011-11-23
> 00:45:43 IST" line information recorded in any pg_catalogs ?

How would it read that from a catalog if the cluster didn't recover
from the crash yet?

I'd think it's looking at last-modified timestamps of some of the
PGDATA files instead.

--
Alex

Re: In which catalog postgres Instance Crash time recorded ?

От
Raghavendra
Дата:

On Wed, Nov 23, 2011 at 8:35 PM, Alex Shulgin <alex.shulgin@gmail.com> wrote:
On Wed, Nov 23, 2011 at 16:59, Raghavendra
<raghavendra.rao@enterprisedb.com> wrote:
>
> Just to clear my question, am looking for this  "last known up at 2011-11-23
> 00:45:43 IST" line information recorded in any pg_catalogs ?

How would it read that from a catalog if the cluster didn't recover
from the crash yet?


Right.
Am expecting too much. I should have guessed this.. :)
 
I'd think it's looking at last-modified timestamps of some of the
PGDATA files instead.


Is it from PGDATA/pg_clog ...

---
Raghav

Re: In which catalog postgres Instance Crash time recorded ?

От
Tom Lane
Дата:
Alex Shulgin <alex.shulgin@gmail.com> writes:
> How would it read that from a catalog if the cluster didn't recover
> from the crash yet?

> I'd think it's looking at last-modified timestamps of some of the
> PGDATA files instead.

No, it's looking at a last-update timestamp field in pg_control.

            regards, tom lane

Re: In which catalog postgres Instance Crash time recorded ?

От
Raghavendra
Дата:
On Wed, Nov 23, 2011 at 9:01 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Alex Shulgin <alex.shulgin@gmail.com> writes:
> How would it read that from a catalog if the cluster didn't recover
> from the crash yet?

> I'd think it's looking at last-modified timestamps of some of the
> PGDATA files instead.

No, it's looking at a last-update timestamp field in pg_control.

                       regards, tom lane

Thanks Tom.

So, Is it a approximate time of crash on the basis of last-modified timestamp of pg_control file ? 

--Raghav

Re: In which catalog postgres Instance Crash time recorded ?

От
Tom Lane
Дата:
Raghavendra <raghavendra.rao@enterprisedb.com> writes:
> On Wed, Nov 23, 2011 at 9:01 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> No, it's looking at a last-update timestamp field in pg_control.

> So, Is it a approximate time of crash on the basis of last-modified
> timestamp of pg_control file ?

IIRC, that's going to be the time of last checkpoint completion on a
normally-operating server.  So depending on your checkpoint settings,
and how busy the server is, it might or might not be very close to
the time of crash.

            regards, tom lane

Re: In which catalog postgres Instance Crash time recorded ?

От
Raghavendra
Дата:

On Wed, Nov 23, 2011 at 10:27 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Raghavendra <raghavendra.rao@enterprisedb.com> writes:
> On Wed, Nov 23, 2011 at 9:01 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> No, it's looking at a last-update timestamp field in pg_control.

> So, Is it a approximate time of crash on the basis of last-modified
> timestamp of pg_control file ?

IIRC, that's going to be the time of last checkpoint completion on a
normally-operating server.  So depending on your checkpoint settings,
and how busy the server is, it might or might not be very close to
the time of crash.

                       regards, tom lane

Perfect. I understood.
Thanks for explaining Tom... :)

---
Regards,
Raghavendra
EnterpriseDB Corporation