From a8bb7355e7d237de8ee72d5851399eb5373ea2f9 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Mon, 30 Jul 2012 15:49:18 +0000 Subject: [PATCH] Improve comments about gc_next. --- src/backend/utils/hash/chash.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/backend/utils/hash/chash.c b/src/backend/utils/hash/chash.c index dd77ffaa85..f44b65009f 100644 --- a/src/backend/utils/hash/chash.c +++ b/src/backend/utils/hash/chash.c @@ -136,17 +136,18 @@ typedef struct * CHashTableData stores all the information that we need in order to access * a concurrent hash table. We store one copy of this data in shared memory, * and an additional copy in the private memory of each backend accessing the - * table. None of this information changes after the initial setup of the - * hash table. + * table. */ typedef struct CHashTableData { + /* + * These fields do not change after initialization. + */ CHashDescriptor desc; /* descriptor for this hash table */ uint32 nbuckets; /* # of buckets; must be a power of two */ uint32 bucket_mask; /* # of buckets, minus one */ uint32 garbage_shift; /* log2(nbuckets/ngarbage) */ uint32 ngarbage; /* # of garbage lists, a power of two */ - uint32 gc_next; /* next garbage list to reclaim */ int gc_pid; /* PID that set gc_next */ uint32 nfreelists; /* # of freelists */ uint32 arena_limit; /* # of arena elements */ @@ -155,6 +156,12 @@ typedef struct CHashTableData CHashPtr *garbage; /* array of size ngarbage */ CHashPtr *freelist; /* array of size nfreelists */ char *arena; /* arena */ + + /* + * This field will be different in each backend; the shared copy is + * unused. + */ + uint32 gc_next; /* next garbage list to reclaim */ } CHashTableData; #define CHashTableGetRaw(table, offset) \ -- 2.39.5