Re: Predefined role pg_maintenance for VACUUM, ANALYZE, CHECKPOINT.

Daniel Gustafsson <daniel@yesql.se>

From: Daniel Gustafsson <daniel@yesql.se>
To: Stephen Frost <sfrost@snowman.net>
Cc: Jeff Davis <pgsql@j-davis.com>, "Bossart, Nathan" <bossartn@amazon.com>, Robert Haas <robertmhaas@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: 2021-11-03T14:02:20Z
Lists: pgsql-hackers
> On 2 Nov 2021, at 19:26, Stephen Frost <sfrost@snowman.net> wrote:

>> Otherwise, I see a couple of warnings when compiling:
>>        xlogfuncs.c:54: warning: implicit declaration of function ‘RequestCheckpoint’
>>        xlogfuncs.c:56: warning: control reaches end of non-void function
> 
> Yeah, such things would need to be cleaned up, of course.

The Commitfest CI has -Werror,-Wimplicit-function-declaration on some platforms
in which this patch breaks, so I think we should apply the below (or something
similar) to ensure this is tested everywhere:

diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c
index 7ecaca4788..c9e1df39c1 100644
--- a/src/backend/access/transam/xlogfuncs.c
+++ b/src/backend/access/transam/xlogfuncs.c
@@ -26,6 +26,7 @@
 #include "funcapi.h"
 #include "miscadmin.h"
 #include "pgstat.h"
+#include "postmaster/bgwriter.h"
 #include "replication/walreceiver.h"
 #include "storage/fd.h"
 #include "storage/ipc.h"
@@ -53,6 +54,7 @@ pg_checkpoint(PG_FUNCTION_ARGS)
 {
        RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_WAIT |
                                          (RecoveryInProgress() ? 0 : CHECKPOINT_FORCE));
+       PG_RETURN_VOID();
 }

--
Daniel Gustafsson		https://vmware.com/




Commits

  1. Add pg_checkpointer predefined role for CHECKPOINT command.