diff options
Diffstat (limited to 'src/backend/utils/init/postinit.c')
-rw-r--r-- | src/backend/utils/init/postinit.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 318600d6d02..b428a59bdd2 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -59,6 +59,7 @@ #include "utils/builtins.h" #include "utils/fmgroids.h" #include "utils/guc_hooks.h" +#include "utils/injection_point.h" #include "utils/memutils.h" #include "utils/pg_locale.h" #include "utils/portal.h" @@ -718,6 +719,20 @@ InitPostgres(const char *in_dbname, Oid dboid, */ InitProcessPhase2(); + /* Initialize status reporting */ + pgstat_beinit(); + + /* + * And initialize an entry in the PgBackendStatus array. That way, if + * LWLocks or third-party authentication should happen to hang, it is + * possible to retrieve some information about what is going on. + */ + if (!bootstrap) + { + pgstat_bestart_initial(); + INJECTION_POINT("init-pre-auth"); + } + /* * Initialize my entry in the shared-invalidation manager's array of * per-backend data. @@ -786,9 +801,6 @@ InitPostgres(const char *in_dbname, Oid dboid, /* Initialize portal manager */ EnablePortalManager(); - /* Initialize status reporting */ - pgstat_beinit(); - /* * Load relcache entries for the shared system catalogs. This must create * at least entries for pg_database and catalogs used for authentication. @@ -809,8 +821,8 @@ InitPostgres(const char *in_dbname, Oid dboid, /* The autovacuum launcher is done here */ if (AmAutoVacuumLauncherProcess()) { - /* report this backend in the PgBackendStatus array */ - pgstat_bestart(); + /* fill in the remainder of this entry in the PgBackendStatus array */ + pgstat_bestart_final(); return; } @@ -884,6 +896,14 @@ InitPostgres(const char *in_dbname, Oid dboid, am_superuser = superuser(); } + /* Report any SSL/GSS details for the session. */ + if (MyProcPort != NULL) + { + Assert(!bootstrap); + + pgstat_bestart_security(); + } + /* * Binary upgrades only allowed super-user connections */ @@ -953,8 +973,8 @@ InitPostgres(const char *in_dbname, Oid dboid, /* initialize client encoding */ InitializeClientEncoding(); - /* report this backend in the PgBackendStatus array */ - pgstat_bestart(); + /* fill in the remainder of this entry in the PgBackendStatus array */ + pgstat_bestart_final(); /* close the transaction we started above */ CommitTransactionCommand(); @@ -997,7 +1017,7 @@ InitPostgres(const char *in_dbname, Oid dboid, */ if (!bootstrap) { - pgstat_bestart(); + pgstat_bestart_final(); CommitTransactionCommand(); } return; @@ -1197,9 +1217,9 @@ InitPostgres(const char *in_dbname, Oid dboid, if ((flags & INIT_PG_LOAD_SESSION_LIBS) != 0) process_session_preload_libraries(); - /* report this backend in the PgBackendStatus array */ + /* fill in the remainder of this entry in the PgBackendStatus array */ if (!bootstrap) - pgstat_bestart(); + pgstat_bestart_final(); /* close the transaction we started above */ if (!bootstrap) |