Advertisement
funny_falcon

count_allocs.diff

Apr 21st, 2022
1,708
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.99 KB | None | 0 0
  1. diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c
  2. index 3babde8d70..d5a576d9c1 100644
  3. --- a/src/backend/utils/hash/dynahash.c
  4. +++ b/src/backend/utils/hash/dynahash.c
  5. @@ -99,6 +99,7 @@
  6.  #include "access/xact.h"
  7.  #include "common/hashfn.h"
  8.  #include "port/pg_bitutils.h"
  9. +#include "port/atomics.h"
  10.  #include "storage/shmem.h"
  11.  #include "storage/spin.h"
  12.  #include "utils/dynahash.h"
  13. @@ -196,6 +197,8 @@ struct HASHHDR
  14.         int                     sshift;                 /* segment shift = log2(ssize) */
  15.         int                     nelem_alloc;    /* number of entries to allocate at once */
  16.  
  17. +       pg_atomic_uint64        allocated;
  18. +
  19.  #ifdef HASH_STATISTICS
  20.  
  21.         /*
  22. @@ -1742,6 +1745,7 @@ element_alloc(HTAB *hashp, int nelem, int freelist_idx)
  23.  
  24.         if (IS_PARTITIONED(hctl))
  25.                 SpinLockRelease(&hctl->freeList[freelist_idx].mutex);
  26. +       pg_atomic_fetch_add_u64(&hctl->allocated, nelem);
  27.  
  28.         return true;
  29.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement