From 93fcc5c5d85967812abcd41771d9b44900700019 Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Fri, 20 Jan 2023 13:34:33 +0100 Subject: [PATCH] Move tablespace directory creation to pg_regress_multi.pl (#6629) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Multiple `check-xxx` targets create tablespaces. If you run two of these at the same time you would get an error like: ```diff CREATE TABLESPACE test_tablespace LOCATION :'test_tablespace'; +ERROR:  directory "/home/rajesh/citus/citus/src/test/regress/tmp_check/ts0/PG_14_202107181" already in use as a tablespace ``` This fixes that by moving creation of table space directory creation and removal to pg_regress_multi.pl instead of being in the Makefile. --- src/test/regress/Makefile | 13 ++----------- src/test/regress/pg_regress_multi.pl | 11 +++++++++++ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/test/regress/Makefile b/src/test/regress/Makefile index 7653a1861..86c2f3996 100644 --- a/src/test/regress/Makefile +++ b/src/test/regress/Makefile @@ -56,20 +56,12 @@ ISOLATION_BUILDDIR=build/specs # ex: make print-generated_isolation_files print-% : ; @echo $* = $($*) -.PHONY: create-symbolic-link create-tablespaces +.PHONY: create-symbolic-link create-symbolic-link: mkdir -p $(citus_abs_srcdir)/build ln -fsn $(citus_abs_srcdir)/expected $(citus_abs_srcdir)/build/ -create-tablespaces: - rm -rf $(citus_abs_srcdir)/tmp_check/ts1 - mkdir -p $(citus_abs_srcdir)/tmp_check/ts1 - rm -rf $(citus_abs_srcdir)/tmp_check/ts0 - mkdir -p $(citus_abs_srcdir)/tmp_check/ts0 - rm -rf $(citus_abs_srcdir)/tmp_check/ts2 - mkdir -p $(citus_abs_srcdir)/tmp_check/ts2 - # How this target works: # cpp is used before running isolation tests to preprocess spec files. # This way we can include any file we want to. Currently this is used to include mx common part. @@ -107,7 +99,7 @@ check-base: all -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/base_schedule $(EXTRA_TESTS) # check-minimal only sets up the cluster -check-minimal: all create-tablespaces +check-minimal: all $(pg_regress_multi_check) --load-extension=citus \ -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/minimal_schedule $(EXTRA_TESTS) @@ -285,4 +277,3 @@ clean distclean maintainer-clean: rm -rf tmp_check/ rm -rf tmp_citus_test/ -all: create-tablespaces diff --git a/src/test/regress/pg_regress_multi.pl b/src/test/regress/pg_regress_multi.pl index 25615b87b..52816592b 100755 --- a/src/test/regress/pg_regress_multi.pl +++ b/src/test/regress/pg_regress_multi.pl @@ -624,6 +624,17 @@ for my $port (@followerWorkerPorts) } } +for my $tablespace ("ts0", "ts1", "ts2") +{ + if (-e catfile($TMP_CHECKDIR, $tablespace)) + { + remove_tree(catfile($TMP_CHECKDIR, $tablespace)) or die "Could not remove tablespace directory"; + } + system("mkdir", ("-p", catfile($TMP_CHECKDIR, $tablespace))) == 0 + or die "Could not create vanilla testtablespace dir."; +} + + # Prepare directory in which 'psql' has some helpful variables for locating the workers make_path(catfile($TMP_CHECKDIR, $TMP_BINDIR)) or die "Could not create $TMP_BINDIR directory $!\n";