Re: Hash tables in dynamic shared memory - Mailing list pgsql-hackers

From Dilip Kumar
Subject Re: Hash tables in dynamic shared memory
Date
Msg-id CAFiTN-t+NWdT9c2=fu_ASNVsuYH2TzaJxYmcB9O0LufU3WT8YA@mail.gmail.com
Whole thread Raw
In response to Hash tables in dynamic shared memory  (Thomas Munro <thomas.munro@enterprisedb.com>)
Responses Re: Hash tables in dynamic shared memory  (Thomas Munro <thomas.munro@enterprisedb.com>)
List pgsql-hackers
On Wed, Oct 5, 2016 at 3:10 AM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> Here is an experimental hash table implementation that uses DSA memory
> so that hash tables can be shared by multiple backends and yet grow
> dynamically.  Development name:  "DHT".

+dht_iterate_begin(dht_hash_table *hash_table,
+  dht_iterator *iterator,
+  bool exclusive)
+{
+ Assert(hash_table->control->magic == DHT_MAGIC);
+
+ iterator->hash_table = hash_table;
+ iterator->exclusive = exclusive;
+ iterator->partition = 0;
+ iterator->bucket = 0;
+ iterator->item = NULL;
+ iterator->locked = false;

While reviewing , I found that in dht_iterate_begin function, we are
not initializing
iterator->last_item_pointer to InvalidDsaPointer;
and during scan this variable will be used in advance_iterator
function. (I think this will create problem, even loss of some tuple
?)

+advance_iterator(dht_iterator *iterator, dsa_pointer bucket_head,
+ dsa_pointer *next)
+{
+ dht_hash_table_item *item;
+
+ while (DsaPointerIsValid(bucket_head))
+ {
+ item = dsa_get_address(iterator->hash_table->area,
+   bucket_head);
+ if ((!DsaPointerIsValid(iterator->last_item_pointer) ||
+ bucket_head < iterator->last_item_pointer) &&

-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: John Gorman
Date:
Subject: Re: PATCH: two slab-like memory allocators
Next
From: Etsuro Fujita
Date:
Subject: Re: postgres_fdw : altering foreign table not invalidating prepare statement execution plan.