Adds tablespace to test tablespace statement

create_drop_db_gh
gindibay 2023-10-06 15:45:05 +03:00
parent 4dff8f3c67
commit 791fe0db48
3 changed files with 47 additions and 9 deletions

View File

@ -1,3 +1,11 @@
\set create_drop_db_tablespace :abs_srcdir '/tmp_check/ts3'
CREATE TABLESPACE create_drop_db_tablespace LOCATION :'create_drop_db_tablespace';
\c - - - :worker_1_port
\set create_drop_db_tablespace :abs_srcdir '/tmp_check/ts4'
CREATE TABLESPACE create_drop_db_tablespace LOCATION :'create_drop_db_tablespace';
\c - - - :worker_2_port
\set create_drop_db_tablespace :abs_srcdir '/tmp_check/ts5'
CREATE TABLESPACE create_drop_db_tablespace LOCATION :'create_drop_db_tablespace';
\c - - - :master_port \c - - - :master_port
create user create_drop_db_test_user; create user create_drop_db_test_user;
set citus.enable_create_database_propagation=on; set citus.enable_create_database_propagation=on;
@ -8,6 +16,7 @@ CREATE DATABASE mydatabase
ENCODING = 'UTF8' ENCODING = 'UTF8'
LC_COLLATE = 'C' LC_COLLATE = 'C'
LC_CTYPE = 'C' LC_CTYPE = 'C'
TABLESPACE = create_drop_db_tablespace
ALLOW_CONNECTIONS = true ALLOW_CONNECTIONS = true
IS_TEMPLATE = false; IS_TEMPLATE = false;
SELECT pd.datname, pd.encoding, SELECT pd.datname, pd.encoding,
@ -18,9 +27,9 @@ FROM pg_database pd
JOIN pg_authid pa ON pd.datdba = pa.oid JOIN pg_authid pa ON pd.datdba = pa.oid
join pg_tablespace pt on pd.dattablespace = pt.oid join pg_tablespace pt on pd.dattablespace = pt.oid
WHERE datname = 'mydatabase'; WHERE datname = 'mydatabase';
datname | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace datname | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace
--------------------------------------------------------------------- ---------------------------------------------------------------------
mydatabase | 6 | f | t | 10 | C | C | | create_drop_db_test_user | create_drop_db_test_user | pg_default mydatabase | 6 | f | t | 10 | C | C | | create_drop_db_test_user | create_drop_db_test_user | create_drop_db_tablespace
(1 row) (1 row)
\c - - - :worker_1_port \c - - - :worker_1_port
@ -32,9 +41,9 @@ FROM pg_database pd
JOIN pg_authid pa ON pd.datdba = pa.oid JOIN pg_authid pa ON pd.datdba = pa.oid
join pg_tablespace pt on pd.dattablespace = pt.oid join pg_tablespace pt on pd.dattablespace = pt.oid
WHERE datname = 'mydatabase'; WHERE datname = 'mydatabase';
datname | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace datname | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace
--------------------------------------------------------------------- ---------------------------------------------------------------------
mydatabase | 6 | f | t | 10 | C | C | | create_drop_db_test_user | create_drop_db_test_user | pg_default mydatabase | 6 | f | t | 10 | C | C | | create_drop_db_test_user | create_drop_db_test_user | create_drop_db_tablespace
(1 row) (1 row)
\c - - - :worker_2_port \c - - - :worker_2_port
@ -46,9 +55,9 @@ FROM pg_database pd
JOIN pg_authid pa ON pd.datdba = pa.oid JOIN pg_authid pa ON pd.datdba = pa.oid
join pg_tablespace pt on pd.dattablespace = pt.oid join pg_tablespace pt on pd.dattablespace = pt.oid
WHERE datname = 'mydatabase'; WHERE datname = 'mydatabase';
datname | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace datname | encoding | datistemplate | datallowconn | datconnlimit | datcollate | datctype | datacl | database_owner | database_owner | tablespace
--------------------------------------------------------------------- ---------------------------------------------------------------------
mydatabase | 6 | f | t | 10 | C | C | | create_drop_db_test_user | create_drop_db_test_user | pg_default mydatabase | 6 | f | t | 10 | C | C | | create_drop_db_test_user | create_drop_db_test_user | create_drop_db_tablespace
(1 row) (1 row)
\c - - - :master_port \c - - - :master_port
@ -92,5 +101,11 @@ WHERE datname = 'mydatabase';
--------------------------------------------------------------------- ---------------------------------------------------------------------
(0 rows) (0 rows)
\c - - - :master_port
drop tablespace create_drop_db_tablespace;
\c - - - :worker_1_port
drop tablespace create_drop_db_tablespace;
\c - - - :worker_2_port
drop tablespace create_drop_db_tablespace;
\c - - - :master_port \c - - - :master_port
drop user create_drop_db_test_user; drop user create_drop_db_test_user;

View File

@ -630,7 +630,7 @@ for my $port (@followerWorkerPorts)
} }
} }
for my $tablespace ("ts0", "ts1", "ts2") for my $tablespace ("ts0", "ts1", "ts2", "ts3", "ts4", "ts5")
{ {
if (-e catfile($TMP_CHECKDIR, $tablespace)) if (-e catfile($TMP_CHECKDIR, $tablespace))
{ {

View File

@ -1,3 +1,16 @@
\set create_drop_db_tablespace :abs_srcdir '/tmp_check/ts3'
CREATE TABLESPACE create_drop_db_tablespace LOCATION :'create_drop_db_tablespace';
\c - - - :worker_1_port
\set create_drop_db_tablespace :abs_srcdir '/tmp_check/ts4'
CREATE TABLESPACE create_drop_db_tablespace LOCATION :'create_drop_db_tablespace';
\c - - - :worker_2_port
\set create_drop_db_tablespace :abs_srcdir '/tmp_check/ts5'
CREATE TABLESPACE create_drop_db_tablespace LOCATION :'create_drop_db_tablespace';
\c - - - :master_port \c - - - :master_port
create user create_drop_db_test_user; create user create_drop_db_test_user;
@ -10,6 +23,7 @@ CREATE DATABASE mydatabase
ENCODING = 'UTF8' ENCODING = 'UTF8'
LC_COLLATE = 'C' LC_COLLATE = 'C'
LC_CTYPE = 'C' LC_CTYPE = 'C'
TABLESPACE = create_drop_db_tablespace
ALLOW_CONNECTIONS = true ALLOW_CONNECTIONS = true
IS_TEMPLATE = false; IS_TEMPLATE = false;
@ -78,9 +92,18 @@ JOIN pg_authid pa ON pd.datdba = pa.oid
join pg_tablespace pt on pd.dattablespace = pt.oid join pg_tablespace pt on pd.dattablespace = pt.oid
WHERE datname = 'mydatabase'; WHERE datname = 'mydatabase';
\c - - - :master_port
drop tablespace create_drop_db_tablespace;
\c - - - :worker_1_port
drop tablespace create_drop_db_tablespace;
\c - - - :worker_2_port
drop tablespace create_drop_db_tablespace;
\c - - - :master_port \c - - - :master_port
drop user create_drop_db_test_user; drop user create_drop_db_test_user;