提交 667cee00 编写于 作者: J Jacob Champion 提交者: Xin Zhang

fts_unblock_primary: catch synchronous_standby_names inconsistencies

synchronous_standby_names is set on the first FTS probe after starting
the cluster, and it's written to disk, but it doesn't actually get
persisted in memory on all cluster processes. The backend that "sets"
the value exits without SIGHUP'ing the cluster, and it therefore
"resets" to the empty string. If you're lucky enough to restart the
cluster after this point, everything works as expected, but until then
the cluster is in a strange state.

This test (which currently fails) verifies that the
synchronous_standby_names GUC is actually set appropriately on the
segment.
上级 28eec592
......@@ -22,6 +22,15 @@ content|role|preferred_role|mode|status
2 |m |m |s |u
(2 rows)
-- synchronous_standby_names should be set to '*' by default on primary 2, since
-- we have a working/sync'd mirror
-- XXX We assume primary 2 is DBID 4, which may not be the case.
4U: show synchronous_standby_names;
synchronous_standby_names
-------------------------
*
(1 row)
-- create table and show commits are not blocked
create table fts_unblock_primary (a int) distributed by (a);
CREATE
......@@ -87,6 +96,13 @@ content|role|preferred_role|mode|status
2<: <... completed>
COMMIT
-- synchronous_standby_names should now be empty on the primary
4U: show synchronous_standby_names;
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);
pg_ctl
......@@ -109,3 +125,10 @@ content|role|preferred_role|mode|status
-- everything is back to normal
insert into fts_unblock_primary select i from generate_series(1,10)i;
INSERT 10
-- synchronous_standby_names should be back to its original value on the primary
4U: show synchronous_standby_names;
synchronous_standby_names
-------------------------
*
(1 row)
......@@ -42,6 +42,11 @@ $$ language plpythonu;
-- make sure we are in-sync for the primary we will be testing with
select content, role, preferred_role, mode, status from gp_segment_configuration where content=2;
-- synchronous_standby_names should be set to '*' by default on primary 2, since
-- we have a working/sync'd mirror
-- XXX We assume primary 2 is DBID 4, which may not be the case.
4U: show synchronous_standby_names;
-- create table and show commits are not blocked
create table fts_unblock_primary (a int) distributed by (a);
insert into fts_unblock_primary values (1);
......@@ -72,6 +77,9 @@ select content, role, preferred_role, mode, status from gp_segment_configuration
-- should unblock and commit after FTS sent primary a SyncRepOff libpq message
2<:
-- synchronous_standby_names should now be empty on the primary
4U: 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);
select wait_for_streaming(2::smallint);
......@@ -79,3 +87,6 @@ select content, role, preferred_role, mode, status from gp_segment_configuration
-- everything is back to normal
insert into fts_unblock_primary select i from generate_series(1,10)i;
-- synchronous_standby_names should be back to its original value on the primary
4U: show synchronous_standby_names;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册