Forcing wal rotation - Mailing list pgsql-hackers

From Florian G. Pflug
Subject Forcing wal rotation
Date
Msg-id 44B7B62F.3050003@phlo.org
Whole thread Raw
Responses Re: Forcing wal rotation  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi

For my warm-standby-cluster I'm now saving the currently used wal using rsync,
to avoid loosing data from a few hours (or days) ago, when there is little traffic,
and thus the wal isn't rotated. For online backups, the problem is even worse, because
a backup might me unuseable even hours after I called pg_stop_backup(), because the
wal segment needed to bring the backup to a consistent state might not have been archived
at that time.

I've now thought about how to fix that without doing that rather crude rsync-pg_xlog-hack.
I've read through the code, and learned that wal-segments are expected to have a specific size -
thus rotating them "early" is not that easy. But now I figured that another short-term solution
could probably be implemented easily.

I'd like to write a function that just fills the wal with "nop" records, until the current used
wal is full. Since I assume that there are already different kind of wal records, adding a
NOP-record that just takes up space, and does nothing else, should be quite easy. And even
if wals contain only one kind of record (Write this page to that datafile), I could just
repeat the last records over and over again, until the wal is filled, couldn't I?

Do you think that this is feasable? If so, I'd like to try it.

greetings, Florian Pflug



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ShmemAlloc() alignment patch
Next
From: "Marko Kreen"
Date:
Subject: Re: [PATCHES] [patch 0/9] annual pgcrypto update