提交 aeec7baf 编写于 作者: A Ashwin Agrawal

Test should pass correct gp_dbid when starting segments.

Not passing the right gp_dbid, caused test running after these test to
fail, as gp_inject_fault checks dbid to set the fault or not. If
segment was started with gp_dbid=0, the fault fails to set in other
tests causing failures.
上级 5addadb6
......@@ -5,9 +5,7 @@ create language plpythonu;
CREATE
-- end_ignore
create or replace function pg_ctl(datadir text, command text, port int, contentid int) returns text as $$ import subprocess
cmd = 'pg_ctl -D %s ' % datadir if command in ('stop', 'restart'): cmd = cmd + '-w -m immediate %s' % command elif command == 'start': opts = '-p %d -\-gp_dbid=0 -\-silent-mode=true -i -\-gp_contentid=%d -\-gp_num_contents_in_cluster=3' % (port, contentid) cmd = cmd + '-o "%s" start' % opts else: return 'Invalid command input'
return subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).replace('.', '') $$ language plpythonu;
create or replace function pg_ctl(datadir text, command text, port int, contentid int, dbid int) returns text as $$ import subprocess cmd = 'pg_ctl -D %s ' % datadir if command in ('stop', 'restart'): cmd = cmd + '-w -m immediate %s' % command elif command == 'start': opts = '-p %d -\-gp_dbid=%d -\-silent-mode=true -i -\-gp_contentid=%d -\-gp_num_contents_in_cluster=3' % (port, dbid, contentid) cmd = cmd + '-o "%s" start' % opts else: return 'Invalid command input' return subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).replace('.', '') $$ language plpythonu;
CREATE
-- make sure we are in-sync for the primary we will be testing with
......@@ -58,7 +56,7 @@ t
(1 row)
-- stop a mirror and show commit on dbid 2 will block
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=0), 'stop', NULL, NULL);
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=0), 'stop', NULL, NULL, NULL);
pg_ctl
----------------------------------------------------
waiting for server to shut down done
......@@ -68,7 +66,7 @@ server stopped
0U&: insert into segwalrep_commit_blocking values (1); <waiting ...>
-- restart primary dbid 2
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='p' and c.content=0), 'restart', NULL, NULL);
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='p' and c.content=0), 'restart', NULL, NULL, NULL);
pg_ctl
----------------------------------------------------------------------------------------------------
waiting for server to shut down done
......@@ -104,7 +102,7 @@ INSERT 1
INSERT 1
-- bring the mirror back up
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=0), 'start', (select port from gp_segment_configuration where content = 0 and preferred_role = 'm'), 0);
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=0), 'start', (select port from gp_segment_configuration where content = 0 and preferred_role = 'm'), 0, (select dbid from gp_segment_configuration c where c.role='m' and c.content=0));
pg_ctl
----------------
server starting
......
......@@ -9,9 +9,7 @@ create language plpythonu;
CREATE
-- end_ignore
create or replace function pg_ctl(datadir text, command text, port int, contentid int) returns text as $$ import subprocess
cmd = 'pg_ctl -D %s ' % datadir if command in ('stop', 'restart'): cmd = cmd + '-w -m immediate %s' % command elif command == 'start': opts = '-p %d -\-gp_dbid=0 -\-silent-mode=true -i -\-gp_contentid=%d -\-gp_num_contents_in_cluster=3' % (port, contentid) cmd = cmd + '-o "%s" start' % opts else: return 'Invalid command input'
return subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).replace('.', '') $$ language plpythonu;
create or replace function pg_ctl(datadir text, command text, port int, contentid int, dbid int) returns text as $$ import subprocess cmd = 'pg_ctl -D %s ' % datadir if command in ('stop', 'restart'): cmd = cmd + '-w -m immediate %s' % command elif command == 'start': opts = '-p %d -\-gp_dbid=%d -\-silent-mode=true -i -\-gp_contentid=%d -\-gp_num_contents_in_cluster=3' % (port, dbid, contentid) cmd = cmd + '-o "%s" start' % opts else: return 'Invalid command input' return subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).replace('.', '') $$ language plpythonu;
CREATE
-- make sure we are in-sync for the primary we will be testing with
......@@ -68,7 +66,7 @@ t
(1 row)
-- stop a mirror
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=2), 'stop', NULL, NULL);
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=2), 'stop', NULL, NULL, NULL);
pg_ctl
----------------------------------------------------
waiting for server to shut down done
......@@ -149,7 +147,7 @@ synchronous_standby_names
(1 row)
-- bring the mirror back up and see primary s/u and mirror s/u
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=2), 'start', (select port from gp_segment_configuration where content = 2 and preferred_role = 'm'), 2);
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=2), 'start', (select port from gp_segment_configuration where content = 2 and preferred_role = 'm'), 2, (select dbid from gp_segment_configuration c where c.role='m' and c.content=2));
pg_ctl
----------------
server starting
......
......@@ -4,19 +4,17 @@
create language plpythonu;
-- end_ignore
create or replace function pg_ctl(datadir text, command text, port int, contentid int)
create or replace function pg_ctl(datadir text, command text, port int, contentid int, dbid int)
returns text as $$
import subprocess
cmd = 'pg_ctl -D %s ' % datadir
if command in ('stop', 'restart'):
cmd = cmd + '-w -m immediate %s' % command
elif command == 'start':
opts = '-p %d -\-gp_dbid=0 -\-silent-mode=true -i -\-gp_contentid=%d -\-gp_num_contents_in_cluster=3' % (port, contentid)
opts = '-p %d -\-gp_dbid=%d -\-silent-mode=true -i -\-gp_contentid=%d -\-gp_num_contents_in_cluster=3' % (port, dbid, contentid)
cmd = cmd + '-o "%s" start' % opts
else:
return 'Invalid command input'
return subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).replace('.', '')
$$ language plpythonu;
......@@ -40,11 +38,11 @@ select gp_request_fts_probe_scan();
select gp_inject_fault('fts_probe', 'status', 1);
-- stop a mirror and show commit on dbid 2 will block
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=0), 'stop', NULL, NULL);
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=0), 'stop', NULL, NULL, NULL);
0U&: insert into segwalrep_commit_blocking values (1);
-- restart primary dbid 2
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='p' and c.content=0), 'restart', NULL, NULL);
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='p' and c.content=0), 'restart', NULL, NULL, NULL);
-- should show dbid 2 utility mode connection closed because of primary restart
0U<:
......@@ -62,7 +60,7 @@ select gp_inject_fault('fts_probe', 'status', 1);
4: insert into segwalrep_commit_blocking values (3);
-- bring the mirror back up
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=0), 'start', (select port from gp_segment_configuration where content = 0 and preferred_role = 'm'), 0);
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=0), 'start', (select port from gp_segment_configuration where content = 0 and preferred_role = 'm'), 0, (select dbid from gp_segment_configuration c where c.role='m' and c.content=0));
-- should unblock and commit now that mirror is back up and in-sync
3<:
......
......@@ -21,19 +21,17 @@ $$ language plpgsql;
create language plpythonu;
-- end_ignore
create or replace function pg_ctl(datadir text, command text, port int, contentid int)
create or replace function pg_ctl(datadir text, command text, port int, contentid int, dbid int)
returns text as $$
import subprocess
cmd = 'pg_ctl -D %s ' % datadir
if command in ('stop', 'restart'):
cmd = cmd + '-w -m immediate %s' % command
elif command == 'start':
opts = '-p %d -\-gp_dbid=0 -\-silent-mode=true -i -\-gp_contentid=%d -\-gp_num_contents_in_cluster=3' % (port, contentid)
opts = '-p %d -\-gp_dbid=%d -\-silent-mode=true -i -\-gp_contentid=%d -\-gp_num_contents_in_cluster=3' % (port, dbid, contentid)
cmd = cmd + '-o "%s" start' % opts
else:
return 'Invalid command input'
return subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).replace('.', '')
$$ language plpythonu;
......@@ -59,7 +57,7 @@ select gp_request_fts_probe_scan();
select gp_inject_fault('fts_probe', 'status', 1);
-- stop a mirror
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=2), 'stop', NULL, NULL);
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=2), 'stop', NULL, NULL, NULL);
-- this should block since mirror is not up and sync replication is on
2: begin;
......@@ -94,7 +92,7 @@ select content, role, preferred_role, mode, status from gp_segment_configuration
2U: show synchronous_standby_names;
-- bring the mirror back up and see primary s/u and mirror s/u
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=2), 'start', (select port from gp_segment_configuration where content = 2 and preferred_role = 'm'), 2);
-1U: select pg_ctl((select datadir from gp_segment_configuration c where c.role='m' and c.content=2), 'start', (select port from gp_segment_configuration where content = 2 and preferred_role = 'm'), 2, (select dbid from gp_segment_configuration c where c.role='m' and c.content=2));
select wait_for_streaming(2::smallint);
select content, role, preferred_role, mode, status from gp_segment_configuration where content=2;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册