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
36c18955
Commit
36c18955
authored
Jan 30, 1999
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix postmaster to not try to start more than MaxBackendId children,
per patch from Tatsuo Ishii
parent
bfa6d510
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
16 deletions
+42
-16
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+42
-16
No files found.
src/backend/postmaster/postmaster.c
View file @
36c18955
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.
99 1999/01/17 06:18:34 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.
100 1999/01/30 20:04:37 tgl
Exp $
*
* NOTES
*
...
...
@@ -244,6 +244,7 @@ static int initMasks(fd_set *rmask, fd_set *wmask);
static
long
PostmasterRandom
(
void
);
static
void
RandomSalt
(
char
*
salt
);
static
void
SignalChildren
(
SIGNAL_ARGS
);
static
int
CountChildren
(
void
);
#ifdef CYR_RECODE
void
GetCharSetByHost
(
char
*
,
int
,
char
*
);
...
...
@@ -667,8 +668,8 @@ ServerLoop(void)
{
if
(
errno
==
EINTR
)
continue
;
fprintf
(
stderr
,
"%s: ServerLoop: select failed
\n
"
,
progname
);
fprintf
(
stderr
,
"%s: ServerLoop: select failed
: %s
\n
"
,
progname
,
strerror
(
errno
)
);
return
STATUS_ERROR
;
}
...
...
@@ -763,19 +764,24 @@ ServerLoop(void)
if
(
status
==
STATUS_OK
&&
port
->
pktInfo
.
state
==
Idle
)
{
/*
* If the backend start fails then keep the connection
* open to report it. Otherwise, pretend there is an
* error to close the connection which will now be managed
* by the backend.
*/
if
(
BackendStartup
(
port
)
!=
STATUS_OK
)
/* Can't start backend if max backend count is exceeded. */
if
(
CountChildren
()
>=
MaxBackendId
)
PacketSendError
(
&
port
->
pktInfo
,
"
Backend startup failed
"
);
"
Sorry, too many clients already
"
);
else
status
=
STATUS_ERROR
;
{
/*
* If the backend start fails then keep the connection
* open to report it. Otherwise, pretend there is an
* error to close the connection which will now be managed
* by the backend.
*/
if
(
BackendStartup
(
port
)
!=
STATUS_OK
)
PacketSendError
(
&
port
->
pktInfo
,
"Backend startup failed"
);
else
status
=
STATUS_ERROR
;
}
}
/* Close the connection if required. */
...
...
@@ -1332,8 +1338,8 @@ BackendStartup(Port *port)
/* in parent */
if
(
pid
<
0
)
{
fprintf
(
stderr
,
"%s: BackendStartup: fork failed
\n
"
,
progname
);
fprintf
(
stderr
,
"%s: BackendStartup: fork failed
: %s
\n
"
,
progname
,
strerror
(
errno
)
);
return
STATUS_ERROR
;
}
...
...
@@ -1641,3 +1647,23 @@ PostmasterRandom(void)
return
random
()
^
random_seed
;
}
/*
* Count up number of child processes.
*/
static
int
CountChildren
(
void
)
{
Dlelem
*
curr
;
Backend
*
bp
;
int
mypid
=
getpid
();
int
cnt
=
0
;
for
(
curr
=
DLGetHead
(
BackendList
);
curr
;
curr
=
DLGetSucc
(
curr
))
{
bp
=
(
Backend
*
)
DLE_VAL
(
curr
);
if
(
bp
->
pid
!=
mypid
)
cnt
++
;
}
return
cnt
;
}
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