pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rajesh Kumar Mallah <mallah.rajesh@gmail.com>
To: Grega Bremec <gregab@p0f.net>
Cc: pgsql-admin@postgresql.org
Subject: Re: FW: Setting up of PITR system.
Date: Sat, 1 Apr 2006 16:28:42 +0530
Message-ID: <a97c77030604010258j657622fcj6a42a10c8c38f344@mail.gmail.com> (raw)
In-Reply-To: <442E1945.4030006@p0f.net>
References: <!&!AAAAAAAAAAAuAAAAAAAAALfqleqaijxJlxu+E5RYF+YBAJaQ0jfg6zBFp7poaER6UCkAAAGy3PcAABAAAAB0heSWPqq+QLrrk5Lik5sLAQAAAAA=@mailnetwork.co.uk>
	<a97c77030603290445o29f96099xd3cc5f15cd4fb364@mail.gmail.com>
	<442B93DD.4020305@p0f.net>
	<a97c77030603312023k7bdc705eif22af429dc3c943d@mail.gmail.com>
	<442E1945.4030006@p0f.net>

On 4/1/06, Grega Bremec <gregab@p0f.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
> Rajesh Kumar Mallah wrote:
> | Dear Grega ,
> |
> | Thanks for the useful tips and error spotting,
> | i am incorporating some of them and testing
> | the script in my server . I have concerns regarding
> | some of your optimisations that makes the script less
> | generic , below find my comments.
> |
>
> Hello, Rajesh,
>
> I'm glad you found some use to the comments :).

Hmm i am glad , i have found one person whom i can ask any bash doubt   ;-)
i am discussing only the differentials and not posting the flab.

As described in docs pg_start_backup() puts the file backup_label
in the datadir which can has the info about the start log file.
Instead of taking a round about method i am using the content of the
file, (This was also suggested by Andy at somepoint)
below is the code .

# read the backup_label file in pgdatadir and get the name of start wal file
# below is example content.
##############################################################
#START WAL LOCATION: E/A9145E4 (file 000000010000000E0000000A)
#CHECKPOINT LOCATION: E/A92939C
#START TIME: 2006-04-01 14:36:48 IST
#LABEL: base_backup_01-04-2006-14-36-45
###############################################################

BACKUP_LABEL=$DATADIR/backup_label
# get the like containing line START WAL LOCATION

START_LINE=`grep -i  "START WAL LOCATION"  $BACKUP_LABEL`
# strip something like 'START WAL LOCATION: E/A9145E4 (file ' from begin.
START_LINE=${START_LINE/#START*file /}
# strip ')' from end.
START_LINE=${START_LINE/%)/}
# REF_FILE_NUM is something like 000000010000000A00000068
REF_FILE_NUM=$START_LINE
------------------ End of relevent portion
---------------------------------------
please optimize the above regex capturing process if possible.


lately i feel that we should not be discussing the topic over here
becoz it has less to do with postgresql and more of bash.


~  RM_LIST=""
~  find ${WAL_ARCHIVE} -type f | sort -g | while read archive; do
~    if [ ! "${archive}" = "${REF_FILE}" ]; then

i think you meant < instead of '=' in above line.


~      RM_LIST="${RM_LIST:+${RM_LIST} }${archive}"
~    else
~      break
~    fi
~  done
~  rm -f ${RM_LIST}

last doubt:

regarding

  $ env LC_ALL="C" backup_script.sh
can i do
export LC_ALL="C"  or
LC_ALL="C"
inside the script itself to be sure ?


Thanks for you help once again.

Regds
Rajesh Kumar Mallah.



view thread (36+ messages)  latest in thread

Message-ID: <a97c77030604010258j657622fcj6a42a10c8c38f344@mail.gmail.com>
Permalink:  ../a97c77030604010258j657622fcj6a42a10c8c38f344@mail.gmail.com/
Also on:    postgresql.org/message-id/a97c77030604010258j657622fcj6a42a10c8c38f344@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mallah.rajesh@gmail.com, gregab@p0f.net
  Subject: Re: FW: Setting up of PITR system.
  In-Reply-To: <a97c77030604010258j657622fcj6a42a10c8c38f344@mail.gmail.com>
  References: <!&!AAAAAAAAAAAuAAAAAAAAALfqleqaijxJlxu+E5RYF+YBAJaQ0jfg6zBFp7poaER6UCkAAAGy3PcAABAAAAB0heSWPqq+QLrrk5Lik5sLAQAAAAA=@mailnetwork.co.uk> <a97c77030603290445o29f96099xd3cc5f15cd4fb364@mail.gmail.com> <442B93DD.4020305@p0f.net> <a97c77030603312023k7bdc705eif22af429dc3c943d@mail.gmail.com> <442E1945.4030006@p0f.net> <a97c77030604010258j657622fcj6a42a10c8c38f344@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox