Skip to content

Commit e1f2e4e

Browse files
committed
Fix some answer files
1 parent 3faa3cf commit e1f2e4e

3 files changed

Lines changed: 46 additions & 10 deletions

File tree

src/test/regress/expected/alter_db_set_tablespace.out

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ CREATE SCHEMA adst;
1313
SET search_path TO adst,public;
1414
-- start_ignore
1515
CREATE LANGUAGE plpython3u;
16+
ERROR: extension "plpython3u" already exists
1617
-- end_ignore
1718
CREATE OR REPLACE FUNCTION setup_tablespace_location_dir_for_test(tablespace_location_dir text) RETURNS VOID AS $$
1819
import os;
1920
import shutil;
20-
import traceback
21+
import traceback;
22+
from pathlib import Path
2123
try:
2224
shutil.rmtree(tablespace_location_dir)
2325
except OSError:
2426
plpy.debug(traceback.format_exc())
2527
plpy.debug('failed to remove tablespace location directory: %s' % (tablespace_location_dir))
26-
os.mkdir(tablespace_location_dir)
28+
Path(tablespace_location_dir).mkdir(parents=True, exist_ok=True)
2729
$$ LANGUAGE plpython3u;
2830
\getenv abs_builddir PG_ABS_BUILDDIR
2931
\set adst_source_tablespace_location :abs_builddir '/testtablespace/adst_source'
@@ -1346,7 +1348,7 @@ DROP TABLESPACE adst_destination_tablespace;
13461348
DROP SCHEMA adst CASCADE;
13471349
DETAIL: drop cascades to function setup_tablespace_location_dir_for_test(text)
13481350
NOTICE: drop cascades to 4 other objects
1349-
drop cascades to function setup()
1351+
drop cascades to function setup(text,text)
13501352
drop cascades to function list_db_tablespace(text,text)
13511353
drop cascades to function stat_db_objects(text,text)
13521354
SELECT gp_inject_fault('all', 'reset', dbid) FROM gp_segment_configuration;

src/test/regress/expected/gp_tablespace.out

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ SELECT pg_ls_dir('./pg_tblspc/' || oid) = get_tablespace_version_directory_name(
7474
FROM pg_tablespace WHERE spcname = 'testspace';
7575
has_version_dir
7676
-----------------
77-
f
77+
t
7878
(1 row)
7979

8080
-- Ensure mirrors have applied filesystem changes
@@ -84,6 +84,15 @@ SELECT force_mirrors_to_catch_up();
8484

8585
(1 row)
8686

87+
\! ls $PG_ABS_SRCDIR/testtablespace
88+
1
89+
2
90+
3
91+
4
92+
5
93+
6
94+
7
95+
8
8796
-- Test moving AO/AOCO tables from one tablespace to another.
8897
CREATE TABLE ao_ts_table (id int4, t text) with (appendonly=true, orientation=row) distributed by (id);
8998
CREATE TABLE aoco_ts_table (id int4, t text) with (appendonly=true, orientation=column) distributed by (id);
@@ -382,9 +391,8 @@ SELECT * FROM
382391
WHERE a.versiondirs != get_tablespace_version_directory_name();
383392
versiondirs
384393
-------------------
385-
GPDB_2_302512051
386394
GPDB_99_399999991
387-
(2 rows)
395+
(1 row)
388396

389397
SELECT count(*) FROM
390398
(SELECT pg_ls_dir('pg_tblspc/' || oid) AS versiondirs
@@ -394,7 +402,7 @@ SELECT count(*) FROM
394402
WHERE a.versiondirs = get_tablespace_version_directory_name();
395403
count
396404
-------
397-
0
405+
1
398406
(1 row)
399407

400408
-- Do not drop the dbid directory, nor the existing version directory if you
@@ -407,7 +415,31 @@ SELECT force_mirrors_to_catch_up();
407415

408416
(1 row)
409417

410-
-- Test alter tablespace: PG does not seem to test these.
418+
\! ls $PG_ABS_SRCDIR/testtablespace_existing_version_dir/*
419+
/home/gpadmin/cloudberry/src/test/regress/testtablespace_existing_version_dir/1:
420+
GPDB_99_399999991
421+
422+
/home/gpadmin/cloudberry/src/test/regress/testtablespace_existing_version_dir/2:
423+
GPDB_99_399999991
424+
425+
/home/gpadmin/cloudberry/src/test/regress/testtablespace_existing_version_dir/3:
426+
GPDB_99_399999991
427+
428+
/home/gpadmin/cloudberry/src/test/regress/testtablespace_existing_version_dir/4:
429+
GPDB_99_399999991
430+
431+
/home/gpadmin/cloudberry/src/test/regress/testtablespace_existing_version_dir/5:
432+
GPDB_99_399999991
433+
434+
/home/gpadmin/cloudberry/src/test/regress/testtablespace_existing_version_dir/6:
435+
GPDB_99_399999991
436+
437+
/home/gpadmin/cloudberry/src/test/regress/testtablespace_existing_version_dir/7:
438+
GPDB_99_399999991
439+
440+
/home/gpadmin/cloudberry/src/test/regress/testtablespace_existing_version_dir/8:
441+
GPDB_99_399999991
442+
-- Test alter tablespace: PG does not seem to test these.
411443
-- test SET & OWNER
412444
ALTER TABLESPACE testspace_otherloc SET (random_page_cost=20.0);
413445
SELECT spcoptions FROM pg_tablespace WHERE spcname = 'testspace_otherloc';
@@ -457,5 +489,6 @@ DROP TABLE tblspc_otherloc_heap;
457489
DROP TABLESPACE testspace_otherloc;
458490
CREATE TABLESPACE testspace_dir_empty LOCATION :'testtablespace';
459491
CREATE TABLE t_dir_empty(a int);
492+
\! rm -rf $PG_ABS_SRCDIR/testtablespace
460493
DROP TABLE IF EXISTS t_dir_empty;
461494
DROP TABLESPACE testspace_dir_empty;

src/test/regress/sql/alter_db_set_tablespace.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ CREATE LANGUAGE plpython3u;
2222
CREATE OR REPLACE FUNCTION setup_tablespace_location_dir_for_test(tablespace_location_dir text) RETURNS VOID AS $$
2323
import os;
2424
import shutil;
25-
import traceback
25+
import traceback;
26+
from pathlib import Path
2627
try:
2728
shutil.rmtree(tablespace_location_dir)
2829
except OSError:
2930
plpy.debug(traceback.format_exc())
3031
plpy.debug('failed to remove tablespace location directory: %s' % (tablespace_location_dir))
31-
os.mkdir(tablespace_location_dir)
32+
Path(tablespace_location_dir).mkdir(parents=True, exist_ok=True)
3233
$$ LANGUAGE plpython3u;
3334

3435
\getenv abs_builddir PG_ABS_BUILDDIR

0 commit comments

Comments
 (0)