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

Commit28d27cf

Browse files
committed
Arrange to fsync the contents of lockfiles (both postmaster.pid and the
socket lockfile) when writing them. The lack of an fsync here may wellexplain two different reports we've seen of corrupted lockfile contents,which doesn't particularly bother the running server but can prevent anew server from starting if the old one crashes. Per suggestion fromAlvaro.Back-patch to all supported versions.
1 parent9217dee commit28d27cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎src/backend/utils/init/miscinit.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.116.2.2 2009/12/09 21:59:07 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.116.2.3 2010/08/16 17:33:30 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -721,6 +721,7 @@ CreateLockFile(const char *filename, bool amPostmaster,
721721
(errcode_for_file_access(),
722722
errmsg("could not write lock file \"%s\": %m",filename)));
723723
}
724+
pg_fsync(fd);
724725
close(fd);
725726

726727
/*
@@ -875,6 +876,7 @@ RecordSharedMemoryInLockFile(unsigned long id1, unsigned long id2)
875876
close(fd);
876877
return;
877878
}
879+
pg_fsync(fd);
878880
close(fd);
879881
}
880882

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp