Re: [HACKERS] Re: [COMMITTERS] pgsql: Can't completely get rid of #ifndef FRONTEND in palloc.h :-(

2014-04-28 Thread Alvaro Herrera
Tom Lane wrote:

> What might be less breakable is to identify exactly which declarations
> pg_controldata needs out of this file and push just those into some new
> header.

Yeah, I also thought about that but didn't get around to trying.

> However, pg_controldata is just the tip of the iceberg --- to get any
> mileage out of this, we'd also have to make pg_resetxlog and pg_xlogdump
> able to compile with only postgres_fe.h, so there might be too much stuff
> involved.

IIRC we didn't have pg_xlogdump when I wrote this, and I checked
pg_resetxlog and it wasn't nearly as simple as pg_controldata.

-- 
Álvaro Herrerahttp://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Re: [COMMITTERS] pgsql: Can't completely get rid of #ifndef FRONTEND in palloc.h :-(

2014-04-28 Thread Tom Lane
Alvaro Herrera  writes:
> Tom Lane wrote:
>> Hm.  It would certainly be better if pg_controldata could use
>> postgres_fe.h not postgres.h, but I'm confused about how the new header
>> added by this patch helps that?  None of the declarations you removed from
>> xlog.h look like they'd be more problematic than the ones you left behind.

> The point IIRC was to be able to remove stuff that required type Datum
> to be defined:

> -extern void ShutdownXLOG(int code, Datum arg);

> which led to the idea that the new header would be about process control
> for xlog.c.

Oh, Datum was the issue?  I see.  But then this approach is basically
requiring that we can never reference Datum in any header that
pg_controldata uses.  Which seems like a pretty draconian limitation,
particularly if the headers involved are general-purpose ones like xlog.h.

What might be less breakable is to identify exactly which declarations
pg_controldata needs out of this file and push just those into some new
header.

However, pg_controldata is just the tip of the iceberg --- to get any
mileage out of this, we'd also have to make pg_resetxlog and pg_xlogdump
able to compile with only postgres_fe.h, so there might be too much stuff
involved.

regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Re: [COMMITTERS] pgsql: Can't completely get rid of #ifndef FRONTEND in palloc.h :-(

2014-04-28 Thread Alvaro Herrera
Tom Lane wrote:
> Alvaro Herrera  writes:
> > Tom Lane wrote:
> >> pg_controldata includes postgres.h not postgres_fe.h, so utils/palloc.h
> >> must be able to compile in a "#define FRONTEND" context.
> 
> > Hmm, I had this patch in an abandoned branch from long ago, which I
> > think helped remove postgres.h from pg_controldata.  I remembered it
> > just now because of this commit message.  Maybe it's useful to re-remove
> > the #ifndef FRONTEND from palloc.h.
> 
> Hm.  It would certainly be better if pg_controldata could use
> postgres_fe.h not postgres.h, but I'm confused about how the new header
> added by this patch helps that?  None of the declarations you removed from
> xlog.h look like they'd be more problematic than the ones you left behind.

The point IIRC was to be able to remove stuff that required type Datum
to be defined:

-extern void ShutdownXLOG(int code, Datum arg);

which led to the idea that the new header would be about process control
for xlog.c.

-- 
Álvaro Herrerahttp://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Re: [COMMITTERS] pgsql: Can't completely get rid of #ifndef FRONTEND in palloc.h :-(

2014-04-28 Thread Alvaro Herrera
Tom Lane wrote:
> Can't completely get rid of #ifndef FRONTEND in palloc.h :-(
> 
> pg_controldata includes postgres.h not postgres_fe.h, so utils/palloc.h
> must be able to compile in a "#define FRONTEND" context.

Hmm, I had this patch in an abandoned branch from long ago, which I
think helped remove postgres.h from pg_controldata.  I remembered it
just now because of this commit message.  Maybe it's useful to re-remove
the #ifndef FRONTEND from palloc.h.

It's not rebased to latest master and maybe even not complete; if people
think this approach is worthwhile I can try and clean it up and
proposely more seriously; LMK.  (Also if people think it needs futher
tweaks.  I vaguely recall I didn't propose it back then because the set
of stuff in the new header could be tweaked.)

-- 
Álvaro Herrerahttp://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index d960bbc..de06a36 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -30,6 +30,7 @@
 #include "access/twophase.h"
 #include "access/xact.h"
 #include "access/xlog_internal.h"
+#include "access/xlogproc.h"
 #include "access/xlogreader.h"
 #include "access/xlogutils.h"
 #include "catalog/catversion.h"
diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c
index 0c178c5..313486e 100644
--- a/src/backend/access/transam/xlogarchive.c
+++ b/src/backend/access/transam/xlogarchive.c
@@ -22,6 +22,7 @@
 
 #include "access/xlog.h"
 #include "access/xlog_internal.h"
+#include "access/xlogproc.h"
 #include "miscadmin.h"
 #include "postmaster/startup.h"
 #include "replication/walsender.h"
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 82ef726..8f185aa 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -22,6 +22,7 @@
 #endif
 
 #include "access/htup_details.h"
+#include "access/xlogproc.h"
 #include "bootstrap/bootstrap.h"
 #include "catalog/index.h"
 #include "catalog/pg_collation.h"
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index 5fb2d81..54a09f0 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -43,6 +43,7 @@
 
 #include "access/xlog.h"
 #include "access/xlog_internal.h"
+#include "access/xlogproc.h"
 #include "libpq/pqsignal.h"
 #include "miscadmin.h"
 #include "pgstat.h"
diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c
index 3ddd596..4bd4740 100644
--- a/src/backend/postmaster/pgarch.c
+++ b/src/backend/postmaster/pgarch.c
@@ -34,6 +34,7 @@
 
 #include "access/xlog.h"
 #include "access/xlog_internal.h"
+#include "access/xlogproc.h"
 #include "libpq/pqsignal.h"
 #include "miscadmin.h"
 #include "postmaster/fork_process.h"
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 15c2320..08491a4 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -93,6 +93,7 @@
 
 #include "access/transam.h"
 #include "access/xlog.h"
+#include "access/xlogproc.h"
 #include "bootstrap/bootstrap.h"
 #include "catalog/pg_control.h"
 #include "lib/ilist.h"
diff --git a/src/backend/postmaster/startup.c b/src/backend/postmaster/startup.c
index 7ebf500..1ea9d6a 100644
--- a/src/backend/postmaster/startup.c
+++ b/src/backend/postmaster/startup.c
@@ -22,7 +22,7 @@
 #include 
 #include 
 
-#include "access/xlog.h"
+#include "access/xlogproc.h"
 #include "libpq/pqsignal.h"
 #include "miscadmin.h"
 #include "postmaster/startup.h"
diff --git a/src/backend/postmaster/walwriter.c b/src/backend/postmaster/walwriter.c
index 8359da6..bdfe6ca 100644
--- a/src/backend/postmaster/walwriter.c
+++ b/src/backend/postmaster/walwriter.c
@@ -46,7 +46,7 @@
 #include 
 #include 
 
-#include "access/xlog.h"
+#include "access/xlogproc.h"
 #include "libpq/pqsignal.h"
 #include "miscadmin.h"
 #include "postmaster/walwriter.h"
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index 911a66b..60e6d8d 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -49,6 +49,7 @@
 #include "access/timeline.h"
 #include "access/transam.h"
 #include "access/xlog_internal.h"
+#include "access/xlogproc.h"
 #include "libpq/pqformat.h"
 #include "libpq/pqsignal.h"
 #include "miscadmin.h"
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 8427006..22a9248 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -23,6 +23,7 @@
 #include "access/htup_details.h"
 #include "access/sysattr.h"
 #include "access/xact.h"
+#include "access/xlogproc.h"
 #include "catalog/catalog.h"
 #include "catalog/indexing.h"
 #include "catalog/namespace.h"
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/mis