pgsql: Refactor background psql TAP functions

Поиск
Список
Период
Сортировка
Искать

pgsql: Refactor background psql TAP functions

От:
Daniel Gustafsson <dgustafsson@postgresql.org>
Дата:
Refactor background psql TAP functions

This breaks out the background and interactive psql functionality into a
new class, PostgreSQL::Test::BackgroundPsql.  Sessions are still initiated
via PostgreSQL::Test::Cluster, but once started they can be manipulated by
the new helper functions which intend to make querying easier.  A sample
session for a command which can be expected to finish at a later time can
be seen below.

  my $session = $node->background_psql('postgres');
  $bsession->query_until(qr/start/, q(
    \echo start
        CREATE INDEX CONCURRENTLY idx ON t(a);
  ));
  $bsession->quit;

Patch by Andres Freund with some additional hacking by me.

Author: Andres Freund 
Reviewed-by: Andrew Dunstan 
Discussion: https://postgr.es/m/20230130194350.zj5v467x4jgqt3d6@awork3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/664d757531e11ea5ef6971884ddb2a7af6fae69a

Modified Files
--------------
contrib/amcheck/t/003_cic_2pc.pl                   |  70 ++---
src/bin/psql/t/010_tab_completion.pl               |  28 +-
src/test/perl/PostgreSQL/Test/BackgroundPsql.pm    | 299 +++++++++++++++++++++
src/test/perl/PostgreSQL/Test/Cluster.pm           |  79 ++----
.../recovery/t/010_logical_decoding_timelines.pl   |   1 -
src/test/recovery/t/031_recovery_conflict.pl       | 102 ++-----
src/test/subscription/t/015_stream.pl              |  51 ++--
7 files changed, 388 insertions(+), 242 deletions(-)

Re: pgsql: Refactor background psql TAP functions

От:
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Дата:
On 07.04.23 22:21, Daniel Gustafsson wrote:
> Refactor background psql TAP functions
> 
> This breaks out the background and interactive psql functionality into a
> new class, PostgreSQL::Test::BackgroundPsql.

The new file also needs to be installed in 
src/test/perl/{Makefile,meson.build}.



Re: pgsql: Refactor background psql TAP functions

От:
Daniel Gustafsson <dgustafsson@postgresql.org>
Дата:
> On 26 Apr 2023, at 08:28, Peter Eisentraut  wrote:
> 
> On 07.04.23 22:21, Daniel Gustafsson wrote:
>> Refactor background psql TAP functions
>> This breaks out the background and interactive psql functionality into a
>> new class, PostgreSQL::Test::BackgroundPsql.
> 
> The new file also needs to be installed in src/test/perl/{Makefile,meson.build}.

Ugh, sorry about that. Fixing.

--
Daniel Gustafsson



Re: pgsql: Refactor background psql TAP functions

От:
Damir Belyalov <dam.bel07@gmail.com>
Дата:
Hello!

There is another perl module: AdjustUpgrade.pm that is not in Makefile. Do we need it?

        $(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/RecursiveCopy.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/RecursiveCopy.pm'
        $(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/Cluster.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
        $(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/BackgroundPsql.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
+       $(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/BackgroundPsql.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
        $(INSTALL_DATA) $(srcdir)/PostgreSQL/Version.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
 
 uninstall:
@@ -32,6 +33,7 @@ uninstall:
        rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/RecursiveCopy.pm'
        rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
        rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
+       rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
        rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'


Regards,
Damir Belyalov
Postgres Professional

Re: pgsql: Refactor background psql TAP functions

От:
Daniel Gustafsson <dgustafsson@postgresql.org>
Дата:
> On 16 May 2023, at 21:04, Damir Belyalov  wrote:

> There is another perl module: AdjustUpgrade.pm that is not in Makefile. Do we need it?

Yes, I think it should be installed too and skimming the linked thread I see no
mention of the omission being deliberate. I will take care of it.

> +       $(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/BackgroundPsql.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'

This is wrong though, but no need to send a new version of this small thing.

--
Daniel Gustafsson



Re: pgsql: Refactor background psql TAP functions

От:
Daniel Gustafsson <dgustafsson@postgresql.org>
Дата:
Вложения:
> On 16 May 2023, at 21:43, Daniel Gustafsson  wrote:
> 
>> On 16 May 2023, at 21:04, Damir Belyalov  wrote:
> 
>> There is another perl module: AdjustUpgrade.pm that is not in Makefile. Do we need it?
> 
> Yes, I think it should be installed too and skimming the linked thread I see no
> mention of the omission being deliberate. I will take care of it.

The attached is the proposed fix, which will have to be backpatched to v11 to
match the original commit.  Unless there are reasons to treat this module
differently from the others wrt installation I'll go ahead and fix it in time
for beta1.

--
Daniel Gustafsson

Re: pgsql: Refactor background psql TAP functions

От:
Daniel Gustafsson <dgustafsson@postgresql.org>
Дата:
> On 17 May 2023, at 14:38, Daniel Gustafsson  wrote:
> 
>> On 16 May 2023, at 21:43, Daniel Gustafsson  wrote:
>> 
>>> On 16 May 2023, at 21:04, Damir Belyalov  wrote:
>> 
>>> There is another perl module: AdjustUpgrade.pm that is not in Makefile. Do we need it?
>> 
>> Yes, I think it should be installed too and skimming the linked thread I see no
>> mention of the omission being deliberate. I will take care of it.
> 
> The attached is the proposed fix, which will have to be backpatched to v11 to
> match the original commit.  Unless there are reasons to treat this module
> differently from the others wrt installation I'll go ahead and fix it in time
> for beta1.

After another round of thinking I opted out of pushing this, as the module is
so tied to pg_upgrade and the regress env it's use in installed pgxs is
questionable.  While I would prefer a 1:1 between the modules in the source
tree and the installed tree, this module doesn't seem like a great fit for
installation.

--
Daniel Gustafsson



FAQ