Forcing wal rotation

From: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
To: Postgresql-General <pgsql-hackers(at)postgresql(dot)org>
Subject: Forcing wal rotation
Date: 2006-07-14 15:20:15
Message-ID: 44B7B62F.3050003@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Kreen 2006-07-14 15:36:55 Re: [patch 0/9] annual pgcrypto update
Previous Message Tom Lane 2006-07-14 15:18:11 Re: ShmemAlloc() alignment patch