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

Commit7eb5428

Browse files
committed
During CatCacheRemoveCList, we must now remove any members that are
dead and have become unreferenced. Before 8.1, such members were leftfor AtEOXact_CatCache() to clean up, but now AtEOXact_CatCache isn'tsupposed to have anything to do. In an assert-enabled build this bugleads to an assertion failure at transaction end, but in a non-assertbuild the dead member is effectively just a small memory leak.Per report from Jeremy Drake.
1 parent0a8510e commit7eb5428

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

‎src/backend/utils/cache/catcache.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.126 2005/11/22 18:17:24 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.127 2006/01/07 21:16:10 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -356,7 +356,16 @@ CatCacheRemoveCTup(CatCache *cache, CatCTup *ct)
356356
Assert(ct->my_cache==cache);
357357

358358
if (ct->c_list)
359+
{
360+
/*
361+
* The cleanest way to handle this is to call CatCacheRemoveCList,
362+
* which will recurse back to me, and the recursive call will do the
363+
* work. Set the "dead" flag to make sure it does recurse.
364+
*/
365+
ct->dead= true;
359366
CatCacheRemoveCList(cache,ct->c_list);
367+
return;/* nothing left to do */
368+
}
360369

361370
/* delink from linked lists */
362371
DLRemove(&ct->lrulist_elem);
@@ -375,6 +384,8 @@ CatCacheRemoveCTup(CatCache *cache, CatCTup *ct)
375384
*CatCacheRemoveCList
376385
*
377386
* Unlink and delete the given cache list entry
387+
*
388+
* NB: any dead member entries that become unreferenced are deleted too.
378389
*/
379390
staticvoid
380391
CatCacheRemoveCList(CatCache*cache,CatCList*cl)
@@ -391,6 +402,13 @@ CatCacheRemoveCList(CatCache *cache, CatCList *cl)
391402

392403
Assert(ct->c_list==cl);
393404
ct->c_list=NULL;
405+
/* if the member is dead and now has no references, remove it */
406+
if (
407+
#ifndefCATCACHE_FORCE_RELEASE
408+
ct->dead&&
409+
#endif
410+
ct->refcount==0)
411+
CatCacheRemoveCTup(cache,ct);
394412
}
395413

396414
/* delink from linked list */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp