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

Commita2e038f

Browse files
committed
Back out last commit --- wrong patch.
1 parentfb1f7cc commita2e038f

File tree

9 files changed

+283
-122
lines changed

9 files changed

+283
-122
lines changed

‎src/backend/access/transam/clog.c

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
1414
* Portions Copyright (c) 1994, Regents of the University of California
1515
*
16-
* $Header: /cvsroot/pgsql/src/backend/access/transam/clog.c,v 1.13 2003/05/02 21:52:42 momjian Exp $
16+
* $Header: /cvsroot/pgsql/src/backend/access/transam/clog.c,v 1.14 2003/05/02 21:59:31 momjian Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -157,7 +157,7 @@ static ClogCtlData *ClogCtl = NULL;
157157
* The value is automatically inherited by backends via fork, and
158158
* doesn't need to be in shared memory.
159159
*/
160-
staticLWLockId*ClogBufferLocks;/* Per-buffer I/O locks */
160+
staticLWLockIdClogBufferLocks[NUM_CLOG_BUFFERS];/* Per-buffer I/O locks */
161161

162162
/*
163163
* ClogDir is set during CLOGShmemInit and does not change thereafter.
@@ -271,67 +271,41 @@ TransactionIdGetStatus(TransactionId xid)
271271
/*
272272
* Initialization of shared memory for CLOG
273273
*/
274+
274275
int
275276
CLOGShmemSize(void)
276277
{
277-
returnMAXALIGN(sizeof(ClogCtlData)+CLOG_BLCKSZ*NUM_CLOG_BUFFERS)
278-
#ifdefEXEC_BACKEND
279-
+MAXALIGN(NUM_CLOG_BUFFERS*sizeof(LWLockId))
280-
#endif
281-
;
278+
returnMAXALIGN(sizeof(ClogCtlData)+CLOG_BLCKSZ*NUM_CLOG_BUFFERS);
282279
}
283280

284-
285281
void
286282
CLOGShmemInit(void)
287283
{
288284
boolfound;
285+
char*bufptr;
289286
intslotno;
290287

291-
/* Handle ClogCtl */
292-
293288
/* this must agree with space requested by CLOGShmemSize() */
294-
ClogCtl= (ClogCtlData*)ShmemInitStruct("CLOG Ctl",
295-
MAXALIGN(sizeof(ClogCtlData)+
296-
CLOG_BLCKSZ*NUM_CLOG_BUFFERS),&found);
297-
298-
if (!IsUnderPostmaster)
299-
/* Initialize ClogCtl shared memory area */
300-
{
301-
char*bufptr;
289+
ClogCtl= (ClogCtlData*)
290+
ShmemInitStruct("CLOG Ctl",
291+
MAXALIGN(sizeof(ClogCtlData)+
292+
CLOG_BLCKSZ*NUM_CLOG_BUFFERS),
293+
&found);
294+
Assert(!found);
302295

303-
Assert(!found);
296+
memset(ClogCtl,0,sizeof(ClogCtlData));
304297

305-
memset(ClogCtl,0,sizeof(ClogCtlData));
306-
307-
bufptr= (char*)ClogCtl+sizeof(ClogCtlData);
308-
309-
for (slotno=0;slotno<NUM_CLOG_BUFFERS;slotno++)
310-
{
311-
ClogCtl->page_buffer[slotno]=bufptr;
312-
ClogCtl->page_status[slotno]=CLOG_PAGE_EMPTY;
313-
bufptr+=CLOG_BLCKSZ;
314-
}
298+
bufptr= ((char*)ClogCtl)+sizeof(ClogCtlData);
315299

316-
/* ClogCtl->latest_page_number will be set later */
300+
for (slotno=0;slotno<NUM_CLOG_BUFFERS;slotno++)
301+
{
302+
ClogCtl->page_buffer[slotno]=bufptr;
303+
ClogCtl->page_status[slotno]=CLOG_PAGE_EMPTY;
304+
ClogBufferLocks[slotno]=LWLockAssign();
305+
bufptr+=CLOG_BLCKSZ;
317306
}
318-
else
319-
Assert(found);
320-
321-
/* Handle ClogBufferLocks */
322-
323-
#ifdefEXEC_BACKEND
324-
ClogBufferLocks= (LWLockId*)ShmemInitStruct("CLOG Buffer Locks",
325-
NUM_CLOG_BUFFERS*sizeof(LWLockId),&found);
326-
Assert((!found&& !IsUnderPostmaster)|| (found&&IsUnderPostmaster));
327-
#else
328-
ClogBufferLocks=malloc(NUM_CLOG_BUFFERS*sizeof(LWLockId));
329-
Assert(ClogBufferLocks);
330-
#endif
331-
332-
if (!IsUnderPostmaster)
333-
for (slotno=0;slotno<NUM_CLOG_BUFFERS;slotno++)
334-
ClogBufferLocks[slotno]=LWLockAssign();
307+
308+
/* ClogCtl->latest_page_number will be set later */
335309

336310
/* Init CLOG directory path */
337311
snprintf(ClogDir,MAXPGPATH,"%s/pg_clog",DataDir);

‎src/backend/bootstrap/bootstrap.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.149 2003/05/02 21:52:42 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.150 2003/05/02 21:59:31 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -301,11 +301,6 @@ BootstrapMain(int argc, char *argv[])
301301

302302
Assert(dbName);
303303

304-
if (IsUnderPostmaster&&ExecBackend&&MyProc/* ordinary backend */)
305-
{
306-
AttachSharedMemoryAndSemaphores();
307-
}
308-
309304
if (!IsUnderPostmaster)
310305
{
311306
if (!potential_DataDir)

‎src/backend/postmaster/postmaster.c

Lines changed: 47 additions & 43 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.316 2003/05/02 21:52:42 momjian Exp $
40+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.317 2003/05/02 21:59:31 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -172,13 +172,6 @@ static intServerSock_INET = INVALID_SOCK;/* stream socket server */
172172
staticintServerSock_UNIX=INVALID_SOCK;/* stream socket server */
173173
#endif
174174

175-
/* Used to reduce macros tests */
176-
#ifdefEXEC_BACKEND
177-
constboolExecBackend= true;
178-
#else
179-
constboolExecBackend= false;
180-
#endif
181-
182175
/*
183176
* Set by the -o option
184177
*/
@@ -263,11 +256,12 @@ static void dummy_handler(SIGNAL_ARGS);
263256
staticvoidCleanupProc(intpid,intexitstatus);
264257
staticvoidLogChildExit(intlev,constchar*procname,
265258
intpid,intexitstatus);
266-
staticintDoBackend(Port*port);
259+
staticintBackendFinalize(Port*port);
267260
voidExitPostmaster(intstatus);
268261
staticvoidusage(constchar*);
269262
staticintServerLoop(void);
270263
staticintBackendStartup(Port*port);
264+
staticvoidBackendFork(Port*port,Backend*bn);
271265
staticintProcessStartupPacket(Port*port,boolSSLdone);
272266
staticvoidprocessCancelRequest(Port*port,void*pkt);
273267
staticintinitMasks(fd_set*rmask,fd_set*wmask);
@@ -577,6 +571,9 @@ PostmasterMain(int argc, char *argv[])
577571
SetDataDir(potential_DataDir);
578572

579573
ProcessConfigFile(PGC_POSTMASTER);
574+
#ifdefEXEC_BACKEND
575+
write_nondefault_variables(PGC_POSTMASTER);
576+
#endif
580577

581578
/*
582579
* Check for invalid combinations of GUC settings.
@@ -1238,7 +1235,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)
12381235
* Now fetch parameters out of startup packet and save them into the
12391236
* Port structure. All data structures attached to the Port struct
12401237
* must be allocated in TopMemoryContext so that they won't disappear
1241-
* when we pass them to PostgresMain (seeDoBackend). We need not worry
1238+
* when we pass them to PostgresMain (seeBackendFinalize). We need not worry
12421239
* about leaking this storage on failure, since we aren't in the postmaster
12431240
* process anymore.
12441241
*/
@@ -1410,11 +1407,7 @@ processCancelRequest(Port *port, void *pkt)
14101407
elog(DEBUG1,"processCancelRequest: CheckPointPID in cancel request for process %d",backendPID);
14111408
return;
14121409
}
1413-
elseif (ExecBackend)
1414-
{
1415-
AttachSharedMemoryAndSemaphores();
1416-
}
1417-
1410+
14181411
/* See if we have a matching backend */
14191412

14201413
for (curr=DLGetHead(BackendList);curr;curr=DLGetSucc(curr))
@@ -1579,6 +1572,9 @@ SIGHUP_handler(SIGNAL_ARGS)
15791572
elog(LOG,"Received SIGHUP, reloading configuration files");
15801573
SignalChildren(SIGHUP);
15811574
ProcessConfigFile(PGC_SIGHUP);
1575+
#ifdefEXEC_BACKEND
1576+
write_nondefault_variables(PGC_SIGHUP);
1577+
#endif
15821578
load_hba();
15831579
load_ident();
15841580
}
@@ -2064,28 +2060,7 @@ BackendStartup(Port *port)
20642060
pid=fork();
20652061

20662062
if (pid==0)/* child */
2067-
{
2068-
intstatus;
2069-
2070-
#ifdefLINUX_PROFILE
2071-
setitimer(ITIMER_PROF,&prof_itimer,NULL);
2072-
#endif
2073-
2074-
#ifdef__BEOS__
2075-
/* Specific beos backend startup actions */
2076-
beos_backend_startup();
2077-
#endif
2078-
free(bn);
2079-
2080-
status=DoBackend(port);
2081-
if (status!=0)
2082-
{
2083-
elog(LOG,"connection startup failed");
2084-
proc_exit(status);
2085-
}
2086-
else
2087-
proc_exit(0);
2088-
}
2063+
BackendFork(port,bn);/* never returns */
20892064

20902065
/* in parent, error */
20912066
if (pid<0)
@@ -2119,6 +2094,31 @@ BackendStartup(Port *port)
21192094
}
21202095

21212096

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+
21222122
/*
21232123
* Try to report backend fork() failure to client before we close the
21242124
* connection.Since we do not care to risk blocking the postmaster on
@@ -2184,7 +2184,7 @@ split_opts(char **argv, int *argcp, char *s)
21842184
}
21852185

21862186
/*
2187-
*DoBackend -- perform authentication, and if successful, set up the
2187+
*BackendFinalize -- perform authentication, and if successful, set up the
21882188
*backend's argument list and invoke backend main().
21892189
*
21902190
* This used to perform an execv() but we no longer exec the backend;
@@ -2195,7 +2195,7 @@ split_opts(char **argv, int *argcp, char *s)
21952195
*If PostgresMain() fails, return status.
21962196
*/
21972197
staticint
2198-
DoBackend(Port*port)
2198+
BackendFinalize(Port*port)
21992199
{
22002200
char*remote_host;
22012201
char**av;
@@ -2232,6 +2232,10 @@ DoBackend(Port *port)
22322232
/* Reset MyProcPid to new backend's pid */
22332233
MyProcPid=getpid();
22342234

2235+
#ifdefEXEC_BACKEND
2236+
read_nondefault_variables();
2237+
#endif
2238+
22352239
/*
22362240
* Initialize libpq and enable reporting of elog errors to the client.
22372241
* Must do this now because authentication uses libpq to send
@@ -2259,7 +2263,7 @@ DoBackend(Port *port)
22592263
unsigned shortremote_port;
22602264
char*host_addr;
22612265
#ifdefHAVE_IPV6
2262-
charip_hostinfo[INET6_ADDRSTRLEN];
2266+
charip_hostinfo[INET6_ADDRSTRLEN];
22632267
#else
22642268
charip_hostinfo[INET_ADDRSTRLEN];
22652269
#endif
@@ -2305,7 +2309,7 @@ DoBackend(Port *port)
23052309
}
23062310
else
23072311
{
2308-
/* not AF_INET */
2312+
/* not AF_INET */
23092313
remote_host="[local]";
23102314

23112315
if (Log_connections)
@@ -2329,7 +2333,7 @@ DoBackend(Port *port)
23292333
* indefinitely. PreAuthDelay doesn't count against the time limit.
23302334
*/
23312335
if (!enable_sig_alarm(AuthenticationTimeout*1000, false))
2332-
elog(FATAL,"DoBackend: Unable to set timer for auth timeout");
2336+
elog(FATAL,"BackendFinalize: Unable to set timer for auth timeout");
23332337

23342338
/*
23352339
* Receive the startup packet (which might turn out to be a cancel
@@ -2358,7 +2362,7 @@ DoBackend(Port *port)
23582362
* SIGTERM/SIGQUIT again until backend startup is complete.
23592363
*/
23602364
if (!disable_sig_alarm(false))
2361-
elog(FATAL,"DoBackend: Unable to disable timer for auth timeout");
2365+
elog(FATAL,"BackendFinalize: Unable to disable timer for auth timeout");
23622366
PG_SETMASK(&BlockSig);
23632367

23642368
if (Log_connections)

‎src/backend/storage/ipc/ipci.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.50 2003/05/02 21:52:42 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.51 2003/05/02 21:59:31 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -134,16 +134,3 @@ CreateSharedMemoryAndSemaphores(bool makePrivate,
134134
*/
135135
PMSignalInit();
136136
}
137-
138-
139-
/*
140-
* AttachSharedMemoryAndSemaphores
141-
*Attaches to the existing shared resources when exec()'d off
142-
*by the postmaster.
143-
*/
144-
void
145-
AttachSharedMemoryAndSemaphores(void)
146-
{
147-
CLOGShmemInit();
148-
}
149-

‎src/backend/tcop/postgres.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.328 2003/05/02 21:52:42 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.329 2003/05/02 21:59:31 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1453,7 +1453,6 @@ PostgresMain(int argc, char *argv[], const char *username)
14531453
break;
14541454
}
14551455

1456-
14571456
/*
14581457
* -d is not the same as setting
14591458
* log_min_messages because it enables other
@@ -1578,9 +1577,6 @@ PostgresMain(int argc, char *argv[], const char *username)
15781577
* restart... */
15791578
}
15801579
BaseInit();
1581-
#ifdefEXECBACKEND
1582-
AttachSharedMemoryAndSemaphores();
1583-
#endif
15841580
}
15851581
else
15861582
{
@@ -1676,7 +1672,7 @@ PostgresMain(int argc, char *argv[], const char *username)
16761672
if (!IsUnderPostmaster)
16771673
{
16781674
puts("\nPOSTGRES backend interactive interface ");
1679-
puts("$Revision: 1.328 $ $Date: 2003/05/02 21:52:42 $\n");
1675+
puts("$Revision: 1.329 $ $Date: 2003/05/02 21:59:31 $\n");
16801676
}
16811677

16821678
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp