Below attached patch is implementing following todo item..
machine-readable pg_controldata?
http://www.postgresql.org/message-id/4b901d73.8030...@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: controldata_v1.patch
Description: controldata_v1.patch

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to