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

Commit80727ce

Browse files
committed
Use stat(2) to probe for existing xlog segments in InstallXLogFileSegment,
rather than actually opening the files. This eliminates some corner caseswhere the file indeed exists but open() fails for another reason, suchas being out of file descriptors. The net reliability gain is probablytiny, since xlog.c is full of other file open calls that will elog(PANIC)if they fail for any reason; but this specific failure mode has beenobserved in the field, so we may as well fix it.
1 parent7a196ba commit80727ce

File tree

1 file changed

+3
-5
lines changed
  • src/backend/access/transam

1 file changed

+3
-5
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.110 2002/11/08 20:23:56 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.111 2003/01/25 03:06:04 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1471,7 +1471,7 @@ InstallXLogFileSegment(uint32 log, uint32 seg, char *tmppath,
14711471
booluse_lock)
14721472
{
14731473
charpath[MAXPGPATH];
1474-
intfd;
1474+
structstatstat_buf;
14751475

14761476
XLogFileName(path,log,seg);
14771477

@@ -1489,10 +1489,8 @@ InstallXLogFileSegment(uint32 log, uint32 seg, char *tmppath,
14891489
else
14901490
{
14911491
/* Find a free slot to put it in */
1492-
while ((fd=BasicOpenFile(path,O_RDWR |PG_BINARY,
1493-
S_IRUSR |S_IWUSR)) >=0)
1492+
while (stat(path,&stat_buf)==0)
14941493
{
1495-
close(fd);
14961494
if (--max_advance<0)
14971495
{
14981496
/* Failed to find a free slot within specified range */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp