Re: Support for REINDEX CONCURRENTLY
Michael Paquier <michael.paquier@gmail.com>
From: Michael Paquier <michael.paquier@gmail.com>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Andres Freund <andres@2ndquadrant.com>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>,
Peter Eisentraut <peter_e@gmx.net>,
Tom Lane <tgl@sss.pgh.pa.us>, Simon Riggs <simon@2ndquadrant.com>
Date: 2013-08-27T06:34:22Z
Lists: pgsql-hackers
Attachments
- 20130827_0_procarray.patch (application/octet-stream) patch
- 20130827_1_index_conc_struc.patch (application/octet-stream) patch
- 20130827_2_reindex_concurrently_v30.patch (application/octet-stream) patch v30
Hi, I have been working a little bit more on this patch for the next commit fest. Compared to the previous version, I have removed the part of the code where process running REINDEX CONCURRENTLY was waiting for transactions holding a snapshot older than the snapshot xmin of process running REINDEX CONCURRENTLY at the validation and swap phase. At the validation phase, there was a risk that the newly-validated index might not contain deleted tuples before the snapshot used for validation was taken. I tried to break the code in this area by playing with multiple sessions but couldn't. Feel free to try the code and break it if you can! At the swap phase, the process running REINDEX CONCURRENTLY needed to wait for transactions that might have needed the older index information being swapped. As swap phase is done with an MVCC snapshot, this is not necessary anymore. Thanks to the removal of this code, I am not seeing anymore with this patch deadlocks that could occur when other sessions tried to take a ShareUpdateExclusiveLock on a relation with an ANALYZE for example. So multiple backends can kick in parallel REINDEX CONCURRENTLY or ANALYZE commands without risks of deadlock. Processes will just wait for locks as long as necessary. Regards, -- Michael
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Background worker processes
- da07a1e85651 9.3.0 cited
-
Fix assorted bugs in CREATE/DROP INDEX CONCURRENTLY.
- 3c84046490be 9.3.0 cited
-
Work around unportable behavior of malloc(0) and realloc(NULL, 0).
- 09ac603c36d1 9.3.0 cited
-
Properly set relpersistence for fake relcache entries.
- beb850e1d873 9.3.0 cited