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

Commit8c873bb

Browse files
committed
Make the walwriter close it's handle to an old xlog segment if it's no longer
the current one. Not doing this would leave the walwriter with a handle to adeleted file if there was nothing for it to do for a long period of time,preventing the file from being completely removed.Reported by Tollef Fog Heen, and thanks to Heikki for some hand-holding withthe patch.
1 parent5a41c31 commit8c873bb

File tree

1 file changed

+14
-2
lines changed
  • src/backend/access/transam

1 file changed

+14
-2
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.417 2010/06/03 21:02:11 petere Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.418 2010/06/09 10:54:45 mha Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -2124,9 +2124,21 @@ XLogBackgroundFlush(void)
21242124
flexible= false;/* ensure it all gets written */
21252125
}
21262126

2127-
/* Done if already known flushed */
2127+
/*
2128+
* If already known flushed, we're done. Just need to check if we
2129+
* are holding an open file handle to a logfile that's no longer
2130+
* in use, preventing the file from being deleted.
2131+
*/
21282132
if (XLByteLE(WriteRqstPtr,LogwrtResult.Flush))
2133+
{
2134+
if (openLogFile >=0) {
2135+
if (!XLByteInPrevSeg(LogwrtResult.Write,openLogId,openLogSeg))
2136+
{
2137+
XLogFileClose();
2138+
}
2139+
}
21292140
return;
2141+
}
21302142

21312143
#ifdefWAL_DEBUG
21322144
if (XLOG_DEBUG)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp