Re: Test to dump and restore objects left behind by regression
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
From: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, vignesh C <vignesh21@gmail.com>, Daniel Gustafsson <daniel@yesql.se>, Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter@eisentraut.org>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-03-28T12:27:50Z
Lists: pgsql-hackers
Attachments
- parallel_schedule_dump_restore (application/octet-stream)
On Fri, Mar 28, 2025 at 12:20 PM Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> wrote: > > On Fri, Mar 28, 2025 at 7:07 AM Michael Paquier <michael@paquier.xyz> wrote: > > > > On Thu, Mar 27, 2025 at 06:15:06PM +0100, Alvaro Herrera wrote: > > > BTW another idea to shorten this tests's runtime might be to try and > > > identify which of parallel_schedule tests leave objects behind and > > > create a shorter schedule with only those (a possible implementation > > > might keep a list of the slow tests that don't leave any useful object > > > behind, then filter parallel_schedule to exclude those; this ensures > > > test files created in the future are still used.) > > > > I'm not much a fan of approaches that require an extra schedule, > > because this is prone to forget the addition of objects that we'd want > > to cover for the scope of this thread with the dump/restore > > inter-dependencies, failing our goal of having more coverage. And > > history has proven that we are quite bad at maintaining multiple > > schedules for the regression test suite (remember the serial one or > > the standby one in pg_regress?). So we should really do things so as > > the schedules are down to a strict minimum: 1. > > I see Alvaro's point about using a different and minimal schedule. We > already have 002_pg_upgrade and 027_stream_ as candidates which could > use schedules other than default and avoid wasting CPU cycles. > But I also agree with your opinion that maintaining multiple schedules > is painful and prone to errors. > > What we could do is to create the schedule files automatically during > build. The automation script will require to know which file to place > in which schedules. That information could be either part of the sql > file itself or could be in a separate text file. For example, every > SQL file has the following line listing all the schedules that this > SQL file should be part of. E.g. > > -- schedules: parallel, serial, upgrade > > The automated script looks at every .sql file in a given sql directory > and creates the schedule files containing all the SQL files which had > respective schedules mentioned in their "schedule" annotation. The > automation script would flag SQL files that do not have scheduled > annotation so any new file added won't be missed. However, we will > still miss a SQL file if it wasn't part of a given schedule and later > acquired some changes which required it to be added to a new schedule. > > If we go this route, we could make 'make check-tests' better. We could > add another annotation for depends listing all the SQL files that a > given SQL file depends upon. make check-tests would collect all > dependencies, sort them and run all the dependencies as well. > > Of course that's out of scope for this patch. We don't have time left > for this in PG 18. I spent several hours today examining each SQL file to decide whether or not it has "interesting" objects that it leaves behind for dump/restore test. I came up with attached schedule - which may not be accurate since I it would require much more time to examine all tests to get an accurate schedule. But what I have got may be close enough. With that we could save about 6 seconds on my laptop. If we further compact the schedule reorganizing the parallel groups we may shave some more seconds. no modifications to parallel schedule 1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK 41.84s 28 subtests passed 1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK 41.80s 28 subtests passed 1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK 41.37s 28 subtests passed with attached modified parallel schedule 1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK 36.13s 28 subtests passed 1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK 35.86s 28 subtests passed 1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK 36.33s 28 subtests passed 1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK 36.02s 28 subtests passed However, it's a very painful process to come up with the schedule and more painful and error prone to maintain it. It could take many days to come up with the right schedule which can become inaccurate the moment next SQL file is added OR an existing file is modified to add/drop "interesting" objects. -- Best Wishes, Ashutosh Bapat
Commits
-
Hide expensive pg_upgrade test behind PG_TEST_EXTRA
- d185161e4739 18.0 landed
- 37fc1803cc12 19 (unreleased) landed
-
Set log_statement=none in t/002_pg_upgrade.pl
- 64fba9c61787 18.0 landed
-
002_pg_upgrade.pl: Move pg_dump test code for better stability
- 8806e4e8deb1 18.0 landed
-
002_pg_upgrade.pl: rename some variables for clarity
- abe56227b2e2 18.0 landed
-
Verify roundtrip dump/restore of regression database
- 172259afb563 18.0 landed
-
Refactor TAP test code for file comparisons into new routine in Utils.pm
- 169208092f5c 18.0 landed
-
Virtual generated columns
- 83ea6c54025b 18.0 cited
-
Put generated_stored test objects in a schema
- 894be11adfa6 18.0 cited
-
Introduce "builtin" collation provider.
- 2d819a08a1cb 17.0 cited
-
Revert "Improve compression and storage support with inheritance"
- 74563f6b9021 17.0 cited