Shuffling xlog header files
От | Heikki Linnakangas |
---|---|
Тема | Shuffling xlog header files |
Дата | |
Msg-id | 50C62261.4010803@vmware.com обсуждение исходный текст |
Ответы |
Re: Shuffling xlog header files
Re: Shuffling xlog header files Re: Shuffling xlog header files |
Список | pgsql-hackers |
Andres Freund's xlogreader patch contains a change to move the declarations of SQL-callable functions in xlogfuncs.c to a new header file, xlog_fn.h. The purpose is to allow xlog_internal.h to be included in a frontend program, as the PG_FUNCTION_ARGS and Datum used in the prototypes require fmgr.h, which is backend-only. I think his patch missed a trick: pg_basebackup, pg_controlinfo and pg_resetxlog currently use this for the same purpose: /* * 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" ... #include "access/xlog.h" But this got me thinking whether we should do the xlog_fn.h refactoring, so that we could get rid of that ugly hack in the existing programs, too. I ended up with the attached. It allows xlog_internal.h to be included in frontend programs. The name xlog_internal.h is a bit of a misnomer now, it's not very internal anymore, if it can now actually be included by external programs. But the point is that the file contains declarations related to the WAL file format. We still need the "#define FRONTEND 1" ugly hack in pg_controldata and pg_resetxlog with this, but we get rid of it in pg_basebackup. I think that's reasonable, pg_controldata and pg_resetxlog are more low-level programs than pg_basebackup. Any objections? - Heikki
Вложения
В списке pgsql-hackers по дате отправления: