Re: Postmaster holding unlinked files for pg_largeobject table

Alvaro Herrera <alvherre@commandprompt.com>

From: Alvaro Herrera <alvherre@commandprompt.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>, Kevin Grittner <kevin.grittner@wicourts.gov>, alexk <alexk@commandprompt.com>, Alexander Shulgin <ash@commandprompt.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2011-06-09T20:55:41Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Reset reindex-in-progress state before reverifying an exclusion constraint.

Excerpts from Alvaro Herrera's message of jue jun 09 16:34:13 -0400 2011:

> I have pushed it now.

... and it caused a failure on the buildfarm, so I panicked and reverted
it.  I think the patch below fixes it.  Let me know if you think I
should push the whole thing again.

*** a/src/backend/storage/file/fd.c
--- b/src/backend/storage/file/fd.c
***************
*** 1045,1070 **** FileSetTransient(File file)
  }
  
  /*
-  * Close a file at the kernel level, but keep the VFD open
-  */
- static void
- FileKernelClose(File file)
- {
- 	Vfd		  *vfdP;
- 
- 	Assert(FileIsValid(file));
- 
- 	vfdP = &VfdCache[file];
- 
- 	if (!FileIsNotOpen(file))
- 	{
- 		if (close(vfdP->fd))
- 			elog(ERROR, "could not close file \"%s\": %m", vfdP->fileName);
- 		vfdP->fd = VFD_CLOSED;
- 	}
- }
- 
- /*
   * close a file when done with it
   */
  void
--- 1045,1050 ----
***************
*** 1892,1903 **** CleanupTempFiles(bool isProcExit)
  				else if (fdstate & FD_XACT_TRANSIENT)
  				{
  					/*
! 					 * Close the kernel file descriptor, but also remove the
! 					 * flag from the VFD.  This is to ensure that if the VFD is
! 					 * reused in the future for non-transient access, we don't
! 					 * close it inappropriately then.
  					 */
! 					FileKernelClose(i);
  					VfdCache[i].fdstate &= ~FD_XACT_TRANSIENT;
  				}
  			}
--- 1872,1884 ----
  				else if (fdstate & FD_XACT_TRANSIENT)
  				{
  					/*
! 					 * Close the FD, and remove the entry from the LRU ring,
! 					 * but also remove the flag from the VFD.  This is to
! 					 * ensure that if the VFD is reused in the future for
! 					 * non-transient access, we don't close it inappropriately
! 					 * then.
  					 */
! 					LruDelete(i);
  					VfdCache[i].fdstate &= ~FD_XACT_TRANSIENT;
  				}
  			}
-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support