xlog functions for pg_basebackup

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: xlog functions for pg_basebackup
Date: 2011-02-10 12:19:49
Message-ID: AANLkTikYk1DwuMP348+N4T6ebj+za5S2b0gFPLPKFkjn@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In cleaning up the streaming part of pg_basebackup, I came across this
gem I copied from elsewherE:

/*
* We have to use postgres.h not postgres_fe.h here, because there's so much
* backend-only stuff in the XLOG include files we need. But we need a
* frontend-ish environment otherwise. Hence this ugly hack.
*/
#define FRONTEND 1
#include "postgres.h"

That's obviously quite ugly. I'm getting most defines out of
xlogdefs.h, which loads fine without that hack, but I'm also using the
XLogFileName() macro, which is in xlog_internal.h. The way I see it,
my options are:

1) keep doing wha tI do and include xlog_internal.h which defines it
2) redefine the macro locally (or just duplicate the code - it's only
one line after all, but it's more a matter of principle)
3) move the definition of the macro to some place that can be accessed
externally

thoughts?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-02-10 13:09:40 Re: Add support for logging the current role
Previous Message Noah Misch 2011-02-10 11:27:04 Re: Add support for logging the current role