Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9c83bbc

Browse files
committed
Create regress_tblspc in test_setup
An upcoming test needs to use a tablespace as part of its test. Historically,we wanted tablespace creation be done in a dedicated file, so it's easy todisable when testing replication. But that is not necessary anymore, due toallow_in_place_tablespaces.Create regress_tblspace tablespace in test_setup. Move the tablespace test tothe end of the parallel schedule, so other tests can use it.Author: Melanie Plageman <melanieplageman@gmail.com>Reviewed-by: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/20200124195226.lth52iydq2n2uilq@alap3.anarazel.de
1 parenta9c70b4 commit9c83bbc

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

‎src/test/regress/expected/tablespace.out

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ SELECT spcoptions FROM pg_tablespace WHERE spcname = 'regress_tblspacewith';
2222

2323
-- drop the tablespace so we can re-use the location
2424
DROP TABLESPACE regress_tblspacewith;
25-
-- create a tablespace we can use
26-
CREATE TABLESPACE regress_tblspace LOCATION '';
2725
-- This returns a relative path as of an effect of allow_in_place_tablespaces,
2826
-- masking the tablespace OID used in the path name.
2927
SELECT regexp_replace(pg_tablespace_location(oid), '(pg_tblspc)/(\d+)', '\1/NNN')
@@ -331,7 +329,7 @@ CREATE TABLE testschema.part1 PARTITION OF testschema.part FOR VALUES IN (1);
331329
CREATE INDEX part_a_idx ON testschema.part (a) TABLESPACE regress_tblspace;
332330
CREATE TABLE testschema.part2 PARTITION OF testschema.part FOR VALUES IN (2);
333331
SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c
334-
where c.reltablespace = t.oid AND c.relname LIKE 'part%_idx';
332+
where c.reltablespace = t.oid AND c.relname LIKE 'part%_idx' ORDER BY relname;
335333
relname | spcname
336334
-------------+------------------
337335
part1_a_idx | regress_tblspace

‎src/test/regress/expected/test_setup.out

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ SET synchronous_commit = on;
1818
-- and most of the core regression tests still expect that.
1919
--
2020
GRANT ALL ON SCHEMA public TO public;
21+
-- Create a tablespace we can use in tests.
22+
SET allow_in_place_tablespaces = true;
23+
CREATE TABLESPACE regress_tblspace LOCATION '';
2124
--
2225
-- These tables have traditionally been referenced by many tests,
2326
-- so create and populate them. Insert only non-error values here.

‎src/test/regress/parallel_schedule

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
# required setup steps
1212
test: test_setup
1313

14-
# run tablespace by itself, and early, because it forces a checkpoint;
15-
# we'd prefer not to have checkpoints later in the tests because that
16-
# interferes with crash-recovery testing.
17-
test: tablespace
18-
1914
# ----------
2015
# The first group of parallel tests
2116
# ----------
@@ -132,3 +127,7 @@ test: event_trigger oidjoins
132127

133128
# this test also uses event triggers, so likewise run it by itself
134129
test: fast_default
130+
131+
# run tablespace test at the end because it drops the tablespace created during
132+
# setup that other tests may use.
133+
test: tablespace

‎src/test/regress/sql/tablespace.sql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ SELECT spcoptions FROM pg_tablespace WHERE spcname = 'regress_tblspacewith';
2020
-- drop the tablespace so we can re-use the location
2121
DROPTABLESPACE regress_tblspacewith;
2222

23-
-- create a tablespace we can use
24-
CREATETABLESPACEregress_tblspace LOCATION'';
2523
-- This returns a relative path as of an effect of allow_in_place_tablespaces,
2624
-- masking the tablespace OID used in the path name.
2725
SELECT regexp_replace(pg_tablespace_location(oid),'(pg_tblspc)/(\d+)','\1/NNN')
@@ -225,7 +223,7 @@ CREATE TABLE testschema.part1 PARTITION OF testschema.part FOR VALUES IN (1);
225223
CREATEINDEXpart_a_idxONtestschema.part (a) TABLESPACE regress_tblspace;
226224
CREATETABLEtestschema.part2 PARTITION OFtestschema.part FORVALUESIN (2);
227225
SELECT relname, spcnameFROMpg_catalog.pg_tablespace t,pg_catalog.pg_class c
228-
wherec.reltablespace=t.oidANDc.relnameLIKE'part%_idx';
226+
wherec.reltablespace=t.oidANDc.relnameLIKE'part%_idx'ORDER BY relname;
229227
\dtestschema.part
230228
\d+testschema.part
231229
\dtestschema.part1

‎src/test/regress/sql/test_setup.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ SET synchronous_commit = on;
2323
--
2424
GRANT ALLON SCHEMA public TO public;
2525

26+
-- Create a tablespace we can use in tests.
27+
SET allow_in_place_tablespaces= true;
28+
CREATETABLESPACEregress_tblspace LOCATION'';
29+
2630
--
2731
-- These tables have traditionally been referenced by many tests,
2832
-- so create and populate them. Insert only non-error values here.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp