Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
a2e038fb
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a2e038fb
编写于
5月 02, 2003
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Back out last commit --- wrong patch.
上级
fb1f7cce
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
283 addition
and
122 deletion
+283
-122
src/backend/access/transam/clog.c
src/backend/access/transam/clog.c
+21
-47
src/backend/bootstrap/bootstrap.c
src/backend/bootstrap/bootstrap.c
+1
-6
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+47
-43
src/backend/storage/ipc/ipci.c
src/backend/storage/ipc/ipci.c
+1
-14
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+2
-6
src/backend/utils/misc/guc.c
src/backend/utils/misc/guc.c
+203
-1
src/include/miscadmin.h
src/include/miscadmin.h
+1
-2
src/include/storage/ipc.h
src/include/storage/ipc.h
+1
-2
src/include/utils/guc.h
src/include/utils/guc.h
+6
-1
未找到文件。
src/backend/access/transam/clog.c
浏览文件 @
a2e038fb
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Header: /cvsroot/pgsql/src/backend/access/transam/clog.c,v 1.1
3 2003/05/02 21:52:42
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/clog.c,v 1.1
4 2003/05/02 21:59:31
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -157,7 +157,7 @@ static ClogCtlData *ClogCtl = NULL;
...
@@ -157,7 +157,7 @@ static ClogCtlData *ClogCtl = NULL;
* The value is automatically inherited by backends via fork, and
* The value is automatically inherited by backends via fork, and
* doesn't need to be in shared memory.
* doesn't need to be in shared memory.
*/
*/
static
LWLockId
*
ClogBufferLocks
;
/* Per-buffer I/O locks */
static
LWLockId
ClogBufferLocks
[
NUM_CLOG_BUFFERS
]
;
/* Per-buffer I/O locks */
/*
/*
* ClogDir is set during CLOGShmemInit and does not change thereafter.
* ClogDir is set during CLOGShmemInit and does not change thereafter.
...
@@ -271,67 +271,41 @@ TransactionIdGetStatus(TransactionId xid)
...
@@ -271,67 +271,41 @@ TransactionIdGetStatus(TransactionId xid)
/*
/*
* Initialization of shared memory for CLOG
* Initialization of shared memory for CLOG
*/
*/
int
int
CLOGShmemSize
(
void
)
CLOGShmemSize
(
void
)
{
{
return
MAXALIGN
(
sizeof
(
ClogCtlData
)
+
CLOG_BLCKSZ
*
NUM_CLOG_BUFFERS
)
return
MAXALIGN
(
sizeof
(
ClogCtlData
)
+
CLOG_BLCKSZ
*
NUM_CLOG_BUFFERS
);
#ifdef EXEC_BACKEND
+
MAXALIGN
(
NUM_CLOG_BUFFERS
*
sizeof
(
LWLockId
))
#endif
;
}
}
void
void
CLOGShmemInit
(
void
)
CLOGShmemInit
(
void
)
{
{
bool
found
;
bool
found
;
char
*
bufptr
;
int
slotno
;
int
slotno
;
/* Handle ClogCtl */
/* this must agree with space requested by CLOGShmemSize() */
/* this must agree with space requested by CLOGShmemSize() */
ClogCtl
=
(
ClogCtlData
*
)
ShmemInitStruct
(
"CLOG Ctl"
,
ClogCtl
=
(
ClogCtlData
*
)
ShmemInitStruct
(
"CLOG Ctl"
,
MAXALIGN
(
sizeof
(
ClogCtlData
)
+
MAXALIGN
(
sizeof
(
ClogCtlData
)
+
CLOG_BLCKSZ
*
NUM_CLOG_BUFFERS
),
&
found
);
CLOG_BLCKSZ
*
NUM_CLOG_BUFFERS
),
&
found
);
if
(
!
IsUnderPostmaster
)
/* Initialize ClogCtl shared memory area */
{
char
*
bufptr
;
Assert
(
!
found
);
Assert
(
!
found
);
memset
(
ClogCtl
,
0
,
sizeof
(
ClogCtlData
));
memset
(
ClogCtl
,
0
,
sizeof
(
ClogCtlData
));
bufptr
=
(
char
*
)
ClogCtl
+
sizeof
(
ClogCtlData
);
bufptr
=
((
char
*
)
ClogCtl
)
+
sizeof
(
ClogCtlData
);
for
(
slotno
=
0
;
slotno
<
NUM_CLOG_BUFFERS
;
slotno
++
)
for
(
slotno
=
0
;
slotno
<
NUM_CLOG_BUFFERS
;
slotno
++
)
{
{
ClogCtl
->
page_buffer
[
slotno
]
=
bufptr
;
ClogCtl
->
page_buffer
[
slotno
]
=
bufptr
;
ClogCtl
->
page_status
[
slotno
]
=
CLOG_PAGE_EMPTY
;
ClogCtl
->
page_status
[
slotno
]
=
CLOG_PAGE_EMPTY
;
ClogBufferLocks
[
slotno
]
=
LWLockAssign
();
bufptr
+=
CLOG_BLCKSZ
;
bufptr
+=
CLOG_BLCKSZ
;
}
}
/* ClogCtl->latest_page_number will be set later */
/* ClogCtl->latest_page_number will be set later */
}
else
Assert
(
found
);
/* Handle ClogBufferLocks */
#ifdef EXEC_BACKEND
ClogBufferLocks
=
(
LWLockId
*
)
ShmemInitStruct
(
"CLOG Buffer Locks"
,
NUM_CLOG_BUFFERS
*
sizeof
(
LWLockId
),
&
found
);
Assert
((
!
found
&&
!
IsUnderPostmaster
)
||
(
found
&&
IsUnderPostmaster
));
#else
ClogBufferLocks
=
malloc
(
NUM_CLOG_BUFFERS
*
sizeof
(
LWLockId
));
Assert
(
ClogBufferLocks
);
#endif
if
(
!
IsUnderPostmaster
)
for
(
slotno
=
0
;
slotno
<
NUM_CLOG_BUFFERS
;
slotno
++
)
ClogBufferLocks
[
slotno
]
=
LWLockAssign
();
/* Init CLOG directory path */
/* Init CLOG directory path */
snprintf
(
ClogDir
,
MAXPGPATH
,
"%s/pg_clog"
,
DataDir
);
snprintf
(
ClogDir
,
MAXPGPATH
,
"%s/pg_clog"
,
DataDir
);
...
...
src/backend/bootstrap/bootstrap.c
浏览文件 @
a2e038fb
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.1
49 2003/05/02 21:52:42
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.1
50 2003/05/02 21:59:31
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -301,11 +301,6 @@ BootstrapMain(int argc, char *argv[])
...
@@ -301,11 +301,6 @@ BootstrapMain(int argc, char *argv[])
Assert
(
dbName
);
Assert
(
dbName
);
if
(
IsUnderPostmaster
&&
ExecBackend
&&
MyProc
/* ordinary backend */
)
{
AttachSharedMemoryAndSemaphores
();
}
if
(
!
IsUnderPostmaster
)
if
(
!
IsUnderPostmaster
)
{
{
if
(
!
potential_DataDir
)
if
(
!
potential_DataDir
)
...
...
src/backend/postmaster/postmaster.c
浏览文件 @
a2e038fb
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.31
6 2003/05/02 21:52:42
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.31
7 2003/05/02 21:59:31
momjian Exp $
*
*
* NOTES
* NOTES
*
*
...
@@ -172,13 +172,6 @@ static int ServerSock_INET = INVALID_SOCK; /* stream socket server */
...
@@ -172,13 +172,6 @@ static int ServerSock_INET = INVALID_SOCK; /* stream socket server */
static
int
ServerSock_UNIX
=
INVALID_SOCK
;
/* stream socket server */
static
int
ServerSock_UNIX
=
INVALID_SOCK
;
/* stream socket server */
#endif
#endif
/* Used to reduce macros tests */
#ifdef EXEC_BACKEND
const
bool
ExecBackend
=
true
;
#else
const
bool
ExecBackend
=
false
;
#endif
/*
/*
* Set by the -o option
* Set by the -o option
*/
*/
...
@@ -263,11 +256,12 @@ static void dummy_handler(SIGNAL_ARGS);
...
@@ -263,11 +256,12 @@ static void dummy_handler(SIGNAL_ARGS);
static
void
CleanupProc
(
int
pid
,
int
exitstatus
);
static
void
CleanupProc
(
int
pid
,
int
exitstatus
);
static
void
LogChildExit
(
int
lev
,
const
char
*
procname
,
static
void
LogChildExit
(
int
lev
,
const
char
*
procname
,
int
pid
,
int
exitstatus
);
int
pid
,
int
exitstatus
);
static
int
DoBackend
(
Port
*
port
);
static
int
BackendFinalize
(
Port
*
port
);
void
ExitPostmaster
(
int
status
);
void
ExitPostmaster
(
int
status
);
static
void
usage
(
const
char
*
);
static
void
usage
(
const
char
*
);
static
int
ServerLoop
(
void
);
static
int
ServerLoop
(
void
);
static
int
BackendStartup
(
Port
*
port
);
static
int
BackendStartup
(
Port
*
port
);
static
void
BackendFork
(
Port
*
port
,
Backend
*
bn
);
static
int
ProcessStartupPacket
(
Port
*
port
,
bool
SSLdone
);
static
int
ProcessStartupPacket
(
Port
*
port
,
bool
SSLdone
);
static
void
processCancelRequest
(
Port
*
port
,
void
*
pkt
);
static
void
processCancelRequest
(
Port
*
port
,
void
*
pkt
);
static
int
initMasks
(
fd_set
*
rmask
,
fd_set
*
wmask
);
static
int
initMasks
(
fd_set
*
rmask
,
fd_set
*
wmask
);
...
@@ -577,6 +571,9 @@ PostmasterMain(int argc, char *argv[])
...
@@ -577,6 +571,9 @@ PostmasterMain(int argc, char *argv[])
SetDataDir
(
potential_DataDir
);
SetDataDir
(
potential_DataDir
);
ProcessConfigFile
(
PGC_POSTMASTER
);
ProcessConfigFile
(
PGC_POSTMASTER
);
#ifdef EXEC_BACKEND
write_nondefault_variables
(
PGC_POSTMASTER
);
#endif
/*
/*
* Check for invalid combinations of GUC settings.
* Check for invalid combinations of GUC settings.
...
@@ -1238,7 +1235,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)
...
@@ -1238,7 +1235,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)
* Now fetch parameters out of startup packet and save them into the
* Now fetch parameters out of startup packet and save them into the
* Port structure. All data structures attached to the Port struct
* Port structure. All data structures attached to the Port struct
* must be allocated in TopMemoryContext so that they won't disappear
* must be allocated in TopMemoryContext so that they won't disappear
* when we pass them to PostgresMain (see
DoBackend
). We need not worry
* when we pass them to PostgresMain (see
BackendFinalize
). We need not worry
* about leaking this storage on failure, since we aren't in the postmaster
* about leaking this storage on failure, since we aren't in the postmaster
* process anymore.
* process anymore.
*/
*/
...
@@ -1410,10 +1407,6 @@ processCancelRequest(Port *port, void *pkt)
...
@@ -1410,10 +1407,6 @@ processCancelRequest(Port *port, void *pkt)
elog
(
DEBUG1
,
"processCancelRequest: CheckPointPID in cancel request for process %d"
,
backendPID
);
elog
(
DEBUG1
,
"processCancelRequest: CheckPointPID in cancel request for process %d"
,
backendPID
);
return
;
return
;
}
}
else
if
(
ExecBackend
)
{
AttachSharedMemoryAndSemaphores
();
}
/* See if we have a matching backend */
/* See if we have a matching backend */
...
@@ -1579,6 +1572,9 @@ SIGHUP_handler(SIGNAL_ARGS)
...
@@ -1579,6 +1572,9 @@ SIGHUP_handler(SIGNAL_ARGS)
elog
(
LOG
,
"Received SIGHUP, reloading configuration files"
);
elog
(
LOG
,
"Received SIGHUP, reloading configuration files"
);
SignalChildren
(
SIGHUP
);
SignalChildren
(
SIGHUP
);
ProcessConfigFile
(
PGC_SIGHUP
);
ProcessConfigFile
(
PGC_SIGHUP
);
#ifdef EXEC_BACKEND
write_nondefault_variables
(
PGC_SIGHUP
);
#endif
load_hba
();
load_hba
();
load_ident
();
load_ident
();
}
}
...
@@ -2064,28 +2060,7 @@ BackendStartup(Port *port)
...
@@ -2064,28 +2060,7 @@ BackendStartup(Port *port)
pid
=
fork
();
pid
=
fork
();
if
(
pid
==
0
)
/* child */
if
(
pid
==
0
)
/* child */
{
BackendFork
(
port
,
bn
);
/* never returns */
int
status
;
#ifdef LINUX_PROFILE
setitimer
(
ITIMER_PROF
,
&
prof_itimer
,
NULL
);
#endif
#ifdef __BEOS__
/* Specific beos backend startup actions */
beos_backend_startup
();
#endif
free
(
bn
);
status
=
DoBackend
(
port
);
if
(
status
!=
0
)
{
elog
(
LOG
,
"connection startup failed"
);
proc_exit
(
status
);
}
else
proc_exit
(
0
);
}
/* in parent, error */
/* in parent, error */
if
(
pid
<
0
)
if
(
pid
<
0
)
...
@@ -2119,6 +2094,31 @@ BackendStartup(Port *port)
...
@@ -2119,6 +2094,31 @@ BackendStartup(Port *port)
}
}
static
void
BackendFork
(
Port
*
port
,
Backend
*
bn
)
{
int
status
;
#ifdef LINUX_PROFILE
setitimer
(
ITIMER_PROF
,
&
prof_itimer
,
NULL
);
#endif
#ifdef __BEOS__
/* Specific beos backend startup actions */
beos_backend_startup
();
#endif
free
(
bn
);
status
=
BackendFinalize
(
port
);
if
(
status
!=
0
)
{
elog
(
LOG
,
"connection startup failed"
);
proc_exit
(
status
);
}
else
proc_exit
(
0
);
}
/*
/*
* Try to report backend fork() failure to client before we close the
* Try to report backend fork() failure to client before we close the
* connection. Since we do not care to risk blocking the postmaster on
* connection. Since we do not care to risk blocking the postmaster on
...
@@ -2184,7 +2184,7 @@ split_opts(char **argv, int *argcp, char *s)
...
@@ -2184,7 +2184,7 @@ split_opts(char **argv, int *argcp, char *s)
}
}
/*
/*
*
DoBackend
-- perform authentication, and if successful, set up the
*
BackendFinalize
-- perform authentication, and if successful, set up the
* backend's argument list and invoke backend main().
* backend's argument list and invoke backend main().
*
*
* This used to perform an execv() but we no longer exec the backend;
* 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)
...
@@ -2195,7 +2195,7 @@ split_opts(char **argv, int *argcp, char *s)
* If PostgresMain() fails, return status.
* If PostgresMain() fails, return status.
*/
*/
static
int
static
int
DoBackend
(
Port
*
port
)
BackendFinalize
(
Port
*
port
)
{
{
char
*
remote_host
;
char
*
remote_host
;
char
**
av
;
char
**
av
;
...
@@ -2232,6 +2232,10 @@ DoBackend(Port *port)
...
@@ -2232,6 +2232,10 @@ DoBackend(Port *port)
/* Reset MyProcPid to new backend's pid */
/* Reset MyProcPid to new backend's pid */
MyProcPid
=
getpid
();
MyProcPid
=
getpid
();
#ifdef EXEC_BACKEND
read_nondefault_variables
();
#endif
/*
/*
* Initialize libpq and enable reporting of elog errors to the client.
* Initialize libpq and enable reporting of elog errors to the client.
* Must do this now because authentication uses libpq to send
* Must do this now because authentication uses libpq to send
...
@@ -2329,7 +2333,7 @@ DoBackend(Port *port)
...
@@ -2329,7 +2333,7 @@ DoBackend(Port *port)
* indefinitely. PreAuthDelay doesn't count against the time limit.
* indefinitely. PreAuthDelay doesn't count against the time limit.
*/
*/
if
(
!
enable_sig_alarm
(
AuthenticationTimeout
*
1000
,
false
))
if
(
!
enable_sig_alarm
(
AuthenticationTimeout
*
1000
,
false
))
elog
(
FATAL
,
"
DoBackend
: Unable to set timer for auth timeout"
);
elog
(
FATAL
,
"
BackendFinalize
: Unable to set timer for auth timeout"
);
/*
/*
* Receive the startup packet (which might turn out to be a cancel
* Receive the startup packet (which might turn out to be a cancel
...
@@ -2358,7 +2362,7 @@ DoBackend(Port *port)
...
@@ -2358,7 +2362,7 @@ DoBackend(Port *port)
* SIGTERM/SIGQUIT again until backend startup is complete.
* SIGTERM/SIGQUIT again until backend startup is complete.
*/
*/
if
(
!
disable_sig_alarm
(
false
))
if
(
!
disable_sig_alarm
(
false
))
elog
(
FATAL
,
"
DoBackend
: Unable to disable timer for auth timeout"
);
elog
(
FATAL
,
"
BackendFinalize
: Unable to disable timer for auth timeout"
);
PG_SETMASK
(
&
BlockSig
);
PG_SETMASK
(
&
BlockSig
);
if
(
Log_connections
)
if
(
Log_connections
)
...
...
src/backend/storage/ipc/ipci.c
浏览文件 @
a2e038fb
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.5
0 2003/05/02 21:52:42
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.5
1 2003/05/02 21:59:31
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -134,16 +134,3 @@ CreateSharedMemoryAndSemaphores(bool makePrivate,
...
@@ -134,16 +134,3 @@ CreateSharedMemoryAndSemaphores(bool makePrivate,
*/
*/
PMSignalInit
();
PMSignalInit
();
}
}
/*
* AttachSharedMemoryAndSemaphores
* Attaches to the existing shared resources when exec()'d off
* by the postmaster.
*/
void
AttachSharedMemoryAndSemaphores
(
void
)
{
CLOGShmemInit
();
}
src/backend/tcop/postgres.c
浏览文件 @
a2e038fb
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.32
8 2003/05/02 21:52:42
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.32
9 2003/05/02 21:59:31
momjian Exp $
*
*
* NOTES
* NOTES
* this is the "main" module of the postgres backend and
* this is the "main" module of the postgres backend and
...
@@ -1453,7 +1453,6 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1453,7 +1453,6 @@ PostgresMain(int argc, char *argv[], const char *username)
break
;
break
;
}
}
/*
/*
* -d is not the same as setting
* -d is not the same as setting
* log_min_messages because it enables other
* log_min_messages because it enables other
...
@@ -1578,9 +1577,6 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1578,9 +1577,6 @@ PostgresMain(int argc, char *argv[], const char *username)
* restart... */
* restart... */
}
}
BaseInit
();
BaseInit
();
#ifdef EXECBACKEND
AttachSharedMemoryAndSemaphores
();
#endif
}
}
else
else
{
{
...
@@ -1676,7 +1672,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1676,7 +1672,7 @@ PostgresMain(int argc, char *argv[], const char *username)
if
(
!
IsUnderPostmaster
)
if
(
!
IsUnderPostmaster
)
{
{
puts
(
"
\n
POSTGRES backend interactive interface "
);
puts
(
"
\n
POSTGRES backend interactive interface "
);
puts
(
"$Revision: 1.32
8 $ $Date: 2003/05/02 21:52:42
$
\n
"
);
puts
(
"$Revision: 1.32
9 $ $Date: 2003/05/02 21:59:31
$
\n
"
);
}
}
/*
/*
...
...
src/backend/utils/misc/guc.c
浏览文件 @
a2e038fb
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.1
19 2003/04/25 19:45:09 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.1
20 2003/05/02 21:59:31 momjian
Exp $
*
*
*--------------------------------------------------------------------
*--------------------------------------------------------------------
*/
*/
...
@@ -60,6 +60,9 @@
...
@@ -60,6 +60,9 @@
#define PG_KRB_SRVTAB ""
#define PG_KRB_SRVTAB ""
#endif
#endif
#ifdef EXEC_BACKEND
#define CONFIG_EXEC_PARAMS "global/config_exec_params"
#endif
/* XXX these should appear in other modules' header files */
/* XXX these should appear in other modules' header files */
extern
bool
Log_connections
;
extern
bool
Log_connections
;
...
@@ -2801,6 +2804,204 @@ _ShowOption(struct config_generic * record)
...
@@ -2801,6 +2804,204 @@ _ShowOption(struct config_generic * record)
}
}
#ifdef EXEC_BACKEND
/*
* This routine dumps out all non-default GUC options into a binary
* file that is read by all exec'ed backends. The format is:
*
* variable name, string, null terminated
* variable value, string, null terminated
* variable source, integer
*/
void
write_nondefault_variables
(
GucContext
context
)
{
int
i
;
char
*
new_filename
,
*
filename
;
int
elevel
;
FILE
*
fp
;
Assert
(
context
==
PGC_POSTMASTER
||
context
==
PGC_SIGHUP
);
Assert
(
DataDir
);
elevel
=
(
context
==
PGC_SIGHUP
)
?
DEBUG3
:
ERROR
;
/*
* Open file
*/
new_filename
=
malloc
(
strlen
(
DataDir
)
+
strlen
(
CONFIG_EXEC_PARAMS
)
+
strlen
(
".new"
)
+
2
);
filename
=
malloc
(
strlen
(
DataDir
)
+
strlen
(
CONFIG_EXEC_PARAMS
)
+
2
);
if
(
new_filename
==
NULL
||
filename
==
NULL
)
{
elog
(
elevel
,
"out of memory"
);
return
;
}
sprintf
(
new_filename
,
"%s/"
CONFIG_EXEC_PARAMS
".new"
,
DataDir
);
sprintf
(
filename
,
"%s/"
CONFIG_EXEC_PARAMS
,
DataDir
);
fp
=
AllocateFile
(
new_filename
,
"w"
);
if
(
!
fp
)
{
free
(
new_filename
);
free
(
filename
);
elog
(
elevel
,
"could not write exec config params file `"
CONFIG_EXEC_PARAMS
"': %s"
,
strerror
(
errno
));
return
;
}
for
(
i
=
0
;
i
<
num_guc_variables
;
i
++
)
{
struct
config_generic
*
gconf
=
guc_variables
[
i
];
if
(
gconf
->
source
!=
PGC_S_DEFAULT
)
{
fprintf
(
fp
,
"%s"
,
gconf
->
name
);
fputc
(
0
,
fp
);
switch
(
gconf
->
vartype
)
{
case
PGC_BOOL
:
{
struct
config_bool
*
conf
=
(
struct
config_bool
*
)
gconf
;
if
(
*
conf
->
variable
==
0
)
fprintf
(
fp
,
"false"
);
else
fprintf
(
fp
,
"true"
);
}
break
;
case
PGC_INT
:
{
struct
config_int
*
conf
=
(
struct
config_int
*
)
gconf
;
fprintf
(
fp
,
"%d"
,
*
conf
->
variable
);
}
break
;
case
PGC_REAL
:
{
struct
config_real
*
conf
=
(
struct
config_real
*
)
gconf
;
/* Could lose precision here? */
fprintf
(
fp
,
"%f"
,
*
conf
->
variable
);
}
break
;
case
PGC_STRING
:
{
struct
config_string
*
conf
=
(
struct
config_string
*
)
gconf
;
fprintf
(
fp
,
"%s"
,
*
conf
->
variable
);
}
break
;
}
fputc
(
0
,
fp
);
fwrite
(
&
gconf
->
source
,
sizeof
(
gconf
->
source
),
1
,
fp
);
}
}
FreeFile
(
fp
);
/* Put new file in place, this could delay on Win32 */
rename
(
new_filename
,
filename
);
free
(
new_filename
);
free
(
filename
);
return
;
}
/*
* Read string, including null byte from file
*
* Return NULL on EOF and nothing read
*/
static
char
*
read_string_with_null
(
FILE
*
fp
)
{
int
i
=
0
,
ch
,
maxlen
=
256
;
char
*
str
=
NULL
;
do
{
if
((
ch
=
fgetc
(
fp
))
==
EOF
)
{
if
(
i
==
0
)
return
NULL
;
else
elog
(
FATAL
,
"Invalid format of exec config params file"
);
}
if
(
i
==
0
)
str
=
malloc
(
maxlen
);
else
if
(
i
==
maxlen
)
str
=
realloc
(
str
,
maxlen
*=
2
);
str
[
i
++
]
=
ch
;
}
while
(
ch
!=
0
);
return
str
;
}
/*
* This routine loads a previous postmaster dump of its non-default
* settings.
*/
void
read_nondefault_variables
(
void
)
{
char
*
filename
;
FILE
*
fp
;
char
*
varname
,
*
varvalue
;
int
varsource
;
Assert
(
DataDir
);
/*
* Open file
*/
filename
=
malloc
(
strlen
(
DataDir
)
+
strlen
(
CONFIG_EXEC_PARAMS
)
+
2
);
if
(
filename
==
NULL
)
{
elog
(
ERROR
,
"out of memory"
);
return
;
}
sprintf
(
filename
,
"%s/"
CONFIG_EXEC_PARAMS
,
DataDir
);
fp
=
AllocateFile
(
filename
,
"r"
);
if
(
!
fp
)
{
free
(
filename
);
/* File not found is fine */
if
(
errno
!=
ENOENT
)
elog
(
FATAL
,
"could not read exec config params file `"
CONFIG_EXEC_PARAMS
"': %s"
,
strerror
(
errno
));
return
;
}
while
(
1
)
{
if
((
varname
=
read_string_with_null
(
fp
))
==
NULL
)
break
;
if
((
varvalue
=
read_string_with_null
(
fp
))
==
NULL
)
elog
(
FATAL
,
"Invalid format of exec config params file"
);
if
(
fread
(
&
varsource
,
sizeof
(
varsource
),
1
,
fp
)
==
0
)
elog
(
FATAL
,
"Invalid format of exec config params file"
);
(
void
)
set_config_option
(
varname
,
varvalue
,
PGC_POSTMASTER
,
varsource
,
false
,
true
);
free
(
varname
);
free
(
varvalue
);
}
FreeFile
(
fp
);
free
(
filename
);
return
;
}
#endif
/*
/*
* A little "long argument" simulation, although not quite GNU
* A little "long argument" simulation, although not quite GNU
* compliant. Takes a string of the form "some-option=some value" and
* compliant. Takes a string of the form "some-option=some value" and
...
@@ -3203,3 +3404,4 @@ assign_msglvl(int *var, const char *newval, bool doit, bool interactive)
...
@@ -3203,3 +3404,4 @@ assign_msglvl(int *var, const char *newval, bool doit, bool interactive)
#include "guc-file.c"
#include "guc-file.c"
src/include/miscadmin.h
浏览文件 @
a2e038fb
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: miscadmin.h,v 1.1
19 2003/05/02 21:52:42
momjian Exp $
* $Id: miscadmin.h,v 1.1
20 2003/05/02 21:59:31
momjian Exp $
*
*
* NOTES
* NOTES
* some of the information in this file should be moved to
* some of the information in this file should be moved to
...
@@ -106,7 +106,6 @@ extern void ProcessInterrupts(void);
...
@@ -106,7 +106,6 @@ extern void ProcessInterrupts(void);
*/
*/
extern
bool
IsUnderPostmaster
;
extern
bool
IsUnderPostmaster
;
extern
bool
ClientAuthInProgress
;
extern
bool
ClientAuthInProgress
;
extern
const
bool
ExecBackend
;
extern
int
PostmasterMain
(
int
argc
,
char
*
argv
[]);
extern
int
PostmasterMain
(
int
argc
,
char
*
argv
[]);
extern
void
ClosePostmasterPorts
(
bool
pgstat_too
);
extern
void
ClosePostmasterPorts
(
bool
pgstat_too
);
...
...
src/include/storage/ipc.h
浏览文件 @
a2e038fb
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: ipc.h,v 1.5
8 2003/05/02 21:52:42
momjian Exp $
* $Id: ipc.h,v 1.5
9 2003/05/02 21:59:31
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -32,6 +32,5 @@ extern void on_exit_reset(void);
...
@@ -32,6 +32,5 @@ extern void on_exit_reset(void);
extern
void
CreateSharedMemoryAndSemaphores
(
bool
makePrivate
,
extern
void
CreateSharedMemoryAndSemaphores
(
bool
makePrivate
,
int
maxBackends
,
int
maxBackends
,
int
port
);
int
port
);
extern
void
AttachSharedMemoryAndSemaphores
(
void
);
#endif
/* IPC_H */
#endif
/* IPC_H */
src/include/utils/guc.h
浏览文件 @
a2e038fb
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Copyright 2000-2003 by PostgreSQL Global Development Group
* Copyright 2000-2003 by PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
*
* $Id: guc.h,v 1.2
7 2003/04/25 19:45:09 tgl
Exp $
* $Id: guc.h,v 1.2
8 2003/05/02 21:59:31 momjian
Exp $
*--------------------------------------------------------------------
*--------------------------------------------------------------------
*/
*/
#ifndef GUC_H
#ifndef GUC_H
...
@@ -135,4 +135,9 @@ extern void ProcessGUCArray(ArrayType *array, GucSource source);
...
@@ -135,4 +135,9 @@ extern void ProcessGUCArray(ArrayType *array, GucSource source);
extern
ArrayType
*
GUCArrayAdd
(
ArrayType
*
array
,
const
char
*
name
,
const
char
*
value
);
extern
ArrayType
*
GUCArrayAdd
(
ArrayType
*
array
,
const
char
*
name
,
const
char
*
value
);
extern
ArrayType
*
GUCArrayDelete
(
ArrayType
*
array
,
const
char
*
name
);
extern
ArrayType
*
GUCArrayDelete
(
ArrayType
*
array
,
const
char
*
name
);
#ifdef EXEC_BACKEND
void
write_nondefault_variables
(
GucContext
context
);
void
read_nondefault_variables
(
void
);
#endif
#endif
/* GUC_H */
#endif
/* GUC_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录