Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit36fa297

Browse files
committed
SECOND ATTEMPT
Dump/read non-default GUC values for use by exec'ed backend, for Win32.
1 parent9f0d69f commit36fa297

File tree

3 files changed

+255
-33
lines changed

3 files changed

+255
-33
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.318 2003/05/02 22:01:51 momjian Exp $
40+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.319 2003/05/02 22:02:47 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -256,11 +256,12 @@ static void dummy_handler(SIGNAL_ARGS);
256256
staticvoidCleanupProc(intpid,intexitstatus);
257257
staticvoidLogChildExit(intlev,constchar*procname,
258258
intpid,intexitstatus);
259-
staticintDoBackend(Port*port);
259+
staticintBackendFinalize(Port*port);
260260
voidExitPostmaster(intstatus);
261261
staticvoidusage(constchar*);
262262
staticintServerLoop(void);
263263
staticintBackendStartup(Port*port);
264+
staticvoidBackendFork(Port*port,Backend*bn);
264265
staticintProcessStartupPacket(Port*port,boolSSLdone);
265266
staticvoidprocessCancelRequest(Port*port,void*pkt);
266267
staticintinitMasks(fd_set*rmask,fd_set*wmask);
@@ -570,6 +571,9 @@ PostmasterMain(int argc, char *argv[])
570571
SetDataDir(potential_DataDir);
571572

572573
ProcessConfigFile(PGC_POSTMASTER);
574+
#ifdefEXEC_BACKEND
575+
write_nondefault_variables(PGC_POSTMASTER);
576+
#endif
573577

574578
/*
575579
* Check for invalid combinations of GUC settings.
@@ -1231,7 +1235,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)
12311235
* Now fetch parameters out of startup packet and save them into the
12321236
* Port structure. All data structures attached to the Port struct
12331237
* must be allocated in TopMemoryContext so that they won't disappear
1234-
* when we pass them to PostgresMain (seeDoBackend). We need not worry
1238+
* when we pass them to PostgresMain (seeBackendFinalize). We need not worry
12351239
* about leaking this storage on failure, since we aren't in the postmaster
12361240
* process anymore.
12371241
*/
@@ -1568,6 +1572,9 @@ SIGHUP_handler(SIGNAL_ARGS)
15681572
elog(LOG,"Received SIGHUP, reloading configuration files");
15691573
SignalChildren(SIGHUP);
15701574
ProcessConfigFile(PGC_SIGHUP);
1575+
#ifdefEXEC_BACKEND
1576+
write_nondefault_variables(PGC_SIGHUP);
1577+
#endif
15711578
load_hba();
15721579
load_ident();
15731580
}
@@ -2053,28 +2060,7 @@ BackendStartup(Port *port)
20532060
pid=fork();
20542061

20552062
if (pid==0)/* child */
2056-
{
2057-
intstatus;
2058-
2059-
#ifdefLINUX_PROFILE
2060-
setitimer(ITIMER_PROF,&prof_itimer,NULL);
2061-
#endif
2062-
2063-
#ifdef__BEOS__
2064-
/* Specific beos backend startup actions */
2065-
beos_backend_startup();
2066-
#endif
2067-
free(bn);
2068-
2069-
status=DoBackend(port);
2070-
if (status!=0)
2071-
{
2072-
elog(LOG,"connection startup failed");
2073-
proc_exit(status);
2074-
}
2075-
else
2076-
proc_exit(0);
2077-
}
2063+
BackendFork(port,bn);/* never returns */
20782064

20792065
/* in parent, error */
20802066
if (pid<0)
@@ -2108,6 +2094,31 @@ BackendStartup(Port *port)
21082094
}
21092095

21102096

2097+
staticvoid
2098+
BackendFork(Port*port,Backend*bn)
2099+
{
2100+
intstatus;
2101+
2102+
#ifdefLINUX_PROFILE
2103+
setitimer(ITIMER_PROF,&prof_itimer,NULL);
2104+
#endif
2105+
2106+
#ifdef__BEOS__
2107+
/* Specific beos backend startup actions */
2108+
beos_backend_startup();
2109+
#endif
2110+
free(bn);
2111+
2112+
status=BackendFinalize(port);
2113+
if (status!=0)
2114+
{
2115+
elog(LOG,"connection startup failed");
2116+
proc_exit(status);
2117+
}
2118+
else
2119+
proc_exit(0);
2120+
}
2121+
21112122
/*
21122123
* Try to report backend fork() failure to client before we close the
21132124
* connection.Since we do not care to risk blocking the postmaster on
@@ -2173,7 +2184,7 @@ split_opts(char **argv, int *argcp, char *s)
21732184
}
21742185

21752186
/*
2176-
*DoBackend -- perform authentication, and if successful, set up the
2187+
*BackendFinalize -- perform authentication, and if successful, set up the
21772188
*backend's argument list and invoke backend main().
21782189
*
21792190
* This used to perform an execv() but we no longer exec the backend;
@@ -2184,7 +2195,7 @@ split_opts(char **argv, int *argcp, char *s)
21842195
*If PostgresMain() fails, return status.
21852196
*/
21862197
staticint
2187-
DoBackend(Port*port)
2198+
BackendFinalize(Port*port)
21882199
{
21892200
char*remote_host;
21902201
char**av;
@@ -2221,6 +2232,10 @@ DoBackend(Port *port)
22212232
/* Reset MyProcPid to new backend's pid */
22222233
MyProcPid=getpid();
22232234

2235+
#ifdefEXEC_BACKEND
2236+
read_nondefault_variables();
2237+
#endif
2238+
22242239
/*
22252240
* Initialize libpq and enable reporting of elog errors to the client.
22262241
* Must do this now because authentication uses libpq to send
@@ -2248,7 +2263,7 @@ DoBackend(Port *port)
22482263
unsigned shortremote_port;
22492264
char*host_addr;
22502265
#ifdefHAVE_IPV6
2251-
charip_hostinfo[INET6_ADDRSTRLEN];
2266+
charip_hostinfo[INET6_ADDRSTRLEN];
22522267
#else
22532268
charip_hostinfo[INET_ADDRSTRLEN];
22542269
#endif
@@ -2294,7 +2309,7 @@ DoBackend(Port *port)
22942309
}
22952310
else
22962311
{
2297-
/* not AF_INET */
2312+
/* not AF_INET */
22982313
remote_host="[local]";
22992314

23002315
if (Log_connections)
@@ -2318,7 +2333,7 @@ DoBackend(Port *port)
23182333
* indefinitely. PreAuthDelay doesn't count against the time limit.
23192334
*/
23202335
if (!enable_sig_alarm(AuthenticationTimeout*1000, false))
2321-
elog(FATAL,"DoBackend: Unable to set timer for auth timeout");
2336+
elog(FATAL,"BackendFinalize: Unable to set timer for auth timeout");
23222337

23232338
/*
23242339
* Receive the startup packet (which might turn out to be a cancel
@@ -2347,7 +2362,7 @@ DoBackend(Port *port)
23472362
* SIGTERM/SIGQUIT again until backend startup is complete.
23482363
*/
23492364
if (!disable_sig_alarm(false))
2350-
elog(FATAL,"DoBackend: Unable to disable timer for auth timeout");
2365+
elog(FATAL,"BackendFinalize: Unable to disable timer for auth timeout");
23512366
PG_SETMASK(&BlockSig);
23522367

23532368
if (Log_connections)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp