Add .NOTPARALLEL to contrib/Makefile
Hi,
Currently running "make -j16 all check" in contrib/ results in a mess because
all pg_regress invocations fight over the same port. Adding a simple
.NOTPARALLEL: check-%-recurse
into contrib/Makefile fixes that. Do we want that?
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
Currently running "make -j16 all check" in contrib/ results in a mess because
all pg_regress invocations fight over the same port. Adding a simple
.NOTPARALLEL: check-%-recurse
into contrib/Makefile fixes that. Do we want that?
Dunno, but if we do, it should be applied to installcheck as well.
(In that case the fight is over the contrib_regression database.)
A larger point is that you shouldn't really fix this only for contrib.
What about tests run in src/pl, or contrib vs the main regression tests
vs src/pl vs test/isolationtester, etc etc.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 2014-08-25 20:16:50 -0400, Tom Lane wrote:
Andres Freund <andres@2ndquadrant.com> writes:
Currently running "make -j16 all check" in contrib/ results in a mess because
all pg_regress invocations fight over the same port. Adding a simple
.NOTPARALLEL: check-%-recurse
into contrib/Makefile fixes that. Do we want that?Dunno, but if we do, it should be applied to installcheck as well.
(In that case the fight is over the contrib_regression database.)
Right. Although you can mostly fight it there using USE_MODULE_DB.
The attached patch that replaces all hardcoded occurrences of
'contrib_regression' with current_database(). Allowing a make -j32 -s
installcheck in contrib to succeed in less than 4 seconds...
That's not particularly pretty, especially in the CREATE SERVER calls
(via DO ... EXECUTE), but imo worth it given the timesavings.
What's your thought on that one?
A larger point is that you shouldn't really fix this only for contrib.
What about tests run in src/pl, or contrib vs the main regression tests
vs src/pl vs test/isolationtester, etc etc.
Unfortunately I don't think you can make .NOTPARALLEL work across more
than one directory when using recursive make :(. At least I don't know
how.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachments:
0001-Don-t-hardcode-contrib_regression-dbname-in-postgres.patchtext/x-patch; charset=us-asciiDownload
>From e81c42ed9eb640dab874bf5778e5e71b485633ba Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Tue, 26 Aug 2014 02:54:53 +0200
Subject: [PATCH] Don't hardcode contrib_regression dbname in postgres_fdw and
dblink tests.
That allows parallel make installcheck to succeed inside contrib/. The
output is not particularly pretty, but it's fast.
---
contrib/dblink/Makefile | 3 --
contrib/dblink/expected/dblink.out | 40 ++++++++++++++-----------
contrib/dblink/sql/dblink.sql | 41 +++++++++++++++-----------
contrib/postgres_fdw/Makefile | 3 --
contrib/postgres_fdw/expected/postgres_fdw.out | 8 +++--
contrib/postgres_fdw/sql/postgres_fdw.sql | 8 +++--
6 files changed, 57 insertions(+), 46 deletions(-)
diff --git a/contrib/dblink/Makefile b/contrib/dblink/Makefile
index e5d0cd6..f5ab164 100644
--- a/contrib/dblink/Makefile
+++ b/contrib/dblink/Makefile
@@ -14,9 +14,6 @@ REGRESS = paths dblink
REGRESS_OPTS = --dlpath=$(top_builddir)/src/test/regress
EXTRA_CLEAN = sql/paths.sql expected/paths.out
-# the db name is hard-coded in the tests
-override USE_MODULE_DB =
-
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
diff --git a/contrib/dblink/expected/dblink.out b/contrib/dblink/expected/dblink.out
index eee31a2..0dc4838 100644
--- a/contrib/dblink/expected/dblink.out
+++ b/contrib/dblink/expected/dblink.out
@@ -90,7 +90,7 @@ SELECT dblink_build_sql_delete('"MySchema"."Foo"','1 2',2,'{"0", "a"}');
-- regular old dblink
SELECT *
-FROM dblink('dbname=contrib_regression','SELECT * FROM foo') AS t(a int, b text, c text[])
+FROM dblink('dbname='||current_database(),'SELECT * FROM foo') AS t(a int, b text, c text[])
WHERE t.a > 7;
a | b | c
---+---+------------
@@ -116,9 +116,9 @@ DECLARE
detail text;
BEGIN
PERFORM wait_pid(crash_pid)
- FROM dblink('dbname=contrib_regression', $$
+ FROM dblink('dbname='||current_database(), $$
SELECT pg_backend_pid() FROM dblink(
- 'service=test_ldap dbname=contrib_regression',
+ 'service=test_ldap dbname='||current_database(),
-- This string concatenation is a hack to shoehorn a
-- set_pgservicefile call into the SQL statement.
'SELECT 1' || set_pgservicefile('pg_service.conf')
@@ -131,7 +131,7 @@ EXCEPTION WHEN OTHERS THEN
END
$pl$;
-- create a persistent connection
-SELECT dblink_connect('dbname=contrib_regression');
+SELECT dblink_connect('dbname='||current_database());
dblink_connect
----------------
OK
@@ -267,14 +267,14 @@ WHERE t.a > 7;
ERROR: connection not available
-- put more data into our slave table, first using arbitrary connection syntax
-- but truncate the actual return value so we can use diff to check for success
-SELECT substr(dblink_exec('dbname=contrib_regression','INSERT INTO foo VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6);
+SELECT substr(dblink_exec('dbname='||current_database(),'INSERT INTO foo VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6);
substr
--------
INSERT
(1 row)
-- create a persistent connection
-SELECT dblink_connect('dbname=contrib_regression');
+SELECT dblink_connect('dbname='||current_database());
dblink_connect
----------------
OK
@@ -374,7 +374,7 @@ ERROR: could not establish connection
DETAIL: missing "=" after "myconn" in connection info string
-- create a named persistent connection
-SELECT dblink_connect('myconn','dbname=contrib_regression');
+SELECT dblink_connect('myconn','dbname='||current_database());
dblink_connect
----------------
OK
@@ -403,10 +403,10 @@ CONTEXT: Error occurred on dblink connection named "myconn": could not execute
-- create a second named persistent connection
-- should error with "duplicate connection name"
-SELECT dblink_connect('myconn','dbname=contrib_regression');
+SELECT dblink_connect('myconn','dbname='||current_database());
ERROR: duplicate connection name
-- create a second named persistent connection with a new name
-SELECT dblink_connect('myconn2','dbname=contrib_regression');
+SELECT dblink_connect('myconn2','dbname='||current_database());
dblink_connect
----------------
OK
@@ -601,7 +601,7 @@ ERROR: could not establish connection
DETAIL: missing "=" after "myconn" in connection info string
-- create a named persistent connection
-SELECT dblink_connect('myconn','dbname=contrib_regression');
+SELECT dblink_connect('myconn','dbname='||current_database());
dblink_connect
----------------
OK
@@ -677,7 +677,7 @@ SELECT dblink_disconnect('myconn');
SELECT dblink_disconnect('myconn');
ERROR: connection "myconn" not available
-- test asynchronous queries
-SELECT dblink_connect('dtest1', 'dbname=contrib_regression');
+SELECT dblink_connect('dtest1', 'dbname='||current_database());
dblink_connect
----------------
OK
@@ -690,7 +690,7 @@ SELECT * from
1
(1 row)
-SELECT dblink_connect('dtest2', 'dbname=contrib_regression');
+SELECT dblink_connect('dtest2', 'dbname='||current_database());
dblink_connect
----------------
OK
@@ -703,7 +703,7 @@ SELECT * from
1
(1 row)
-SELECT dblink_connect('dtest3', 'dbname=contrib_regression');
+SELECT dblink_connect('dtest3', 'dbname='||current_database());
dblink_connect
----------------
OK
@@ -777,7 +777,7 @@ SELECT * from result;
10 | k | {a10,b10,c10}
(11 rows)
-SELECT dblink_connect('dtest1', 'dbname=contrib_regression');
+SELECT dblink_connect('dtest1', 'dbname='||current_database());
dblink_connect
----------------
OK
@@ -810,8 +810,12 @@ SELECT dblink_disconnect('dtest1');
-- test foreign data wrapper functionality
CREATE ROLE dblink_regression_test;
-CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw
- OPTIONS (dbname 'contrib_regression');
+DO $d$
+ BEGIN
+ EXECUTE $$CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw
+ OPTIONS (dbname '$$||current_database()||$$')$$;
+ END;
+$d$;
CREATE USER MAPPING FOR public SERVER fdtest
OPTIONS (server 'localhost'); -- fail, can't specify server here
ERROR: invalid option "server"
@@ -854,7 +858,7 @@ DROP USER dblink_regression_test;
DROP USER MAPPING FOR public SERVER fdtest;
DROP SERVER fdtest;
-- test asynchronous notifications
-SELECT dblink_connect('dbname=contrib_regression');
+SELECT dblink_connect('dbname='||current_database());
dblink_connect
----------------
OK
@@ -943,7 +947,7 @@ SELECT dblink_build_sql_delete('test_dropped', '1', 1,
SET datestyle = ISO, MDY;
SET intervalstyle = postgres;
SET timezone = UTC;
-SELECT dblink_connect('myconn','dbname=contrib_regression');
+SELECT dblink_connect('myconn','dbname='||current_database());
dblink_connect
----------------
OK
diff --git a/contrib/dblink/sql/dblink.sql b/contrib/dblink/sql/dblink.sql
index 500c684..e60b8c5 100644
--- a/contrib/dblink/sql/dblink.sql
+++ b/contrib/dblink/sql/dblink.sql
@@ -57,7 +57,7 @@ SELECT dblink_build_sql_delete('"MySchema"."Foo"','1 2',2,'{"0", "a"}');
-- regular old dblink
SELECT *
-FROM dblink('dbname=contrib_regression','SELECT * FROM foo') AS t(a int, b text, c text[])
+FROM dblink('dbname='||current_database(),'SELECT * FROM foo') AS t(a int, b text, c text[])
WHERE t.a > 7;
-- should generate "connection not available" error
@@ -78,9 +78,9 @@ DECLARE
detail text;
BEGIN
PERFORM wait_pid(crash_pid)
- FROM dblink('dbname=contrib_regression', $$
+ FROM dblink('dbname='||current_database(), $$
SELECT pg_backend_pid() FROM dblink(
- 'service=test_ldap dbname=contrib_regression',
+ 'service=test_ldap dbname='||current_database(),
-- This string concatenation is a hack to shoehorn a
-- set_pgservicefile call into the SQL statement.
'SELECT 1' || set_pgservicefile('pg_service.conf')
@@ -94,7 +94,7 @@ END
$pl$;
-- create a persistent connection
-SELECT dblink_connect('dbname=contrib_regression');
+SELECT dblink_connect('dbname='||current_database());
-- use the persistent connection
SELECT *
@@ -155,10 +155,10 @@ WHERE t.a > 7;
-- put more data into our slave table, first using arbitrary connection syntax
-- but truncate the actual return value so we can use diff to check for success
-SELECT substr(dblink_exec('dbname=contrib_regression','INSERT INTO foo VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6);
+SELECT substr(dblink_exec('dbname='||current_database(),'INSERT INTO foo VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6);
-- create a persistent connection
-SELECT dblink_connect('dbname=contrib_regression');
+SELECT dblink_connect('dbname='||current_database());
-- put more data into our slave table, using persistent connection syntax
-- but truncate the actual return value so we can use diff to check for success
@@ -204,7 +204,7 @@ FROM dblink('myconn','SELECT * FROM foo') AS t(a int, b text, c text[])
WHERE t.a > 7;
-- create a named persistent connection
-SELECT dblink_connect('myconn','dbname=contrib_regression');
+SELECT dblink_connect('myconn','dbname='||current_database());
-- use the named persistent connection
SELECT *
@@ -218,10 +218,10 @@ WHERE t.a > 7;
-- create a second named persistent connection
-- should error with "duplicate connection name"
-SELECT dblink_connect('myconn','dbname=contrib_regression');
+SELECT dblink_connect('myconn','dbname='||current_database());
-- create a second named persistent connection with a new name
-SELECT dblink_connect('myconn2','dbname=contrib_regression');
+SELECT dblink_connect('myconn2','dbname='||current_database());
-- use the second named persistent connection
SELECT *
@@ -307,7 +307,7 @@ FROM dblink('myconn','SELECT * FROM foo') AS t(a int, b text, c text[])
WHERE t.a > 7;
-- create a named persistent connection
-SELECT dblink_connect('myconn','dbname=contrib_regression');
+SELECT dblink_connect('myconn','dbname='||current_database());
-- put more data into our slave table, using named persistent connection syntax
-- but truncate the actual return value so we can use diff to check for success
@@ -341,15 +341,15 @@ SELECT dblink_disconnect('myconn');
SELECT dblink_disconnect('myconn');
-- test asynchronous queries
-SELECT dblink_connect('dtest1', 'dbname=contrib_regression');
+SELECT dblink_connect('dtest1', 'dbname='||current_database());
SELECT * from
dblink_send_query('dtest1', 'select * from foo where f1 < 3') as t1;
-SELECT dblink_connect('dtest2', 'dbname=contrib_regression');
+SELECT dblink_connect('dtest2', 'dbname='||current_database());
SELECT * from
dblink_send_query('dtest2', 'select * from foo where f1 > 2 and f1 < 7') as t1;
-SELECT dblink_connect('dtest3', 'dbname=contrib_regression');
+SELECT dblink_connect('dtest3', 'dbname='||current_database());
SELECT * from
dblink_send_query('dtest3', 'select * from foo where f1 > 6') as t1;
@@ -378,7 +378,7 @@ SELECT dblink_disconnect('dtest3');
SELECT * from result;
-SELECT dblink_connect('dtest1', 'dbname=contrib_regression');
+SELECT dblink_connect('dtest1', 'dbname='||current_database());
SELECT * from
dblink_send_query('dtest1', 'select * from foo where f1 < 3') as t1;
@@ -388,8 +388,13 @@ SELECT dblink_disconnect('dtest1');
-- test foreign data wrapper functionality
CREATE ROLE dblink_regression_test;
-CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw
- OPTIONS (dbname 'contrib_regression');
+DO $d$
+ BEGIN
+ EXECUTE $$CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw
+ OPTIONS (dbname '$$||current_database()||$$')$$;
+ END;
+$d$;
+
CREATE USER MAPPING FOR public SERVER fdtest
OPTIONS (server 'localhost'); -- fail, can't specify server here
CREATE USER MAPPING FOR public SERVER fdtest OPTIONS (user :'USER');
@@ -412,7 +417,7 @@ DROP USER MAPPING FOR public SERVER fdtest;
DROP SERVER fdtest;
-- test asynchronous notifications
-SELECT dblink_connect('dbname=contrib_regression');
+SELECT dblink_connect('dbname='||current_database());
--should return listen
SELECT dblink_exec('LISTEN regression');
@@ -458,7 +463,7 @@ SELECT dblink_build_sql_delete('test_dropped', '1', 1,
SET datestyle = ISO, MDY;
SET intervalstyle = postgres;
SET timezone = UTC;
-SELECT dblink_connect('myconn','dbname=contrib_regression');
+SELECT dblink_connect('myconn','dbname='||current_database());
SELECT dblink_exec('myconn', 'SET datestyle = GERMAN, DMY;');
-- single row synchronous case
diff --git a/contrib/postgres_fdw/Makefile b/contrib/postgres_fdw/Makefile
index 7c66095..a9e380d 100644
--- a/contrib/postgres_fdw/Makefile
+++ b/contrib/postgres_fdw/Makefile
@@ -13,9 +13,6 @@ DATA = postgres_fdw--1.0.sql
REGRESS = postgres_fdw
-# the db name is hard-coded in the tests
-override USE_MODULE_DB =
-
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
diff --git a/contrib/postgres_fdw/expected/postgres_fdw.out b/contrib/postgres_fdw/expected/postgres_fdw.out
index 7eead58..5fe752a 100644
--- a/contrib/postgres_fdw/expected/postgres_fdw.out
+++ b/contrib/postgres_fdw/expected/postgres_fdw.out
@@ -3,8 +3,12 @@
-- ===================================================================
CREATE EXTENSION postgres_fdw;
CREATE SERVER testserver1 FOREIGN DATA WRAPPER postgres_fdw;
-CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw
- OPTIONS (dbname 'contrib_regression');
+DO $d$
+ BEGIN
+ EXECUTE $$CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw
+ OPTIONS (dbname '$$||current_database()||$$');$$;
+ END;
+$d$;
CREATE USER MAPPING FOR public SERVER testserver1
OPTIONS (user 'value', password 'value');
CREATE USER MAPPING FOR CURRENT_USER SERVER loopback;
diff --git a/contrib/postgres_fdw/sql/postgres_fdw.sql b/contrib/postgres_fdw/sql/postgres_fdw.sql
index 9f54359..ba5ef91 100644
--- a/contrib/postgres_fdw/sql/postgres_fdw.sql
+++ b/contrib/postgres_fdw/sql/postgres_fdw.sql
@@ -5,8 +5,12 @@
CREATE EXTENSION postgres_fdw;
CREATE SERVER testserver1 FOREIGN DATA WRAPPER postgres_fdw;
-CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw
- OPTIONS (dbname 'contrib_regression');
+DO $d$
+ BEGIN
+ EXECUTE $$CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw
+ OPTIONS (dbname '$$||current_database()||$$');$$;
+ END;
+$d$;
CREATE USER MAPPING FOR public SERVER testserver1
OPTIONS (user 'value', password 'value');
--
2.0.0.rc2.4.g1dc51c6.dirty
On Tue, 2014-08-26 at 02:05 +0200, Andres Freund wrote:
Currently running "make -j16 all check" in contrib/ results in a mess
because
all pg_regress invocations fight over the same port. Adding a simple
.NOTPARALLEL: check-%-recurse
into contrib/Makefile fixes that. Do we want that?
But that causes also the "all" to be run in not-parallel, because the
meaning of .NOTPARALLEL is:
If `.NOTPARALLEL' is mentioned as a target, then this invocation of
`make' will be run serially, even if the `-j' option is given.
It does not mean, as you appear to imagine, to run only the listed
prerequisites in not-parallel. That would be nice!
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 2014-08-26 23:56:10 -0400, Peter Eisentraut wrote:
On Tue, 2014-08-26 at 02:05 +0200, Andres Freund wrote:
Currently running "make -j16 all check" in contrib/ results in a mess
because
all pg_regress invocations fight over the same port. Adding a simple
.NOTPARALLEL: check-%-recurse
into contrib/Makefile fixes that. Do we want that?But that causes also the "all" to be run in not-parallel, because the
meaning of .NOTPARALLEL is:If `.NOTPARALLEL' is mentioned as a target, then this invocation of
`make' will be run serially, even if the `-j' option is given.
Argh. There goes that.
It does not mean, as you appear to imagine, to run only the listed
prerequisites in not-parallel. That would be nice!
Yea.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers