1d540f44创建于 2021年9月23日历史提交
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2a
\! echo "DoCopy_Begin,SLEEP,TIMEOUT=10000000,SKIP_ITERATION=0" >> @abs_srcdir@/concurrent_uheap_multiinsert_2a
set ustore_attr to 'enable_default_ustore_table=on;ustore_unit_test=@abs_srcdir@/concurrent_uheap_multiinsert_2a';
-- case 2a: concurrent multi-insert and insert; second insert is delayed for 0.5 seconds
drop table if exists t1;
NOTICE:  table "t1" does not exist, skipping
create table t1 (c1 int, c2 int) with (storage_type=ustore);
insert into t1 values (3,2);
insert into t1 values (5,6);
select * from t1;
 c1 | c2 
----+----
  3 |  2
  5 |  6
(2 rows)

\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "\copy t1 from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/whitebox_basic.data' delimiter '|';" 2>&1 | append_timestamp "terminal 1" &
\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "select pg_sleep(0.5); insert into t1 values (3,15); select * from t1;" 2>&1 | append_timestamp "terminal 2" &
\! sleep 15
--?.* \[terminal 1\] WARNING:  Suspending at breakpoint DoCopy_Begin timeout=10000000
--?.* \[terminal 2\]  pg_sleep 
--?.* \[terminal 2\] ----------
--?.* \[terminal 2\]  
--?.* \[terminal 2\] \(1 row\)
--?.* \[terminal 2\] 
--?.* \[terminal 2\] INSERT 0 1
--?.* \[terminal 2\]  c1 | c2 
--?.* \[terminal 2\] ----\+----
--?.* \[terminal 2\]   3 |  2
--?.* \[terminal 2\]   5 |  6
--?.* \[terminal 2\]   3 | 15
--?.* \[terminal 2\] \(3 rows\)
--?.* \[terminal 2\] 
select * from t1;
 c1 | c2 
----+----
  3 |  2
  5 |  6
  3 | 15
  1 |  2
  3 |  4
  2 |  3
  5 |  6
  3 |  8
(8 rows)

-- case 2b: concurrent multi-insert and multi-insert; multi-insert is delayed for 0.5 seconds
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2b
\! echo "DoCopy_Begin,SLEEP,TIMEOUT=10000000,SKIP_ITERATION=1" >> @abs_srcdir@/concurrent_uheap_multiinsert_2b
set ustore_attr to 'enable_default_ustore_table=on;ustore_unit_test=@abs_srcdir@/concurrent_uheap_multiinsert_2b';
drop table if exists t1;
create table t1 (c1 int, c2 int) with (storage_type=ustore);
insert into t1 values (3,2);
insert into t1 values (5,6);
\copy t1 from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/whitebox_basic.data' delimiter '|';
select * from t1;
 c1 | c2 
----+----
  3 |  2
  5 |  6
  1 |  2
  3 |  4
  2 |  3
  5 |  6
  3 |  8
(7 rows)

\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "\copy t1 from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/whitebox_basic.data' delimiter '|';" 2>&1 | append_timestamp "terminal 1" &
\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "select pg_sleep(0.5); \copy t1 from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/whitebox_basic.data' delimiter '|'; select * from t1;" 2>&1 | append_timestamp "terminal 2" &
\! sleep 15
--?.* \[terminal 1\] WARNING:  Suspending at breakpoint DoCopy_Begin timeout=10000000
--?.* \[terminal 2\]  pg_sleep 
--?.* \[terminal 2\] ----------
--?.* \[terminal 2\]  
--?.* \[terminal 2\] \(1 row\)
--?.* \[terminal 2\] 
--?.* \[terminal 2\]  c1 | c2 
--?.* \[terminal 2\] ----\+----
--?.* \[terminal 2\]   3 |  2
--?.* \[terminal 2\]   5 |  6
--?.* \[terminal 2\]   1 |  2
--?.* \[terminal 2\]   3 |  4
--?.* \[terminal 2\]   2 |  3
--?.* \[terminal 2\]   5 |  6
--?.* \[terminal 2\]   3 |  8
--?.* \[terminal 2\]   1 |  2
--?.* \[terminal 2\]   3 |  4
--?.* \[terminal 2\]   2 |  3
--?.* \[terminal 2\]   5 |  6
--?.* \[terminal 2\]   3 |  8
--?.* \[terminal 2\] \(12 rows\)
--?.* \[terminal 2\] 
select * from t1;
 c1 | c2 
----+----
  3 |  2
  5 |  6
  1 |  2
  3 |  4
  2 |  3
  5 |  6
  3 |  8
  1 |  2
  3 |  4
  2 |  3
  5 |  6
  3 |  8
  1 |  2
  3 |  4
  2 |  3
  5 |  6
  3 |  8
(17 rows)

-- case 2c: concurrent multi-insert and delete; delete is delayed for 0.5 seconds
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2c
\! echo "DoCopy_Begin,SLEEP,TIMEOUT=10000000,SKIP_ITERATION=0" >> @abs_srcdir@/concurrent_uheap_multiinsert_2c
set ustore_attr to 'enable_default_ustore_table=on;ustore_unit_test=@abs_srcdir@/concurrent_uheap_multiinsert_2c';
drop table if exists t1;
create table t1 (c1 int, c2 int) with (storage_type=ustore);
insert into t1 values (3,2);
insert into t1 values (5,6);
select * from t1;
 c1 | c2 
----+----
  3 |  2
  5 |  6
(2 rows)

\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "\copy t1 from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/whitebox_basic.data' delimiter '|';" 2>&1 | append_timestamp "terminal 1" &
\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "select pg_sleep(0.5); delete from t1 where c1=3; select * from t1;" 2>&1 | append_timestamp "terminal 2" &
\! sleep 15
--?.* \[terminal 1\] WARNING:  Suspending at breakpoint DoCopy_Begin timeout=10000000
--?.* \[terminal 2\]  pg_sleep 
--?.* \[terminal 2\] ----------
--?.* \[terminal 2\]  
--?.* \[terminal 2\] \(1 row\)
--?.* \[terminal 2\] 
--?.* \[terminal 2\] DELETE 1
--?.* \[terminal 2\]  c1 | c2 
--?.* \[terminal 2\] ----\+----
--?.* \[terminal 2\]   5 |  6
--?.* \[terminal 2\] \(1 row\)
--?.* \[terminal 2\] 
select * from t1;
 c1 | c2 
----+----
  5 |  6
  1 |  2
  3 |  4
  2 |  3
  5 |  6
  3 |  8
(6 rows)

-- case 2d: concurrent multi-insert and update; update is delayed for 0.5 seconds
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2d
\! echo "DoCopy_Begin,SLEEP,TIMEOUT=10000000,SKIP_ITERATION=0" >> @abs_srcdir@/concurrent_uheap_multiinsert_2d
set ustore_attr to 'enable_default_ustore_table=on;ustore_unit_test=@abs_srcdir@/concurrent_uheap_multiinsert_2d';
drop table if exists t1;
create table t1 (c1 int, c2 int) with (storage_type=ustore);
insert into t1 values (3,2);
insert into t1 values (5,6);
select * from t1;
 c1 | c2 
----+----
  3 |  2
  5 |  6
(2 rows)

\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "\copy t1 from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/whitebox_basic.data' delimiter '|';" 2>&1 | append_timestamp "terminal 1" &
\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "select pg_sleep(0.5); update t1 set c1=1 where c1=3; select * from t1;" 2>&1 | append_timestamp "terminal 2" &
\! sleep 15
--?.* \[terminal 1\] WARNING:  Suspending at breakpoint DoCopy_Begin timeout=10000000
--?.* \[terminal 2\]  pg_sleep 
--?.* \[terminal 2\] ----------
--?.* \[terminal 2\]  
--?.* \[terminal 2\] \(1 row\)
--?.* \[terminal 2\] 
--?.* \[terminal 2\] UPDATE 1
--?.* \[terminal 2\]  c1 | c2 
--?.* \[terminal 2\] ----\+----
--?.* \[terminal 2\]   1 |  2
--?.* \[terminal 2\]   5 |  6
--?.* \[terminal 2\] \(2 rows\)
--?.* \[terminal 2\] 
select * from t1;
 c1 | c2 
----+----
  1 |  2
  5 |  6
  1 |  2
  3 |  4
  2 |  3
  5 |  6
  3 |  8
(7 rows)

-- case 2e: concurrent multi-insert and lock; lock is delayed for 0.5 seconds
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2e
\! echo "DoCopy_Begin,SLEEP,TIMEOUT=10000000,SKIP_ITERATION=0" >> @abs_srcdir@/concurrent_uheap_multiinsert_2e
set ustore_attr to 'enable_default_ustore_table=on;ustore_unit_test=@abs_srcdir@/concurrent_uheap_multiinsert_2e';
drop table if exists t1;
CREATE TABLE t1 (c1 INT , c2 INT DEFAULT 1 PRIMARY KEY, c3 INT DEFAULT 100) with(storage_type=ustore);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
insert into t1 values (15,10);
insert into t1 values (default);
select * from t1;
 c1 | c2 | c3  
----+----+-----
 15 | 10 | 100
    |  1 | 100
(2 rows)

\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "\copy t1 from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/whitebox_multiInsert_lock.data' delimiter '|';" 2>&1 | append_timestamp "terminal 1" &
\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "select pg_sleep(0.5); INSERT INTO t1 VALUES(DEFAULT) ON DUPLICATE KEY UPDATE c3 = 1000; select * from t1;" 2>&1 | append_timestamp "terminal 2" &
\! sleep 15
--?.* \[terminal 1\] WARNING:  Suspending at breakpoint DoCopy_Begin timeout=10000000
--?.* \[terminal 2\]  pg_sleep 
--?.* \[terminal 2\] ----------
--?.* \[terminal 2\]  
--?.* \[terminal 2\] \(1 row\)
--?.* \[terminal 2\] 
--?.* \[terminal 2\] WARNING:  UHeapUpdate returned 5
--?.* \[terminal 2\] INSERT 0 1
--?.* \[terminal 2\]  c1 | c2 |  c3  
--?.* \[terminal 2\] ----\+----\+------
--?.* \[terminal 2\]  15 | 10 |  100
--?.* \[terminal 2\]     |  1 | 1000
--?.* \[terminal 2\] \(2 rows\)
--?.* \[terminal 2\] 
select * from t1;
 c1 | c2 |  c3  
----+----+------
 15 | 10 |  100
    |  1 | 1000
 10 | 20 |  100
 30 | 40 |  100
 20 | 30 |  100
 50 | 60 |  100
 30 | 80 |  100
(7 rows)

-- case 2f: concurrent multi-insert and fetch; fetch is delayed for 0.5 seconds
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2f
\! echo "DoCopy_Begin,SLEEP,TIMEOUT=10000000,SKIP_ITERATION=0" >> @abs_srcdir@/concurrent_uheap_multiinsert_2f
set ustore_attr to 'enable_default_ustore_table=on;ustore_unit_test=@abs_srcdir@/concurrent_uheap_multiinsert_2f';
drop table if exists t1;
create table t1 (c1 int, c2 int) with (storage_type=ustore);
insert into t1 values (3,2);
insert into t1 values (5,6);
select * from t1;
 c1 | c2 
----+----
  3 |  2
  5 |  6
(2 rows)

\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "\copy t1 from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/whitebox_basic.data' delimiter '|';" 2>&1 | append_timestamp "terminal 1" &
\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "select pg_sleep(0.5); select * from t1;" 2>&1 | append_timestamp "terminal 2" &
\! sleep 15
--?.* \[terminal 1\] WARNING:  Suspending at breakpoint DoCopy_Begin timeout=10000000
--?.* \[terminal 2\]  pg_sleep 
--?.* \[terminal 2\] ----------
--?.* \[terminal 2\]  
--?.* \[terminal 2\] \(1 row\)
--?.* \[terminal 2\] 
--?.* \[terminal 2\]  c1 | c2 
--?.* \[terminal 2\] ----\+----
--?.* \[terminal 2\]   3 |  2
--?.* \[terminal 2\]   5 |  6
--?.* \[terminal 2\] \(2 rows\)
--?.* \[terminal 2\] 
select * from t1;
 c1 | c2 
----+----
  3 |  2
  5 |  6
  1 |  2
  3 |  4
  2 |  3
  5 |  6
  3 |  8
(7 rows)

-- case 2g: concurrent multi-insert and page prune; page prune is delayed for 0.5 seconds
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2g
\! echo "DoCopy_Begin,SLEEP,TIMEOUT=10000000,SKIP_ITERATION=0" >> @abs_srcdir@/concurrent_uheap_multiinsert_2g
set ustore_attr to 'enable_default_ustore_table=on;ustore_unit_test=@abs_srcdir@/concurrent_uheap_multiinsert_2g';
drop table if exists t1;
create table t1(c1 integer, c2 varchar) with (storage_type=USTORE);
insert into t1 values (60,'fbc');
insert into t1 values (70,'gbc');
select * from t1;
 c1 | c2  
----+-----
 60 | fbc
 70 | gbc
(2 rows)

\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "\copy t1 from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/whitebox_pagePrune.data' delimiter '|';" 2>&1 | append_timestamp "terminal 1" &
\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "select pg_sleep(0.5); update t1 set c2 = 'abcabcabc' where c1 >= 60; select * from t1;" 2>&1 | append_timestamp "terminal 2" &
\! sleep 15
--?.* \[terminal 1\] WARNING:  Suspending at breakpoint DoCopy_Begin timeout=10000000
--?.* \[terminal 2\]  pg_sleep 
--?.* \[terminal 2\] ----------
--?.* \[terminal 2\]  
--?.* \[terminal 2\] \(1 row\)
--?.* \[terminal 2\] 
--?.* \[terminal 2\] UPDATE 2
--?.* \[terminal 2\]  c1 |    c2     
--?.* \[terminal 2\] ----\+-----------
--?.* \[terminal 2\]  60 | abcabcabc
--?.* \[terminal 2\]  70 | abcabcabc
--?.* \[terminal 2\] \(2 rows\)
--?.* \[terminal 2\] 
select * from t1;
 c1  |    c2     
-----+-----------
  60 | abcabcabc
  70 | abcabcabc
 100 | 'asdf'
 150 | 'qwert'
 200 | 'zxcv'
(5 rows)

-- case 2h: concurrent multi-insert and toast delete; toast delete is delayed for 0.5 seconds
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2h
\! echo "DoCopy_Begin,SLEEP,TIMEOUT=10000000,SKIP_ITERATION=0" >> @abs_srcdir@/concurrent_uheap_multiinsert_2h
set ustore_attr to 'enable_default_ustore_table=on;ustore_unit_test=@abs_srcdir@/concurrent_uheap_multiinsert_2h';
drop table if exists t1;
create table t1 (c1 int default 1, c2 int default 1 primary key, c3 text default repeat('xyzxyz',10000), c4 text default repeat('hello',10000)) with (storage_type=ustore);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
insert into t1 values (1,1,repeat('xyzxyz',100000),repeat('hello',10000));
insert into t1 values (1,5,repeat('abcabc',100000),repeat('hello',10000));
insert into t1 values (1,6,'hello','hi');
insert into t1 values (3,9,'abc','xyz');
select c1, c2 from t1;
 c1 | c2 
----+----
  1 |  1
  1 |  5
  1 |  6
  3 |  9
(4 rows)

\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "\copy t1 from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/whitebox_toastDelete.data' delimiter '|';" 2>&1 | append_timestamp "terminal 1" &
\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "select pg_sleep(0.5); delete from t1 where c1=1; select c1, c2 from t1;" 2>&1 | append_timestamp "terminal 2" &
\! sleep 15
--?.* \[terminal 1\] WARNING:  Suspending at breakpoint DoCopy_Begin timeout=10000000
--?.* \[terminal 2\]  pg_sleep 
--?.* \[terminal 2\] ----------
--?.* \[terminal 2\]  
--?.* \[terminal 2\] \(1 row\)
--?.* \[terminal 2\] 
--?.* \[terminal 2\] DELETE 3
--?.* \[terminal 2\]  c1 | c2 
--?.* \[terminal 2\] ----\+----
--?.* \[terminal 2\]   3 |  9
--?.* \[terminal 2\] \(1 row\)
--?.* \[terminal 2\] 
select c1, c2 from t1;
 c1 | c2 
----+----
  3 |  9
  1 | 15
  6 | 12
 15 |  4
(4 rows)

-- case 2i: concurrent multi-insert and toast insert; toast insert is delayed for 0.5 seconds
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2i
\! echo "DoCopy_Begin,SLEEP,TIMEOUT=10000000,SKIP_ITERATION=0" >> @abs_srcdir@/concurrent_uheap_multiinsert_2i
set ustore_attr to 'enable_default_ustore_table=on;ustore_unit_test=@abs_srcdir@/concurrent_uheap_multiinsert_2i';
drop table if exists t1;
create table t1 (c1 int, c2 int, c3 text) with (storage_type=ustore);
insert into t1 values (1,2,'abc');
select * from t1;
 c1 | c2 | c3  
----+----+-----
  1 |  2 | abc
(1 row)

\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "\copy t1 from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/whitebox_toastInsert.data' delimiter '|';" 2>&1 | append_timestamp "terminal 1" &
\! source @abs_srcdir@/gsql_with_timestamp.sh && @abs_bindir@/gsql -r -p @portstring@ -d regression -c "select pg_sleep(0.5); insert into t1 values (10,15,repeat('e',10000)); select c1, c2 from t1;" 2>&1 | append_timestamp "terminal 2" &
\! sleep 15
--?.* \[terminal 1\] WARNING:  Suspending at breakpoint DoCopy_Begin timeout=10000000
--?.* \[terminal 2\]  pg_sleep 
--?.* \[terminal 2\] ----------
--?.* \[terminal 2\]  
--?.* \[terminal 2\] \(1 row\)
--?.* \[terminal 2\] 
--?.* \[terminal 2\] INSERT 0 1
--?.* \[terminal 2\]  c1 | c2 
--?.* \[terminal 2\] ----\+----
--?.* \[terminal 2\]   1 |  2
--?.* \[terminal 2\]  10 | 15
--?.* \[terminal 2\] \(2 rows\)
--?.* \[terminal 2\] 
select c1, c2 from t1;
 c1 | c2 
----+----
  1 |  2
 10 | 15
  1 |  2
  3 |  4
  2 |  3
  5 |  6
  8 |  8
(7 rows)

-- drop all tables
drop table t1;
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2a
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2b
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2c
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2d
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2e
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2f
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2g
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2h
\! rm -f @abs_srcdir@/concurrent_uheap_multiinsert_2i