Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
9bcf350c
Commit
9bcf350c
authored
Nov 17, 1997
by
Marc G. Fournier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply Bryan's IPC Patches
From: Bryan Henderson <bryanh@giraffe.netgate.net>
parent
930bce33
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
19 deletions
+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
No files found.
src/backend/postmaster/postmaster.c
View file @
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
View file @
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment