Re: REINDEX backend filtering

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Zhihong Yu <zyu(at)yugabyte(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: REINDEX backend filtering
Date: 2021-02-24 12:21:41
Message-ID: CAOBaU_byF_phZhMuK6QhVVfDPdY8-mN-Me+26kwFD3c+bjD7Rw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thanks for the review!

On Mon, Feb 8, 2021 at 12:14 AM Zhihong Yu <zyu(at)yugabyte(dot)com> wrote:
>
> Hi,
> For index_has_deprecated_collation(),
>
> + object.objectSubId = 0;
>
> The objectSubId field is not accessed by do_check_index_has_deprecated_collation(). Does it need to be assigned ?

Indeed it's not strictly necessary I think, but it makes things
cleaner and future proof, and that's how things are already done
nearby. So I think it's better to keep it this way.

> For RelationGetIndexListFiltered(), it seems when (options & REINDEXOPT_COLL_NOT_CURRENT) == 0, the full_list would be returned.
> This can be checked prior to entering the foreach loop.

That's already the case with this test:

/* Fast exit if no filtering was asked, or if the list if empty. */
if (!reindexHasFilter(options) || full_list == NIL)
return full_list;

knowing that

#define reindexHasFilter(x) ((x & REINDEXOPT_COLL_NOT_CURRENT) != 0)

The code as-is written to be extensible with possibly other filters
(e.g. specific library or specific version). Feedback so far seems to
indicate that it may be overkill and only filtering indexes with
deprecated collation is enough. I'll simplify this code in a future
version, getting rid of reindexHasFilter, unless someone thinks more
filter is a good idea.

For now I'm attaching a rebased version, there was a conflict with the
recent patch to add the missing_ok parameter to
get_collation_version_for_oid()

Attachment Content-Type Size
v4-0001-Add-a-new-COLLATION-option-to-REINDEX.patch application/octet-stream 10.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2021-02-24 12:23:32 Re: Support for NSS as a libpq TLS backend
Previous Message talk to ben 2021-02-24 12:20:43 archive_command / pg_stat_archiver & documentation