RFC: A dead simple implementation of pg_rotate_wal - Mailing list pgsql-hackers

From Florian G. Pflug
Subject RFC: A dead simple implementation of pg_rotate_wal
Date
Msg-id 44B91634.9050607@phlo.org
Whole thread Raw
List 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: More #ifdef fun: src/interfaces/libpq/win32.c
Next
From: Tom Lane
Date:
Subject: Still more #ifdef fun: struct sockaddr_storage