Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
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
# Default partition validation on CFS partitions under concurrent ATTACH.
#
# Mirrors partition-concurrent-attach.spec: the default partition's
# validation scan runs through CFS decompression, and a concurrent ATTACH
# of a new partition must block or fail correctly.
setup {
  drop table if exists tpart cascade;
  drop table if exists tpart_2;
  create table tpart(i int, j text) partition by range(i);
  create table tpart_1(like tpart) WITH (algorithm = 'lz4');
  create table tpart_2(like tpart) WITH (algorithm = 'lz4');
  create table tpart_default (a int, j text, i int) partition by list (j);
  create table tpart_default_default (a int, i int, b int, j text);
  alter table tpart_default_default drop b;
  alter table tpart_default attach partition tpart_default_default default;
  alter table tpart_default drop a;
  alter table tpart attach partition tpart_default default;
  alter table tpart attach partition tpart_1 for values from(0) to (100);
  insert into tpart_2 values (110,'xxx'), (120, 'yyy'), (150, 'zzz');
}
 
session s1
step s1b    {   begin; }
step s1a    {   alter table tpart attach partition tpart_2 for values from (100) to (200); }
step s1c    {   commit; }
 
session s2
step s2b    {   begin; }
step s2i    {   insert into tpart values (110,'xxx'), (120, 'yyy'), (150, 'zzz'); }
step s2i2   {   insert into tpart_default (i, j) values (110, 'xxx'), (120, 'yyy'), (150, 'zzz'); }
step s2c    {   commit; }
step s2s    {   select tableoid::regclass, * from tpart; }
step s2_check   {   select ok from pg_cfs_check('tpart_1'::regclass, true); }
 
teardown    {   set client_min_messages to 'warning'; drop table if exists tpart cascade; drop table if exists tpart_2; }
 
permutation s1b s1a s2b s2i s1c s2c s2s s2_check
permutation s1b s1a s2b s2i2 s1c s2c s2s s2_check
permutation s1b s2b s2i s1a s2c s1c s2s s2_check