Re: Opclass parameters of indexes lost after REINDEX CONCURRENTLY
| От | Zhihong Yu |
|---|---|
| Тема | Re: Opclass parameters of indexes lost after REINDEX CONCURRENTLY |
| Дата | |
| Msg-id | CALNJ-vSmR7B1YGwDqBbSNM=bON8W+sPWC0AmXYPTwFgT7cXFbA@mail.gmail.com обсуждение исходный текст |
| Ответ на | Opclass parameters of indexes lost after REINDEX CONCURRENTLY (Michael Paquier <michael@paquier.xyz>) |
| Ответы |
Re: Opclass parameters of indexes lost after REINDEX CONCURRENTLY
|
| Список | pgsql-hackers |
On Sat, Oct 30, 2021 at 1:28 AM Michael Paquier <michael@paquier.xyz> wrote:
Hi all,
While reviewing the code for opclass parameters with indexes, I have
noticed that opclass parameters are lost after a concurrent reindex.
As we use a IndexInfo to hold the information of the new index when
creating a copy of the old one, it is just a matter of making sure
that ii_OpclassOptions is filled appropriately, but that was missed by
911e702.
Attached is a patch to fix the issue. After a concurrent reindex, we
would not finish with a corrupted index, just with one rebuilt with
default opclass parameter values.
Any objections or comments?
--
Michael
Hi,
+ newInfo->ii_NumIndexAttrs);
It seems we may not need to allocate these many entries (as shown by the concur_appclass_ind_2 example in the test).
In the previous loop (starting line 1359), we can increment a counter which would finally tell us how many oldInfo->ii_OpclassOptions[i] is not NULL.
Then that many entries can be allocated in the above code.
Cheers
В списке pgsql-hackers по дате отправления: