AtProcExit_Buffers.patch

application/octet-stream

Filename: AtProcExit_Buffers.patch
Type: application/octet-stream
Part: 0
Message: Re: profiling connection overhead

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: context
File+
src/backend/storage/buffer/bufmgr.c 6 0
*** a/src/backend/storage/buffer/bufmgr.c
--- b/src/backend/storage/buffer/bufmgr.c
***************
*** 1664,1689 **** InitBufferPoolBackend(void)
  static void
  AtProcExit_Buffers(int code, Datum arg)
  {
- 	int			i;
- 
  	AbortBufferIO();
  	UnlockBuffers();
  
! 	for (i = 0; i < NBuffers; i++)
  	{
! 		if (PrivateRefCount[i] != 0)
! 		{
! 			volatile BufferDesc *buf = &(BufferDescriptors[i]);
  
! 			/*
! 			 * We don't worry about updating ResourceOwner; if we even got
! 			 * here, it suggests that ResourceOwners are messed up.
! 			 */
! 			PrivateRefCount[i] = 1;		/* make sure we release shared pin */
! 			UnpinBuffer(buf, false);
  			Assert(PrivateRefCount[i] == 0);
  		}
  	}
  
  	/* localbuf.c needs a chance too */
  	AtProcExit_LocalBuffers();
--- 1664,1683 ----
  static void
  AtProcExit_Buffers(int code, Datum arg)
  {
  	AbortBufferIO();
  	UnlockBuffers();
  
! #ifdef USE_ASSERT_CHECKING
! 	if (assert_enabled)
  	{
! 		int			i;
  
! 		for (i = 0; i < NBuffers; i++)
! 		{
  			Assert(PrivateRefCount[i] == 0);
  		}
  	}
+ #endif
  
  	/* localbuf.c needs a chance too */
  	AtProcExit_LocalBuffers();