Re: Confusing error message for REINDEX TABLE CONCURRENTLY

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Ashwin Agrawal <aagrawal(at)pivotal(dot)io>
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Confusing error message for REINDEX TABLE CONCURRENTLY
Date: 2019-06-04 01:27:00
Message-ID: 20190604012700.GE1529@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 03, 2019 at 04:53:48PM -0700, Ashwin Agrawal wrote:
> Please check if the attached patch addresses and satisfies all the points
> discussed so far in this thread.

It looks to be so, please see below for some comments.

> + {
> result = ReindexRelationConcurrently(heapOid, options);
> +
> + if (!result)
> + ereport(NOTICE,
> + (errmsg("table \"%s\" has no indexes that can be concurrently reindexed",
> + relation->relname)));

"concurrently" should be at the end of this string. I have had the
exact same argument with Tom for 508300e.

> @@ -2630,7 +2638,6 @@ ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind,
> foreach(l, relids)
> {
> Oid relid = lfirst_oid(l);
> - bool result;
>
> StartTransactionCommand();
> /* functions in indexes may want a snapshot set */
> @@ -2638,11 +2645,12 @@ ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind,
>
> if (concurrent)
> {
> - result = ReindexRelationConcurrently(relid, options);
> + ReindexRelationConcurrently(relid, options);
> /* ReindexRelationConcurrently() does the verbose output */

Indeed this variable is not used. So we could just get rid of it
completely.

> + bool result;
> result = reindex_relation(relid,
> REINDEX_REL_PROCESS_TOAST |
> REINDEX_REL_CHECK_CONSTRAINTS,
> @@ -2656,7 +2664,6 @@ ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind,
>
> PopActiveSnapshot();
> }

The table has been considered for reindexing even if nothing has been
reindexed, so perhaps we'd want to keep this part as-is? We have the
same level of reporting for a couple of releases for this part.

> -
> CommitTransactionCommand();

Useless noise diff.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-06-04 01:37:59 Re: Print baserestrictinfo for varchar fields
Previous Message Andres Freund 2019-06-04 01:24:15 Re: Comment typo in tableam.h