!2964 发布订阅自测用例增加database兼容性参数
Merge pull request !2964 from chenxiaobin/addCompatibility
This commit is contained in:
@ -1569,6 +1569,8 @@ void PostgresInitializer::InitApplyWorker()
|
||||
|
||||
InitSettings();
|
||||
|
||||
InitExtensionVariable();
|
||||
|
||||
FinishInit();
|
||||
|
||||
return;
|
||||
|
||||
@ -1 +1 @@
|
||||
add_custom_target(check COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/run_check.sh ${CMAKE_CURRENT_SOURCE_DIR} \$\(p\))
|
||||
add_custom_target(check COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/run_check.sh ${CMAKE_CURRENT_SOURCE_DIR} \$\(p\) \$\(dbcompatibility\))
|
||||
@ -17,6 +17,7 @@ include $(top_builddir)/src/Makefile.global
|
||||
# where to find psql for testing an existing installation
|
||||
PSQLDIR = $(bindir)
|
||||
p=25800
|
||||
dbcompatibility=A
|
||||
##
|
||||
## Run tests
|
||||
##
|
||||
@ -25,7 +26,7 @@ REGRESS_OPTS = --dlpath=. $(EXTRA_REGRESS_OPTS)
|
||||
REG_CONF = --regconf=regress.conf
|
||||
|
||||
check: all
|
||||
sh $(CURDIR)/run_check.sh $(CURDIR) $p
|
||||
sh $(CURDIR)/run_check.sh $(CURDIR) $p $(dbcompatibility)
|
||||
|
||||
##
|
||||
## Clean up
|
||||
|
||||
@ -8,6 +8,7 @@ export GAUSSHOME="$prefix"
|
||||
export LD_LIBRARY_PATH=$prefix/lib:$prefix/lib/libobs:$LD_LIBRARY_PATH
|
||||
export PATH="$prefix/bin":$PATH
|
||||
export g_local_ip="127.0.0.1"
|
||||
export dbcompatibility=$3
|
||||
|
||||
db=postgres
|
||||
scripts_dir="$1"
|
||||
|
||||
@ -11,12 +11,13 @@ install_path = os.environ.get("install_path")
|
||||
g_local_ip = os.environ.get("g_local_ip")
|
||||
g_username = os.environ.get("g_username")
|
||||
g_passwd = "Gauss@123"
|
||||
pub_node1_port = int(os.environ.get("pub_node1_port"));
|
||||
pub_node2_port = int(os.environ.get("pub_node2_port"));
|
||||
pub_node3_port = int(os.environ.get("pub_node3_port"));
|
||||
sub_node1_port = int(os.environ.get("sub_node1_port"));
|
||||
sub_node2_port = int(os.environ.get("sub_node2_port"));
|
||||
sub_node3_port = int(os.environ.get("sub_node3_port"));
|
||||
dbcompatibility = os.environ.get("dbcompatibility")
|
||||
pub_node1_port = int(os.environ.get("pub_node1_port"))
|
||||
pub_node2_port = int(os.environ.get("pub_node2_port"))
|
||||
pub_node3_port = int(os.environ.get("pub_node3_port"))
|
||||
sub_node1_port = int(os.environ.get("sub_node1_port"))
|
||||
sub_node2_port = int(os.environ.get("sub_node2_port"))
|
||||
sub_node3_port = int(os.environ.get("sub_node3_port"))
|
||||
|
||||
|
||||
class Pterodb():
|
||||
@ -30,7 +31,7 @@ class Pterodb():
|
||||
self.heartbeat_port_arr = [port_arr[i] + 2 for i in range(data_node_num)]
|
||||
|
||||
def real_init_env(self, i):
|
||||
datanode_cmd_init = install_path + "/bin/gs_initdb -D " + self.data_dir + "/" + self.dname_prefix + str(i) + " --nodename=" + self.dname_prefix + str(i) + " -w " + g_passwd
|
||||
datanode_cmd_init = install_path + "/bin/gs_initdb -D " + self.data_dir + "/" + self.dname_prefix + str(i) + " --nodename=" + self.dname_prefix + str(i) + " -w " + g_passwd + " --dbcompatibility=" + dbcompatibility
|
||||
print datanode_cmd_init
|
||||
os.system(datanode_cmd_init)
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
count=0
|
||||
source $1/env_utils.sh $1 $2
|
||||
source $1/env_utils.sh $1 $2 $3
|
||||
|
||||
#clean temporary files generated after last check
|
||||
echo "removing $g_data_path"
|
||||
|
||||
@ -13,13 +13,13 @@ function test_1() {
|
||||
# Create tables on both sides of the replication
|
||||
ddl="CREATE TABLE public.test_numerical (
|
||||
a INTEGER PRIMARY KEY,
|
||||
b NUMERIC,
|
||||
b NUMERIC(10,2),
|
||||
c FLOAT,
|
||||
d BIGINT
|
||||
);
|
||||
CREATE TABLE public.test_arrays (
|
||||
a INTEGER[] PRIMARY KEY,
|
||||
b NUMERIC[],
|
||||
b NUMERIC(10,2)[],
|
||||
c TEXT[]
|
||||
)"
|
||||
|
||||
@ -48,9 +48,9 @@ function test_1() {
|
||||
|
||||
wait_for_catchup $case_db $pub_node1_port "tsub"
|
||||
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, b, c, d FROM test_numerical ORDER BY a")" = "1|1.2|1.3|10
|
||||
2|2.2|2.3|20
|
||||
3|3.2|3.3|30" ]; then
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, b, c, d FROM test_numerical ORDER BY a")" = "1|1.20|1.3|10
|
||||
2|2.20|2.3|20
|
||||
3|3.20|3.3|30" ]; then
|
||||
echo "check replicated data on subscriber success"
|
||||
else
|
||||
echo "$failed_keyword when check replicated data on subscriber"
|
||||
@ -63,17 +63,17 @@ function test_1() {
|
||||
|
||||
wait_for_catchup $case_db $pub_node1_port "tsub"
|
||||
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, b, c FROM test_arrays ORDER BY a")" = "{1,2,3}|{42,1.2,1.3}|
|
||||
{3,1,2}|{42,1.1,1.2}|" ]; then
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, b, c FROM test_arrays ORDER BY a")" = "{1,2,3}|{42.00,1.20,1.30}|
|
||||
{3,1,2}|{42.00,1.10,1.20}|" ]; then
|
||||
echo "check updated replicated data on subscriber success"
|
||||
else
|
||||
echo "$failed_keyword when check updated replicated data on subscriber"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, b, c, d FROM test_numerical ORDER BY a")" = "1|42||10
|
||||
2|42||20
|
||||
3|42||30" ]; then
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, b, c, d FROM test_numerical ORDER BY a")" = "1|42.00||10
|
||||
2|42.00||20
|
||||
3|42.00||30" ]; then
|
||||
echo "check updated replicated data on subscriber success"
|
||||
else
|
||||
echo "$failed_keyword when check updated replicated data on subscriber"
|
||||
@ -87,10 +87,10 @@ function test_1() {
|
||||
|
||||
wait_for_catchup $case_db $pub_node1_port "tsub"
|
||||
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, b, c, d FROM test_numerical ORDER BY a")" = "1|42||10
|
||||
2|42||20
|
||||
3|42||30
|
||||
4|4.2|4.3|40" ]; then
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, b, c, d FROM test_numerical ORDER BY a")" = "1|42.00||10
|
||||
2|42.00||20
|
||||
3|42.00||30
|
||||
4|4.20|4.3|40" ]; then
|
||||
echo "check replicated data on subscriber success"
|
||||
else
|
||||
echo "$failed_keyword when check replicated data on subscriber"
|
||||
@ -104,9 +104,9 @@ function test_1() {
|
||||
|
||||
wait_for_catchup $case_db $pub_node1_port "tsub"
|
||||
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, b, c FROM test_arrays ORDER BY a")" = "{1,2,3}|{42,1.2,1.3}|
|
||||
{2,3,1}|{1.2,1.3,1.1}|{two,three,one}
|
||||
{3,1,2}|{42,1.1,1.2}|" ]; then
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, b, c FROM test_arrays ORDER BY a")" = "{1,2,3}|{42.00,1.20,1.30}|
|
||||
{2,3,1}|{1.20,1.30,1.10}|{two,three,one}
|
||||
{3,1,2}|{42.00,1.10,1.20}|" ]; then
|
||||
echo "check replicated data on subscriber success"
|
||||
else
|
||||
echo "$failed_keyword when check replicated data on subscriber"
|
||||
|
||||
@ -15,7 +15,7 @@ function test_1() {
|
||||
exec_sql $case_db $pub_node1_port "CREATE TABLE tab_full2 (x text)"
|
||||
exec_sql $case_db $pub_node1_port "INSERT INTO tab_full2 VALUES ('a'), ('b'), ('b')"
|
||||
exec_sql $case_db $pub_node1_port "CREATE TABLE tab_rep (a int primary key)"
|
||||
exec_sql $case_db $pub_node1_port "CREATE TABLE tab_mixed (a int primary key, b text, c numeric)"
|
||||
exec_sql $case_db $pub_node1_port "CREATE TABLE tab_mixed (a int primary key, b text, c numeric(10,2))"
|
||||
exec_sql $case_db $pub_node1_port "INSERT INTO tab_mixed (a, b, c) VALUES (1, 'foo', 1.1)"
|
||||
exec_sql $case_db $pub_node1_port "CREATE TABLE tab_include (a int, b text) WITH (storage_type = ustore)"
|
||||
exec_sql $case_db $pub_node1_port "CREATE INDEX covering ON tab_include USING ubtree (a) INCLUDE(b)"
|
||||
@ -40,7 +40,7 @@ function test_1() {
|
||||
exec_sql $case_db $sub_node1_port "CREATE TABLE tab_nothing (a int)"
|
||||
|
||||
# different column count and order than on publisher
|
||||
exec_sql $case_db $sub_node1_port "CREATE TABLE tab_mixed (d text default 'local', c numeric, b text, a int primary key)"
|
||||
exec_sql $case_db $sub_node1_port "CREATE TABLE tab_mixed (d text default 'local', c numeric(10,2), b text, a int primary key)"
|
||||
|
||||
# replication of the table with included index
|
||||
exec_sql $case_db $sub_node1_port "CREATE TABLE tab_include (a int, b text) WITH (storage_type = ustore)"
|
||||
@ -106,8 +106,8 @@ function test_1() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT * FROM tab_mixed")" = "local|1.1|foo|1
|
||||
local|2.2|bar|2" ]; then
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT * FROM tab_mixed")" = "local|1.10|foo|1
|
||||
local|2.20|bar|2" ]; then
|
||||
echo "check replicated changes with different column order success"
|
||||
else
|
||||
echo "$failed_keyword when check replicated changes with different column order"
|
||||
@ -261,8 +261,8 @@ bb" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT * FROM tab_mixed ORDER BY a")" = "local|1.1|baz|1
|
||||
local|2.2|bar|2" ]; then
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT * FROM tab_mixed ORDER BY a")" = "local|1.10|baz|1
|
||||
local|2.20|bar|2" ]; then
|
||||
echo "check update works with different column order and subscriber local values success"
|
||||
else
|
||||
echo "$failed_keyword when check update works with different column order and subscriber local values"
|
||||
@ -305,8 +305,8 @@ local|2.2|bar|2" ]; then
|
||||
|
||||
wait_for_catchup $case_db $pub_node1_port "tap_sub"
|
||||
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, length(b), c, d FROM tab_mixed ORDER BY a")" = "1|3|1.1|local
|
||||
2|500000|2.2|local" ]; then
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, length(b), c, d FROM tab_mixed ORDER BY a")" = "1|3|1.10|local
|
||||
2|500000|2.20|local" ]; then
|
||||
echo "check update transmits large column value success"
|
||||
else
|
||||
echo "$failed_keyword when check update transmits large column value"
|
||||
@ -317,8 +317,8 @@ local|2.2|bar|2" ]; then
|
||||
|
||||
wait_for_catchup $case_db $pub_node1_port "tap_sub"
|
||||
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, length(b), c, d FROM tab_mixed ORDER BY a")" = "1|3|1.1|local
|
||||
2|500000|3.3|local" ]; then
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT a, length(b), c, d FROM tab_mixed ORDER BY a")" = "1|3|1.10|local
|
||||
2|500000|3.30|local" ]; then
|
||||
echo "check update with non-transmitted large column value success"
|
||||
else
|
||||
echo "$failed_keyword when check update with non-transmitted large column value"
|
||||
@ -335,7 +335,7 @@ local|2.2|bar|2" ]; then
|
||||
wait_for_catchup $case_db $pub_node1_port "tap_sub"
|
||||
|
||||
if [ "$(exec_sql $case_db $sub_node1_port "SELECT * FROM tab_mixed ORDER BY a")" = "local|11.11|baz|1
|
||||
local|2.2|bar|2" ]; then
|
||||
local|2.20|bar|2" ]; then
|
||||
echo "check update works with dropped publisher column success"
|
||||
else
|
||||
echo "$failed_keyword when check update works with dropped publisher column"
|
||||
|
||||
Reference in New Issue
Block a user