mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Fix some latent bugs in dllist.c (carelessness about setting
all fields that should be set). Add a MoveToFront primitive to speed up one of the hotspots in SearchSysCache.
This commit is contained in:
14
src/backend/utils/cache/catcache.c
vendored
14
src/backend/utils/cache/catcache.c
vendored
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.41 1999/05/25 16:12:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.42 1999/05/31 23:48:04 tgl Exp $
|
||||
*
|
||||
* Notes:
|
||||
* XXX This needs to use exception.h to handle recovery when
|
||||
@ -876,16 +876,18 @@ SearchSysCache(struct catcache * cache,
|
||||
|
||||
/* ----------------
|
||||
* if we found a tuple in the cache, move it to the top of the
|
||||
* lru list, and return it.
|
||||
* lru list, and return it. We also move it to the front of the
|
||||
* list for its hashbucket, in order to speed subsequent searches.
|
||||
* (The most frequently accessed elements in any hashbucket will
|
||||
* tend to be near the front of the hashbucket's list.)
|
||||
* ----------------
|
||||
*/
|
||||
if (elt)
|
||||
{
|
||||
Dlelem *old_lru_elt;
|
||||
Dlelem *old_lru_elt = ((CatCTup *) DLE_VAL(elt))->ct_node;
|
||||
|
||||
old_lru_elt = ((CatCTup *) DLE_VAL(elt))->ct_node;
|
||||
DLRemove(old_lru_elt);
|
||||
DLAddHead(cache->cc_lrulist, old_lru_elt);
|
||||
DLMoveToFront(old_lru_elt);
|
||||
DLMoveToFront(elt);
|
||||
|
||||
#ifdef CACHEDEBUG
|
||||
relation = heap_open(cache->relationId);
|
||||
|
Reference in New Issue
Block a user