Re: CREATE INDEX CONCURRENTLY on partitioned index
Alexander Pyhalov <a.pyhalov@postgrespro.ru>
From: Alexander Pyhalov <a.pyhalov@postgrespro.ru>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>, Masahiko Sawada <sawada.mshk@gmail.com>, Michael Paquier <michael@paquier.xyz>, 李杰(慎追) <adger.lj@alibaba-inc.com>, pgsql-hackers@lists.postgresql.org, 曾文旌(义从) <wenjing.zwj@alibaba-inc.com>, Alvaro Herrera <alvherre@2ndquadrant.com>
Date: 2022-02-10T15:07:08Z
Lists: pgsql-hackers
Attachments
- v1-0001-Allow-CREATE-INDEX-CONCURRENTLY-on-partitioned-table.patch (text/x-diff) patch v1-0001
- v1-0002-Add-SKIPVALID-flag-for-more-integration.patch (text/x-diff) patch v1-0002
- v1-0003-Try-to-fix-create-index-progress-report.patch (text/x-diff) patch v1-0003
- v1-0004-ReindexPartitions-to-set-indisvalid.patch (text/x-diff) patch v1-0004
Justin Pryzby писал 2021-02-26 21:20: > On Mon, Feb 15, 2021 at 10:07:05PM +0300, Anastasia Lubennikova wrote: >> 5) Speaking of documentation, I think we need to add a paragraph about >> CIC >> on partitioned indexes which will explain that invalid indexes may >> appear >> and what user should do to fix them. > > I'm not sure about that - it's already documented in general, for > nonpartitioned indexes. Hi. I've rebased patches and tried to fix issues I've seen. I've fixed reference after table_close() in the first patch (can be seen while building with CPPFLAGS='-DRELCACHE_FORCE_RELEASE'). It seems childidxs shouldn't live in ind_context, so I moved it out of it. Updated documentation to state that CIC can leave invalid or valid indexes on partitions if it's not succeeded. Also merged old 0002-f-progress-reporting.patch and 0003-WIP-Add-SKIPVALID-flag-for-more-integration.patch. It seems the first one didn't really fixed issue with progress report (as ReindexRelationConcurrently() uses pgstat_progress_start_command(), which seems to mess up the effect of this command in DefineIndex()). Note, that third patch completely removes attempts to report create index progress correctly (reindex reports about individual commands, not the whole CREATE INDEX). So I've added 0003-Try-to-fix-create-index-progress-report.patch, which tries to fix the mess with create index progress report. It introduces new flag REINDEXOPT_REPORT_CREATE_PART to ReindexParams->options. Given this flag, ReindexRelationConcurrently() will not report about individual operations start/stop, but ReindexMultipleInternal() will report about reindexed partitions. To make the issue worse, some partitions can be handled in ReindexPartitions() and ReindexMultipleInternal() should know how many to correctly update PROGRESS_CREATEIDX_PARTITIONS_DONE counter. Also it needs IndexOid to correctly generate pg_stat_progress_create_index record, so we pass these parameters to it. -- Best regards, Alexander Pyhalov, Postgres Professional
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix assertion failure with REINDEX and event triggers
- c426f7c2b36a 17.0 cited