RFC: A dead simple implementation of pg_rotate_wal

From: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: RFC: A dead simple implementation of pg_rotate_wal
Date: 2006-07-15 16:22:12
Message-ID: 44B91634.9050607@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

I had a urge to do a bit of hacking today, and so I tried to implement
my idea about an pg_rotate_wal for postgres 8.1. It's basically a huge
hack, and wastes io bandwith - but it doesn't need any patches to 8.1,
and can be compiled as an extension.

Here is the code (Included, because it's so short ;-) ).
#define XLOG_NOP 0x40

Datum pg_rotate_wal(PG_FUNCTION_ARGS) {
void *padding = palloc0(XLOG_SEG_SIZE);
XLogRecData rdata;

rdata.data = (char*) padding;
rdata.len = XLOG_SEG_SIZE;
rdata.buffer = InvalidBuffer;
rdata.next = NULL;

XLogInsert(RM_XLOG_ID, XLOG_NOP, &rdata) ;

pfree(padding);
PG_RETURN_NULL() ;
}

Apart from performance (and crazy missuse of the fact that xlog_redo
just does nothing if it doesn't know the info-flag of the wal record) -
do you think that this is safe to use?

greetings, Florian Pflug

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2006-07-15 18:02:13 Re: contrib promotion?
Previous Message Tom Lane 2006-07-15 16:22:03 Still more #ifdef fun: struct sockaddr_storage