Re: Parallel bitmap heap scan
Dilip Kumar <dilipbalaut@gmail.com>
From: Dilip Kumar <dilipbalaut@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>, Haribabu Kommi <kommi.haribabu@gmail.com>,
Rafia Sabih <rafia.sabih@enterprisedb.com>, tushar <tushar.ahuja@enterprisedb.com>,
Amit Khandekar <amitdkhan.pg@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>, Andres Freund <andres@anarazel.de>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-02-21T04:50:07Z
Lists: pgsql-hackers
Attachments
- 0001-tidbitmap-support-shared-v5.patch (application/octet-stream) patch v5-0001
- 0002-parallel-bitmap-heapscan-v5.patch (application/octet-stream) patch v5-0002
On Mon, Feb 20, 2017 at 11:18 PM, Robert Haas <robertmhaas@gmail.com> wrote: > On Mon, Feb 20, 2017 at 5:55 AM, Thomas Munro > <thomas.munro@enterprisedb.com> wrote: >> On Sun, Feb 19, 2017 at 9:59 PM, Dilip Kumar <dilipbalaut@gmail.com> wrote: >>> So basically, what I want to propose is that Only during >>> ExecReScanBitmapHeapScan we can free all the DSA pointers because at >>> that time we can be sure that all the workers have completed there >>> task and we are safe to free. (And we don't free any DSA memory at >>> ExecEndBitmapHeapScan). >> >> I think this works. > > OK. In my latest version of the patch, I have fixed it as described above i.e only cleanup in ExecReScanBitmapHeapScan. For getting this there is some change in both the patches. 0001: 1. I have got a new interface, "tbm_free_shared_area(dsa_area *dsa, dsa_pointer dp)" which will be responsible for freeing all the shared members (pagetable, ptpage and ptchunk). Actually, we can not do this in tbm_free itself because the only leader will have a local tbm with reference to all these pointers and our parallel bitmap leader may not necessarily be the actual backend. If we want to get this done using tbm, then we need to create a local tbm in each worker and get the shared member reference copied into tbm using tbm_attach_shared_iterate like we were doing in the earlier version. 2. Now tbm_free is not freeing any of the shared members which can be accessed by other worker so tbm_free is safe to call from ExecEndBitmapHeapScan without any safety check or ref count. 0002: 1. We don't need ExecShutdownBitmapHeapScan anymore because now we are not freeing any shared member in ExecEndBitmapHeapScan. 2. In ExecReScanBitmapHeapScan we will call tbm_free_shared_area to free the shared members of the TBM. 3. After that, we will free TBMSharedIteratorState what we allocated using tbm_prepare_shared_iterate. -- Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com
Commits
-
Pass DSA_ALLOC_HUGE when allocating a shared TIDBitmap.
- a171f01501e1 10.0 landed
-
Support parallel bitmap heap scans.
- f35742ccb7aa 10.0 landed
-
tidbitmap: Support shared iteration.
- 98e6e89040a0 10.0 landed
-
Shut down Gather's children before shutting down Gather itself.
- acf555bc53ac 10.0 landed
-
Revise the way the element allocator for a simplehash is specified.
- c3c4f6e1740b 10.0 cited
-
Refactor bitmap heap scan estimation of heap pages fetched.
- da08a6598973 10.0 landed
-
Use more efficient hashtable for tidbitmap.c to speed up bitmap scans.
- 75ae538bc316 10.0 cited