blob: 06e9c9427948a999595b6547620d53f98c8bf5bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
--
-- XC_NOTRANS_BLOCK
--
-- This file contains tests for testing statements that cannot be run
-- within a transaction block. They verify that the cluster is consistent
-- even if one particular node aborts and others succeed.
------------
-- Test#1 : CREATE TABLESPACE
------------
BEGIN;
CREATE TABLESPACE xc_testspace1 LOCATION '@testtablespace@';
ROLLBACK;
select exec_util_on_node('CREATE TABLESPACE xc_testspace1 LOCATION $LOC$@testtablespace@$LOC$', 1);
-- This should fail because we have one tablespace created on data node 1.
CREATE TABLESPACE xc_testspace1 LOCATION '@testtablespace@';
-- Drop tablespace on data node 1.
select exec_util_on_node('drop TABLESPACE xc_testspace1 ', 1);
-- Now this should work
CREATE TABLESPACE xc_testspace1 LOCATION '@testtablespace@';
------------
-- Test#2 CREATE DATABASE
------------
BEGIN;
CREATE DATABASE xc_db tablespace xc_testspace1;
ROLLBACK;
-- Drop tablespace on data node 1.
select exec_util_on_node('drop TABLESPACE xc_testspace1 ', 1);
-- This should not work because there is no tablespace on datanode1
CREATE DATABASE xc_db tablespace xc_testspace1;
select exec_util_on_node('CREATE TABLESPACE xc_testspace1 LOCATION $LOC$@testtablespace@$LOC$', 1);
-- This should work
CREATE DATABASE xc_db tablespace xc_testspace1;
------------
-- Test#3: ALTER DATABASE SET TABLESPACE
------------
BEGIN;
alter database xc_db set tablespace xc_testspace1;
ROLLBACK;
-- Recreate database on global tablespace.
clean connection to all for database xc_db;
drop database xc_db;
CREATE DATABASE xc_db;
-- Insert some objects.
\c xc_db
create table xc_tab1 (id int);
insert into xc_tab1 select generate_series(1, 50, 1);
\c regression
clean connection to all for database xc_db;
-- Drop tablespace on data node 1.
select exec_util_on_node('drop TABLESPACE xc_testspace1 ', 1);
clean connection to all for database xc_db;
-- This should error out, since we don't have tablespace on data node 1
alter database xc_db set tablespace xc_testspace1;
select exec_util_on_node('CREATE TABLESPACE xc_testspace1 LOCATION $LOC$@testtablespace@$LOC$', 1);
-- Now this should work.
alter database xc_db set tablespace xc_testspace1;
-- Verify data in the objects created earlier
\c xc_db
select * from xc_tab1 order by id;
\c regression
clean connection to all for database xc_db;
drop database xc_db;
drop tablespace xc_testspace1;
|