Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
9bcf350c
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,发现更多精彩内容 >>
提交
9bcf350c
编写于
11月 17, 1997
作者:
M
Marc G. Fournier
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Apply Bryan's IPC Patches
From: Bryan Henderson <bryanh@giraffe.netgate.net>
上级
930bce33
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
56 addition
and
19 deletion
+56
-19
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+38
-8
src/backend/utils/init/postinit.c
src/backend/utils/init/postinit.c
+18
-11
未找到文件。
src/backend/postmaster/postmaster.c
浏览文件 @
9bcf350c
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.6
1 1997/11/10 05:10:21 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.6
2 1997/11/17 03:47:28 scrappy
Exp $
*
* NOTES
*
...
...
@@ -123,6 +123,32 @@ static Dllist *PortList;
static
short
PostPortName
=
-
1
;
static
short
ActiveBackends
=
FALSE
;
/* This is a boolean indicating that there is at least one backend
that is accessing the current shared memory and semaphores.
Between the time that we start up, or throw away shared memory
segments and start over, and the time we generate the next
backend (because we received a connection request), it is false.
Other times, it is true.
*/
static
short
shmem_seq
=
0
;
/* This is a sequence number that indicates how many times we've had
to throw away the shared memory and start over because we doubted
its integrity. It starts off at zero and is incremented every
time we start over. We use this to ensure that we use a new
IPC shared memory key for the new shared memory segment in case
the old segment isn't entirely gone yet.
The sequence actually cycles back to 0 after 9, so pathologically
there could be an IPC failure if 10 sets of backends are all stuck
and won't release IPC resources.
*/
static
IpcMemoryKey
ipc_key
;
/* This is the base IPC shared memory key. Other keys are generated by
adding to this.
*/
static
int
NextBackendId
=
MAXINT
;
/* XXX why? */
static
char
*
progname
=
(
char
*
)
NULL
;
...
...
@@ -904,11 +930,11 @@ ConnCreate(int serverFd, int *newFdP)
static
void
reset_shared
(
short
port
)
{
IPCKey
key
;
key
=
SystemPortAddressCreateIPCKey
((
SystemPortAddress
)
port
)
;
CreateSharedMemoryAndSemaphores
(
key
)
;
ActiveBackends
=
FALSE
;
ipc_key
=
port
*
1000
+
shmem_seq
*
100
;
CreateSharedMemoryAndSemaphores
(
ipc_key
);
ActiveBackends
=
FALSE
;
shmem_seq
+=
1
;
if
(
shmem_seq
>=
10
)
shmem_seq
-=
10
;
}
/*
...
...
@@ -1079,9 +1105,10 @@ BackendStartup(StartupInfo *packet, /* client's startup packet */
Backend
*
bn
;
/* for backend cleanup */
int
pid
,
i
;
static
char
envEntry
[
4
][
2
*
ARGV_SIZE
];
#define NR_ENVIRONMENT_VBL 5
static
char
envEntry
[
NR_ENVIRONMENT_VBL
][
2
*
ARGV_SIZE
];
for
(
i
=
0
;
i
<
4
;
++
i
)
for
(
i
=
0
;
i
<
NR_ENVIRONMENT_VBL
;
++
i
)
{
MemSet
(
envEntry
[
i
],
0
,
2
*
ARGV_SIZE
);
}
...
...
@@ -1101,6 +1128,9 @@ BackendStartup(StartupInfo *packet, /* client's startup packet */
sprintf
(
envEntry
[
3
],
"PGDATA=%s"
,
DataDir
);
putenv
(
envEntry
[
3
]);
}
sprintf
(
envEntry
[
4
],
"IPC_KEY=%d"
,
ipc_key
);
putenv
(
envEntry
[
4
]);
if
(
DebugLvl
>
2
)
{
char
**
p
;
...
...
src/backend/utils/init/postinit.c
浏览文件 @
9bcf350c
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.1
7 1997/11/10 15:15:40 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.1
8 1997/11/17 03:47:31 scrappy
Exp $
*
* NOTES
* InitPostgres() is the function called from PostgresMain
...
...
@@ -281,8 +281,9 @@ InitUserid()
static
void
InitCommunication
()
{
char
*
postid
;
char
*
postport
;
char
*
postid
;
/* value of environment variable */
char
*
postport
;
/* value of environment variable */
char
*
ipc_key
;
/* value of environemnt variable */
IPCKey
key
=
0
;
/* ----------------
...
...
@@ -302,10 +303,15 @@ InitCommunication()
Assert
(
MyBackendTag
>=
0
);
}
/* ----------------
* try and get the ipc key from POSTPORT
* ----------------
*/
ipc_key
=
getenv
(
"IPC_KEY"
);
if
(
!
PointerIsValid
(
ipc_key
))
{
key
=
-
1
;
}
else
{
key
=
atoi
(
ipc_key
);
Assert
(
MyBackendTag
>=
0
);
}
postport
=
getenv
(
"POSTPORT"
);
if
(
PointerIsValid
(
postport
))
...
...
@@ -315,8 +321,6 @@ InitCommunication()
if
(
MyBackendTag
==
-
1
)
elog
(
FATAL
,
"InitCommunication: missing POSTID"
);
key
=
SystemPortAddressCreateIPCKey
(
address
);
/*
* Enable this if you are trying to force the backend to run as if
* it is running under the postmaster.
...
...
@@ -328,8 +332,11 @@ InitCommunication()
* To enable emulation, run the following shell commands (in addition
* to enabling this goto)
*
* % setenv POSTID 1 % setenv POSTPORT 4321 % postmaster & % kill -9
* %1
* % setenv POSTID 1
* % setenv POSTPORT 4321
* % setenv IPC_KEY 4321000
* % postmaster &
* % kill -9 %1
*
* Upon doing this, Postmaster will have allocated the shared memory
* resources that Postgres will attach to if you enable
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录