Re: create subscription - improved warning message

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: create subscription - improved warning message
Date: 2022-10-09 23:10:18
Message-ID: CAHut+PsuSUNJH_esies5DWsrbLqi-5Z634VxUgbHnm2PaHnXjQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 8, 2022 at 2:23 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Peter Smith <smithpb2250(at)gmail(dot)com> writes:
> > WARNING: tables were not subscribed, you will have to run ALTER
> > SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
>
> > When I first encountered the above CREATE SUBSCRIPTION warning message
> > I thought it was dubious-looking English...
>
> > On closer inspection I think the message has some other things that
> > could be improved:
> > a) it is quite long which IIUC is generally frowned upon
> > b) IMO most of the text it is more like a "hint" about what to do
>
> You're quite right about both of those points, but I think there's
> even more to criticize: "tables were not subscribed" is a basically
> useless message, and probably not even conceptually accurate.
> Looking at the code, I think the situation being complained of is that
> we have created the subscription's main catalog entries locally, but
> since we were told not to connect to the publisher, we don't know what
> tables the subscription is supposed to be reading. I'm not sure what
> the consequences of that are: do we not read any data at all yet, or
> what?
>
> I think maybe a better message would be along the lines of
>
> WARNING: subscription was created, but is not up-to-date
> HINT: You should now run %s to initiate collection of data.
>
> Thoughts?

Yes, IMO it's better to change the message more radically as you did.

But if it's OK to do that then:
- maybe it should mention the connection since the connect=false was
what caused this warning.
- maybe saying 'replication' instead of 'collection of data' would be
more consistent with the pgdocs for CREATE SUBSCRIPTION

e.g.

WARNING: subscription was created, but is not connected
HINT: You should run %s to initiate replication.

(I can update the patch when the final text is decided)

------
Kind Regards,
Peter Smith.
Fujitsu Australia

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-10-09 23:12:50 Re: create subscription - improved warning message
Previous Message Nathan Bossart 2022-10-09 21:47:25 Re: Switching XLog source from archive to streaming when primary available