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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to