Re: [PoC] pg_upgrade: allow to upgrade publisher node

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
Subject: Re: [PoC] pg_upgrade: allow to upgrade publisher node
Date: 2023-09-04 04:03:19
Message-ID: CAFiTN-uJWejSTED1029nRv7JgSoTiZ_rpEwGgdHfsVkFd1N0RQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 1, 2023 at 6:34 PM Hayato Kuroda (Fujitsu)
<kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>
> Dear Dilip,
>
> Thank you for reviewing!
>
> >
> > 1.
> > + conn = connectToServer(&new_cluster, "template1");
> > +
> > + prep_status("Checking for logical replication slots");
> > +
> > + res = executeQueryOrDie(conn, "SELECT slot_name "
> > + "FROM pg_catalog.pg_replication_slots "
> > + "WHERE slot_type = 'logical' AND "
> > + "temporary IS FALSE;");
> >
> >
> > I think we should add some comment saying this query will only fetch
> > logical slots because the database name will always be NULL in the
> > physical slots. Otherwise looking at the query it is very confusing
> > how it is avoiding the physical slots.
>
> Hmm, the query you pointed out does not check the database of the slot...
> We are fetching only logical slots by the condition "slot_type = 'logical'",
> I think it is too trivial to describe in the comment.
> Just to confirm - pg_replication_slots can see alls the slots even if the database
> is not current one.

I think this is fine. Actually I posted comments based on v28 where
the query inside get_old_cluster_logical_slot_infos_per_db() function
was missing the condition on the slot_type = logical but while
commenting I quoted the wrong hunk from the code. Anyway the other
part of the code which I intended is also fixed from v29 so all good.
Thanks :)

> > 4. Looking at the above two comments I feel that now the order should be like
> > - Fetch all the db infos
> > get_db_infos()
> > - loop
> > get_rel_infos()
> > get_old_cluster_logical_slot_infos()
> >
> > -- and now print relation and slot information per database
> > print_db_infos()
>
> Fixed like that. It seems that we go back to old style...
> Now the debug prints are like below:
>
> ```
> source databases:
> Database: "template1"
> relname: "pg_catalog.pg_largeobject", reloid: 2613, reltblspace: ""
> relname: "pg_catalog.pg_largeobject_loid_pn_index", reloid: 2683, reltblspace: ""
> Database: "postgres"
> relname: "pg_catalog.pg_largeobject", reloid: 2613, reltblspace: ""
> relname: "pg_catalog.pg_largeobject_loid_pn_index", reloid: 2683, reltblspace: ""
> Logical replication slots within the database:
> slotname: "old1", plugin: "test_decoding", two_phase: 0
> slotname: "old2", plugin: "test_decoding", two_phase: 0
> slotname: "old3", plugin: "test_decoding", two_phase: 0

Yeah this looks good now.

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2023-09-04 05:03:20 Re: Impact of checkpointer during pg_upgrade
Previous Message Thomas Munro 2023-09-04 03:18:40 REL_15_STABLE: pgbench tests randomly failing on CI, Windows only