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

Commit5dd0460

Browse files
committed
Don't go belly-up if fork() fails for a routine checkpoint subprocess.
Just try again later.
1 parent286d1fc commit5dd0460

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*
2929
*
3030
* IDENTIFICATION
31-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.209 2001/03/13 01:17:05 tgl Exp $
31+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.210 2001/03/1417:58:46 tgl Exp $
3232
*
3333
* NOTES
3434
*
@@ -804,6 +804,11 @@ ServerLoop(void)
804804
{
805805
/* Time to make the checkpoint... */
806806
CheckPointPID=CheckPointDataBase();
807+
/* if fork failed, schedule another try at 0.1 normal delay */
808+
if (CheckPointPID==0)
809+
{
810+
checkpointed=now- (9*CheckPointTimeout) /10;
811+
}
807812
}
808813
}
809814

@@ -2124,6 +2129,7 @@ schedule_checkpoint(SIGNAL_ARGS)
21242129
Shutdown==NoShutdown&& !FatalError)
21252130
{
21262131
CheckPointPID=CheckPointDataBase();
2132+
/* note: if fork fails, CheckPointPID stays 0; nothing happens */
21272133
}
21282134

21292135
errno=save_errno;
@@ -2264,6 +2270,9 @@ InitSSL(void)
22642270

22652271
/*
22662272
* Fire off a subprocess for startup/shutdown/checkpoint.
2273+
*
2274+
* Return value is subprocess' PID, or 0 if failed to start subprocess
2275+
* (0 is returned only for checkpoint case).
22672276
*/
22682277
staticpid_t
22692278
SSDataBase(intxlop)
@@ -2332,8 +2341,15 @@ SSDataBase(int xlop)
23322341

23332342
fprintf(stderr,"%s Data Base: fork failed: %s\n",
23342343
((xlop==BS_XLOG_STARTUP) ?"Startup" :
2335-
((xlop==BS_XLOG_CHECKPOINT) ?"CheckPoint" :
2336-
"Shutdown")),strerror(errno));
2344+
((xlop==BS_XLOG_CHECKPOINT) ?"CheckPoint" :
2345+
"Shutdown")),
2346+
strerror(errno));
2347+
/*
2348+
* fork failure is fatal during startup/shutdown, but there's
2349+
* no need to choke if a routine checkpoint fails.
2350+
*/
2351+
if (xlop==BS_XLOG_CHECKPOINT)
2352+
return0;
23372353
ExitPostmaster(1);
23382354
}
23392355

@@ -2363,7 +2379,7 @@ SSDataBase(int xlop)
23632379
TouchSocketLockFile();
23642380
}
23652381

2366-
return(pid);
2382+
returnpid;
23672383
}
23682384

23692385

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp