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

Commitfb1f7cc

Browse files
committed
Dump/read non-default GUC values for use by exec'ed backends, for Win32.
1 parentde28dc9 commitfb1f7cc

File tree

7 files changed

+90
-29
lines changed

7 files changed

+90
-29
lines changed

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

Lines changed: 47 additions & 21 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.12 2003/04/14 17:31:33 tgl Exp $
16+
* $Header: /cvsroot/pgsql/src/backend/access/transam/clog.c,v 1.13 2003/05/02 21:52:42 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-
staticLWLockIdClogBufferLocks[NUM_CLOG_BUFFERS];/* Per-buffer I/O locks */
160+
staticLWLockId*ClogBufferLocks;/* Per-buffer I/O locks */
161161

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

284+
281285
void
282286
CLOGShmemInit(void)
283287
{
284288
boolfound;
285-
char*bufptr;
286289
intslotno;
287290

291+
/* Handle ClogCtl */
292+
288293
/* this must agree with space requested by CLOGShmemSize() */
289-
ClogCtl= (ClogCtlData*)
290-
ShmemInitStruct("CLOG Ctl",
291-
MAXALIGN(sizeof(ClogCtlData)+
292-
CLOG_BLCKSZ*NUM_CLOG_BUFFERS),
293-
&found);
294-
Assert(!found);
294+
ClogCtl= (ClogCtlData*)ShmemInitStruct("CLOG Ctl",
295+
MAXALIGN(sizeof(ClogCtlData)+
296+
CLOG_BLCKSZ*NUM_CLOG_BUFFERS),&found);
295297

296-
memset(ClogCtl,0,sizeof(ClogCtlData));
298+
if (!IsUnderPostmaster)
299+
/* Initialize ClogCtl shared memory area */
300+
{
301+
char*bufptr;
297302

298-
bufptr= ((char*)ClogCtl)+sizeof(ClogCtlData);
303+
Assert(!found);
299304

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;
306-
}
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+
}
307315

308-
/* ClogCtl->latest_page_number will be set later */
316+
/* ClogCtl->latest_page_number will be set later */
317+
}
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();
309335

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

‎src/backend/bootstrap/bootstrap.c

Lines changed: 6 additions & 1 deletion
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.148 2003/03/06 00:04:27 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.149 2003/05/02 21:52:42 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -301,6 +301,11 @@ BootstrapMain(int argc, char *argv[])
301301

302302
Assert(dbName);
303303

304+
if (IsUnderPostmaster&&ExecBackend&&MyProc/* ordinary backend */)
305+
{
306+
AttachSharedMemoryAndSemaphores();
307+
}
308+
304309
if (!IsUnderPostmaster)
305310
{
306311
if (!potential_DataDir)

‎src/backend/postmaster/postmaster.c

Lines changed: 13 additions & 2 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.315 2003/04/26 02:57:14 tgl Exp $
40+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.316 2003/05/02 21:52:42 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -172,6 +172,13 @@ 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+
175182
/*
176183
* Set by the -o option
177184
*/
@@ -1403,7 +1410,11 @@ processCancelRequest(Port *port, void *pkt)
14031410
elog(DEBUG1,"processCancelRequest: CheckPointPID in cancel request for process %d",backendPID);
14041411
return;
14051412
}
1406-
1413+
elseif (ExecBackend)
1414+
{
1415+
AttachSharedMemoryAndSemaphores();
1416+
}
1417+
14071418
/* See if we have a matching backend */
14081419

14091420
for (curr=DLGetHead(BackendList);curr;curr=DLGetSucc(curr))

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

Lines changed: 14 additions & 1 deletion
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.49 2002/09/0202:47:03 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.50 2003/05/0221:52:42 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -134,3 +134,16 @@ 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: 6 additions & 2 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.327 2003/05/0220:54:35 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.328 2003/05/0221:52:42 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1453,6 +1453,7 @@ PostgresMain(int argc, char *argv[], const char *username)
14531453
break;
14541454
}
14551455

1456+
14561457
/*
14571458
* -d is not the same as setting
14581459
* log_min_messages because it enables other
@@ -1577,6 +1578,9 @@ PostgresMain(int argc, char *argv[], const char *username)
15771578
* restart... */
15781579
}
15791580
BaseInit();
1581+
#ifdefEXECBACKEND
1582+
AttachSharedMemoryAndSemaphores();
1583+
#endif
15801584
}
15811585
else
15821586
{
@@ -1672,7 +1676,7 @@ PostgresMain(int argc, char *argv[], const char *username)
16721676
if (!IsUnderPostmaster)
16731677
{
16741678
puts("\nPOSTGRES backend interactive interface ");
1675-
puts("$Revision: 1.327 $ $Date: 2003/05/0220:54:35 $\n");
1679+
puts("$Revision: 1.328 $ $Date: 2003/05/0221:52:42 $\n");
16761680
}
16771681

16781682
/*

‎src/include/miscadmin.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $Id: miscadmin.h,v 1.118 2003/04/06 22:45:23 petere Exp $
15+
* $Id: miscadmin.h,v 1.119 2003/05/02 21:52:42 momjian Exp $
1616
*
1717
* NOTES
1818
* some of the information in this file should be moved to
@@ -106,6 +106,7 @@ extern void ProcessInterrupts(void);
106106
*/
107107
externboolIsUnderPostmaster;
108108
externboolClientAuthInProgress;
109+
externconstboolExecBackend;
109110

110111
externintPostmasterMain(intargc,char*argv[]);
111112
externvoidClosePostmasterPorts(boolpgstat_too);

‎src/include/storage/ipc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $Id: ipc.h,v 1.57 2002/09/04 20:31:45 momjian Exp $
14+
* $Id: ipc.h,v 1.58 2003/05/02 21:52:42 momjian Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -32,5 +32,6 @@ extern void on_exit_reset(void);
3232
externvoidCreateSharedMemoryAndSemaphores(boolmakePrivate,
3333
intmaxBackends,
3434
intport);
35+
externvoidAttachSharedMemoryAndSemaphores(void);
3536

3637
#endif/* IPC_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp