Add some tests for pg_stat_statements compatibility verification under contrib
Hi All,
On the master branch, it is possible to install multiple versions of pg_stat_statements with CREATE EXTENSION, but all the tests in sql/ on look at the latest version available, without testing past compatibility.
Since we support to install lowest version 1.4 currently, add some tests to verify compatibility, upgrade from lower versions of pg_stat_statements.
Attachments:
add_test_for_pg_stat_statements.patchapplication/octet-stream; charset=ISO-8859-1; name=add_test_for_pg_stat_statements.patchDownload+185-0
Hi,
On Tue, Mar 09, 2021 at 11:35:14AM +0800, Erica Zhang wrote:
Hi All,
On the master branch, it is possible to install multiple versions of pg_stat_statements with CREATE EXTENSION, but all the tests in sql/ on look at the latest version available, without testing past compatibility.Since we support to install lowest version 1.4 currently, add some tests to verify compatibility, upgrade from lower versions of pg_stat_statements.
The upgrade scripts are already tested as postgres will install 1.4 and perform
all upgrades to reach the default version.
But an additional thing being tested here is the ABI compatibility when there's
a mismatch between the library and the SQL definition, which seems like a
reasonable thing to test.
Looking at the patch:
+SELECT * FROM pg_available_extensions WHERE name = 'pg_stat_statements' and installed_version = '1.4';
What is this supposed to test? All those tests will break every time we change
the default version, which will add maintenance efforts. It could be good to
have one test breaking when changing the version to remind us to add a test for
the new version, but not more.
Hi Erica,
On Wed, Mar 10, 2021 at 11:14:52AM +0800, Erica Zhang wrote:
Hi Julien,
Thanks a lot for the quick review. Please see my answer below in blue. Attached is the new patch.
Thanks!
The upgrade scripts are already tested as postgres will install 1.4 and perform
all upgrades to reach the default version.Thanks for pointing that the upgrades paths are covered by upgrade scripts tests. Since I don't need to test the upgrade, I will test the installation of different versions directly, any concern?
I think you should keep your previous approach. The result will be the same
but it will consume less resources for that which is always good.
+SELECT * FROM pg_available_extensions WHERE name = 'pg_stat_statements' and installed_version = '1.4';
What is this supposed to test? All those tests will break every time we change
the default version, which will add maintenance efforts. It could be good to
have one test breaking when changing the version to remind us to add a test for
the new version, but not more.Here I just want to verify that "installed" version is the expected version. But we do have the issue as you mentioned which will add maintenance efforts.
So I prefer to keep one test as now which can remind us to add a new version. As for others, just to check the count(*) to make sure installation is success.
Such as SELECT count(*) FROM pg_available_extensions WHERE name = 'pg_stat_statements' and installed_version = '1.4'; What do you think?
How about tweaking your previous query so only the last execution fails when
pg_stat_statements default version is updated? Something like:
SELECT installed_version = default_version, installed_version
FROM pg_available_extensions
WHERE name = 'pg_stat_statements';
This way the same query can be reused for both older versions and current
version.
Also, can you register your patch for the next commitfest at
https://commitfest.postgresql.org/33/, to make sure it won't be forgotten?
Import Notes
Reply to msg id not found: tencent_A7EB5CAC90CA14BA65FA173D0B1A8FBC6F09@qq.com
Hi Julien,
Thanks a lot for the quick review. Please see my answer below in blue. Attached is the new patch.
------------------ Original ------------------
From: "Julien Rouhaud" <rjuju123@gmail.com>;
Date: Tue, Mar 9, 2021 05:09 PM
To: "Erica Zhang"<ericazhangy@qq.com>;
Cc: "pgsql-hackers"<pgsql-hackers@postgresql.org>;
Subject: Re: Add some tests for pg_stat_statements compatibility verification under contrib
Hi,
On Tue, Mar 09, 2021 at 11:35:14AM +0800, Erica Zhang wrote:
> Hi All,
> On the master branch, it is possible to install multiple versions of pg_stat_statements with CREATE EXTENSION, but all the tests in sql/ on look at the latest version available, without testing past compatibility.
>
> Since we support to install lowest version 1.4 currently, add some tests to verify compatibility, upgrade from lower versions of pg_stat_statements.
The upgrade scripts are already tested as postgres will install 1.4 and perform
all upgrades to reach the default version.
Thanks for pointing that the upgrades paths are covered by upgrade scripts tests. So I don't need to verify the upgrade, I will test the installation of different versions directly, any concern?
But an additional thing being tested here is the ABI compatibility when there's
a mismatch between the library and the SQL definition, which seems like a
reasonable thing to test.
Looking at the patch:
+SELECT * FROM pg_available_extensions WHERE name = 'pg_stat_statements' and installed_version = '1.4';
What is this supposed to test? All those tests will break every time we change
the default version, which will add maintenance efforts. It could be good to
have one test breaking when changing the version to remind us to add a test for
the new version, but not more.
Here I just want to verify that "installed" version is the expected version. But we do have the issue as you mentioned which will add maintenance efforts.
So I prefer to keep one test as now which can remind us to add a new version. As for others, just to check the count(*) to make sure installation is success.
Such as SELECT count(*) FROM pg_available_extensions WHERE name = 'pg_stat_statements' and installed_version = '1.4'; What do you think?
Attachments:
v2_add_test_for_pg_stat_statements.patchapplication/octet-stream; charset=ISO-8859-1; name=v2_add_test_for_pg_stat_statements.patchDownload+195-0
Import Notes
Resolved by subject fallback
Hi Julien,
------------------ Original ------------------
From: "Julien Rouhaud" <rjuju123@gmail.com>;
Date: Wed, Mar 10, 2021 11:35 AM
To: "Erica Zhang"<ericazhangy@qq.com>;
Cc: "pgsql-hackers"<pgsql-hackers@postgresql.org>;
Subject: Re: Add some tests for pg_stat_statements compatibility verification under contrib
Hi Erica,
On Wed, Mar 10, 2021 at 11:14:52AM +0800, Erica Zhang wrote:
> Hi Julien,
> Thanks a lot for the quick review. Please see my answer below in blue. Attached is the new patch.
Thanks!
>> The upgrade scripts are already tested as postgres will install 1.4 and perform
>> all upgrades to reach the default version.
> Thanks for pointing that the upgrades paths are covered by upgrade scripts tests. Since I don't need to test the upgrade, I will test the installation of different versions directly, any concern?
I think you should keep your previous approach. The result will be the same
but it will consume less resources for that which is always good.
Agreed!
>> +SELECT * FROM pg_available_extensions WHERE name = 'pg_stat_statements' and installed_version = '1.4';
>>
>>
>> What is this supposed to test?&nbsp; All those tests will break every time we change
>> the default version, which will add maintenance efforts.&nbsp; It could be good to
>> have one test breaking when changing the version to remind us to add a test for
>> the new version, but not more.
> Here I just want to verify that "installed" version is the expected version. But we do have the issue as you mentioned which will add maintenance efforts.
>
> So I prefer to keep one test as now which can remind us to add a new version. As for others, just to check the count(*) to make sure installation is success.
> Such as SELECT count(*) FROM pg_available_extensions WHERE name = 'pg_stat_statements' and installed_version = '1.4'; What do you think?
How about tweaking your previous query so only the last execution fails when
pg_stat_statements default version is updated? Something like:
SELECT installed_version = default_version, installed_version
FROM pg_available_extensions
WHERE name = 'pg_stat_statements';
This way the same query can be reused for both older versions and current
version.
Yep, it's neater to use the query as you suggested. Thanks!
Also, can you register your patch for the next commitfest at
https://commitfest.postgresql.org/33/, to make sure it won't be forgotten?
Attachments:
v3_add_test_for_pg_stat_statements.patchapplication/octet-stream; charset=ISO-8859-1; name=v3_add_test_for_pg_stat_statements.patchDownload+185-0
On Mon, Mar 15, 2021 at 03:05:24PM +0800, Erica Zhang wrote:
This way the same query can be reused for both older versions and current
version.
Yep, it's neater to use the query as you suggested. Thanks!Also, can you register your patch for the next commitfest at
https://commitfest.postgresql.org/33/, to make sure it won't be forgotten?
I was just looking at your patch, and I think that you should move all
the past compatibility tests into a separate test file, in a way
consistent to what we do in contrib/pageinspect/ for
oldextversions.sql. I would suggest to use the same file names, while
on it.
--
Michael
On Wed, Aug 25, 2021 at 04:16:08PM +0900, Michael Paquier wrote:
I was just looking at your patch, and I think that you should move all
the past compatibility tests into a separate test file, in a way
consistent to what we do in contrib/pageinspect/ for
oldextversions.sql. I would suggest to use the same file names, while
on it.
The current commit fest is ending, and it would be a waste to do
nothing here, so I have looked at what you proposed and reworked it.
The patch was blindly testing pg_stat_statements_reset() in all the
versions bumped with the same query on pg_stat_statements done each
time, which does not help in checking the actual parts of the code
that have changed, and there are two of them:
- pg_stat_statements_reset() execution got authorized for
pg_read_all_stats once in 1.6.
- pg_stat_statements() has been extended in 1.8, so we could just have
one query stressing this function in the tests for <= 1.7.
There is also no need for tests on 1.9, which is the latest version.
Tests for this one should be added once we bump the code to the next
version. At the end I finish with the attached, counting for the
back-and-forth game with pg_read_all_stats.
--
Michael
Attachments:
v4-0001-Add-some-tests-for-past-versions-of-pg_stat_state.patchtext/x-diff; charset=us-asciiDownload+179-2
On Thu, Sep 30, 2021 at 11:12:21AM +0900, Michael Paquier wrote:
There is also no need for tests on 1.9, which is the latest version.
Tests for this one should be added once we bump the code to the next
version. At the end I finish with the attached, counting for the
back-and-forth game with pg_read_all_stats.
Done as of 2b0da03.
--
Michael