From: Dilip kumar <dilip(dot)kumar(at)huawei(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject:
Date: 2014-01-08 03:55:38
Message-ID: 4205E661176A124FAF891E0A6BA913526593A203@SZXEML507-MBS.china.huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Below attached patch is implementing following todo item..
machine-readable pg_controldata?
http://www.postgresql.org/message-id/4B901D73.8030003@agliodbs.com
Possible approaches:

1. Implement as backend function and provide a view to user.

- But In this approach user can only get this information when server is running.

2. Extend pg_controldata tool to provide value of an individual attribute.

A first draft version of the patch is attached in the mail, implemented using approach 2.

Description of the patch:

1. Below is the list of the option which are exposed by pg_controldata (all checkpoint, redo and backup related options are exposed).
I think we don't need to expose options for other parameters, because they will not be useful for using independently. (user can simply print all values same as old behavior)

-v, --catalog-version catalog version
-l, --latest-chcekpoint-loc Latest checkpoint location
-L, --prev-chcekpoint-loc Prior checkpoint location
-r, --latest-checkpoint-redoloc Latest checkpoint's REDO location
-t, --latest-checkpoint-timeline Latest checkpoint's TimeLineID
-T, --latest-checkpoint-prevtimeline Latest checkpoint's PrevTimeLineID
-c, --latest-checkpoint-time Time of latest checkpoint
-x, --latest-checkpoint-nextxid Latest checkpoint's NextXID
-o, --latest-checkpoint-nextoid Latest Latest checkpoint's NextOID
-X, --latest-checkpoint-nextmulti-xactid Latest checkpoint's NextMultiXactId
-O, --latest-checkpoint-nextmulti-offset Latest checkpoint's NextMultiOffset
-q, --latest-checkpoint-oldestxid Latest checkpoint's oldestXID
-a, --latest-checkpoint-oldest-activexid Latest checkpoint's oldestActiveXID
-m, --latest-checkpoint-oldest-multixid Latest checkpoint's oldestMultiXid
-e, --min-recovery-endloc Minimum recovery ending location
-E, --min-recovery-endloc-timeline Min recovery ending loc's timeline
-b, --backup-start-location Backup start location
-B, --backup-end-location Backup end location

2. If user provide individual option, then direct value of that parameter will be printed (as shown in below example), parameter name is not printed as output so that user need not to parse the output.

./pg_controldata --latest-checkpoint-time -- run with latest-checkpoint-time option
Tue 07 Jan 2014 05:22:42 PM IST --output is direct value

3. This feature can save parsing effort for user where user need to get the value of individual parameter

i.e Time of latest checkpoint for Standby lag monitoring.

Please provide your suggestion...

Regards,
Dilip

Attachment Content-Type Size
controldata_v1.patch application/octet-stream 8.2 KB

Responses

  • Re: at 2014-01-09 16:50:12 from Robert Haas
  • Re: at 2014-01-13 03:45:17 from David Fetter

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip kumar 2014-01-08 04:02:34 TODO: machine-readable pg_controldata
Previous Message Amit Kapila 2014-01-08 03:27:27 Re: cleanup in code