question about wal and point in time recovery

question about wal and point in time recovery

am 12.04.2005 15:47:27 von Alex Zendel

hello all,

i work in an organization that has a handful of people accessing a few ms
access database files. i'm strongly considering porting everything to
postgre (as the backend for access) for a number of obvious reasons, one of
the most prominent ones would be the availability of a back up via the write
ahead log. i've been reading up on the wal and point in time recovery in
the online postgre manual. but i have a question about using it:

is it possible to visually read the entries in the log? is it in binary
format? can the log be modified before recovery occurs. my biggest concern
is that somebody in my org, for example, deletes a field or fudges an update
query that changes a foreign key to a single value - and therefore destroys
table links. so what if this happens and nobody notices it for several
weeks? is it possible to read the log and remove this field delete (i.e.,
remove the 'alter table x drop column y' statement)? or in the update the
scenario, find the statement that reads 'update table x set x.y = "corrupt"'
and then remove it from the log? then can we 'replay' the log and restore
our database, sans the destructive statements?

i am aware of the possibility of data corruption when attempting something
like this, especially when multi-changes transactions were used. i don't
intend to use the wal and pitr in these cases.

......anything else you feel that i should know about using postgre as a back
end for access?

thanks!

az



---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Re: question about wal and point in time recovery

am 13.04.2005 06:28:47 von Tom Lane

"Alex Zendel" writes:
> ... i've been reading up on the wal and point in time recovery in
> the online postgre manual. but i have a question about using it:

[ obligatory gripe: it's postgres or postgresql, not postgre ]

> is it possible to visually read the entries in the log?

Not readily. If you find yourself backed into a corner, I have a
rough-and-ready debug tool for printing out the contents of a WAL
log, but I'd surely not want to call it "supported" in its current
form...

> can the log be modified before recovery occurs.

Not easily. If you were to hack any one log entry, you'd have to
recompute the CRC checksum for it, and there's no way at all to make
a change that would involve changing the size of a log entry. So
really the only useful option you have here is to stop recovery short
of a particular log entry you don't like.

> my biggest concern is that somebody in my org, for example, deletes a
> field or fudges an update query that changes a foreign key to a single
> value - and therefore destroys table links. so what if this happens
> and nobody notices it for several weeks?

There is no automatic recovery mechanism that is going to help you in
such a scenario. You can't expect to undo a long-ago change and not
have that break some unknown number of consequent decisions.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Re: question about wal and point in time recovery

am 13.04.2005 15:51:09 von RMohan

Tom,=20

Is your (?) tool publically available?



Maybe I could have phrased that better....


In any case, do you have a pointer to this R&R WAL tool?

Thanks,=20

Ross

-----Original Message-----
From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql=
..org] On Behalf Of Tom Lane
Sent: Wednesday, April 13, 2005 12:29 AM
To: Alex Zendel
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] question about wal and point in time recovery=20


"Alex Zendel" writes:
> ... i've been reading up on the wal and point in time recovery in
> the online postgre manual. but i have a question about using it:

[ obligatory gripe: it's postgres or postgresql, not postgre ]

> is it possible to visually read the entries in the log?

Not readily. If you find yourself backed into a corner, I have a rough-and=
-ready debug tool for printing out the contents of a WAL log, but I'd surel=
y not want to call it "supported" in its current form...

> can the log be modified before recovery occurs.

Not easily. If you were to hack any one log entry, you'd have to recompute=
the CRC checksum for it, and there's no way at all to make a change that w=
ould involve changing the size of a log entry. So really the only useful o=
ption you have here is to stop recovery short of a particular log entry you=
don't like.

> my biggest concern is that somebody in my org, for example, deletes a=20
> field or fudges an update query that changes a foreign key to a single=20
> value - and therefore destroys table links. so what if this happens=20
> and nobody notices it for several weeks?

There is no automatic recovery mechanism that is going to help you in such =
a scenario. You can't expect to undo a long-ago change and not have that b=
reak some unknown number of consequent decisions.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Re: question about wal and point in time recovery

am 13.04.2005 16:26:09 von Tom Lane

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <7026.1113402244.1@sss.pgh.pa.us>

"Mohan, Ross" writes:
> In any case, do you have a pointer to this R&R WAL tool?

I haven't posted it anywhere, but here is the 8.0 version. You'd build
it something like this:

PGSQL=(location of PG source tree)
CC=gcc
CFLAGS=-Wall -O -I $(PGSQL)/src/include

xlogdump: xlogdump.c
$(CC) $(CFLAGS) -o xlogdump xlogdump.c $(PGSQL)/src/backend/utils/hash/pg_crc.c

It needs improvement to understand more WAL record types, but what it
does has been sufficient for my debugging needs to date. Ideally
someone would clean it up and make it into a contrib module so it could
get into the source tree and be maintained properly ...

regards, tom lane


------- =_aaaaaaaaaa0
Content-Type: application/octet-stream
Content-ID: <7026.1113402244.2@sss.pgh.pa.us>
Content-Description: xlogdump.c.gz
Content-Transfer-Encoding: base64

H4sICNUqXUICA3hsb2dkdW1wLmMA7RprcxpH8jP8igk5bJDQw47PcSTLKYSw
RAUBBnxR4rioZXeALS271D5kKYnut193z8zO7ANJd/Hdp0u5InZmuqdf06+Z
g529r/Vfle3AP3brBUsnWW/2bfiqVCbueuNxlsSu58Z3bBGEDGddf8lGQRQv
Qz750GdX/eE5W7gej/Ylmo+RteRHKTb6gQvYJ/1zf3+ffWbvgiTeJLGAQ9BR
EMZu4EesE2zuQne5ilnDbrIXP/zweu/l4eGrlrnzuRfMLY+d8RvuBZs192N2
HgbJ5mFEgGPMl7A4YsGCxSvOPvruDQ8j5BFGOpbnAqu+a0ma/qa3/JsY+ppy
P6hWv3V920sczmobsVO0v6oZw28Xth97+6t3xlDiu1Hs4JgBbtk2j6IDG4SM
GAoTqzjZlE7cWnZcPgGoZq4f89C3vOwK24otmD3YLGd24MdhQPPVahRbsWsz
AKpUKrDgvXNcqRzssGvAwT32/owMyU7CEBXm+qB/Mh8UhYSdumved33eO0ME
035PYFAwMCYgYljnwToDNIF9v3tJG/ecLWCuUw4w4cstEBFfknlpMA01AmMf
LhbHCBgsFhGP0YoUig3MwuI8h6l0xtwuAvv8NmYht4PQQVjCoWHtlRUCMI6e
JosFDz+d9js/TX79fGzSngO66tNeoziswArxi9YDDa4Np8hyHDC8yKRdUlCK
ZBPym4ex4Ao3SKIi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ztYrkPXKurV
7SIM1uIBLcLJe4x0E8hnIWKF9ips0FiLPT94rroD6Sr0zenH7q4u00w89FtC
RpFt+QuNoAWF/Jtb8Q9YeCYeJosf2Dl7JlpndLX+3bYndR3Lfy4ua5Y+dncU
w7gJe16PnmvxENHyqQBspG5t9Q2tuKq4r4o31ki9I7om6p72hO3JqoS61FHA
XkSxuOJai6fXma42XXVG8s1r/mpTvqAwHnqoV1O5lkSum1O8utE1O6DWT5Gl
uYG4qmvL9cnC4Mza0sZ28ONGdTeYi5aVlrAvRAmLy82iVbRzSJiwCOE/uZ/p
RoisF8aCDfeV0Qxn4zOooH5hf7LR+ey0N2iPf2mxQ/0QCCDemo8mQKOBNDnd
VFbl7b0hmQaeFL0OkpSIw1gz8ywHpXxfVW9yxgE+XuTq0hIzSPH8LmJfsPEO
Wy3cZQJVEF0btieYXtCzHHyPU6ng/UoYzzjdJiCnotVF4u3e2nyDFwqW11FX
WLKxmV5pDVAkMiEUU8Tt9G6TG0brNRejaLFsEd6X9FU4BNNxewSpaNT4rQaZ
KNj7e0ByxNQXVl0w7TRV7NJbsyKBKQHmtqgzyngbzeOsgP8FX6ArozQzAAA=

------- =_aaaaaaaaaa0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

------- =_aaaaaaaaaa0--

Re: question about wal and point in time recovery

am 13.04.2005 16:55:46 von RMohan

Thank you!

( would send this to yer eddress directly, but it's decided
my biz email is a spam address, or somesuch:=20
1=20
refused - see http://www.five-ten-sg.com/blackhole.php? )=20


-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20
Sent: Wednesday, April 13, 2005 10:26 AM
To: Mohan, Ross
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] question about wal and point in time recovery=20


"Mohan, Ross" writes:
> In any case, do you have a pointer to this R&R WAL tool?

I haven't posted it anywhere, but here is the 8.0 version. You'd build it =
something like this:

PGSQL=3D(location of PG source tree)
CC=3Dgcc
CFLAGS=3D-Wall -O -I $(PGSQL)/src/include

xlogdump: xlogdump.c
$(CC) $(CFLAGS) -o xlogdump xlogdump.c $(PGSQL)/src/backend/utils/hash/pg_=
crc.c

It needs improvement to understand more WAL record types, but what it does =
has been sufficient for my debugging needs to date. Ideally someone would =
clean it up and make it into a contrib module so it could get into the sour=
ce tree and be maintained properly ...

regards, tom lane


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Re: question about wal and point in time recovery

am 13.04.2005 17:06:44 von lst_hoe01

Zitat von "Mohan, Ross" :

>
> Thank you!
>
> ( would send this to yer eddress directly, but it's decided
> my biz email is a spam address, or somesuch:
> > refused - see http://www.five-ten-sg.com/blackhole.php? )

I guess it is the IP you are sending from :

http://openrbl.org/ip/64/74/47/121.htm


Regards

Andreas



---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Re: question about wal and point in time recovery

am 18.04.2005 19:06:05 von Bruce Momjian

Tom Lane wrote:
> > can the log be modified before recovery occurs.
>
> Not easily. If you were to hack any one log entry, you'd have to
> recompute the CRC checksum for it, and there's no way at all to make
> a change that would involve changing the size of a log entry. So
> really the only useful option you have here is to stop recovery short
> of a particular log entry you don't like.
>
> > my biggest concern is that somebody in my org, for example, deletes a
> > field or fudges an update query that changes a foreign key to a single
> > value - and therefore destroys table links. so what if this happens
> > and nobody notices it for several weeks?
>
> There is no automatic recovery mechanism that is going to help you in
> such a scenario. You can't expect to undo a long-ago change and not
> have that break some unknown number of consequent decisions.

I think it might be easier to somehow hack the binary that reads the WAL
file on recovery to adjust how it handles a certain WAL entry, rather
than modifying the WAL files itself.

--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org